From beb74c9b87b90a4a10c9c4b26191d3d2ebd973d6 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 26 Jun 2017 18:25:10 +0200 Subject: [PATCH] mesa: prepare create_render_buffers() for KHR_no_error support Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- src/mesa/main/fbobject.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 74b38180900..4c312332079 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1705,11 +1705,6 @@ create_render_buffers(struct gl_context *ctx, GLsizei n, GLuint *renderbuffers, GLuint first; GLint i; - if (n < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", func); - return; - } - if (!renderbuffers) return; @@ -1734,11 +1729,26 @@ create_render_buffers(struct gl_context *ctx, GLsizei n, GLuint *renderbuffers, } +static void +create_render_buffers_err(struct gl_context *ctx, GLsizei n, + GLuint *renderbuffers, bool dsa) +{ + const char *func = dsa ? "glCreateRenderbuffers" : "glGenRenderbuffers"; + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", func); + return; + } + + create_render_buffers(ctx, n, renderbuffers, dsa); +} + + void GLAPIENTRY _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers) { GET_CURRENT_CONTEXT(ctx); - create_render_buffers(ctx, n, renderbuffers, false); + create_render_buffers_err(ctx, n, renderbuffers, false); } @@ -1746,7 +1756,7 @@ void GLAPIENTRY _mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers) { GET_CURRENT_CONTEXT(ctx); - create_render_buffers(ctx, n, renderbuffers, true); + create_render_buffers_err(ctx, n, renderbuffers, true); } -- 2.30.2