diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-21 14:27:23 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-08-02 12:54:32 +0200 |
commit | 54bd9a1d6698760e714606b111fe49ddae2f01f1 (patch) | |
tree | 94e0d9e6f1f0f7f92f25f8c02bf914fe942013c9 /src | |
parent | 11e0542e5ce9a3c72222f7eff09987bc6dbeb9eb (diff) |
mesa: add clear_bufferiv() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/clear.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 3aa3cfd9a98..ea75a95184e 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -338,12 +338,11 @@ make_color_buffer_mask(struct gl_context *ctx, GLint drawbuffer) * New in GL 3.0 * Clear signed integer color buffer or stencil buffer (not depth). */ -void GLAPIENTRY -_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) +static ALWAYS_INLINE void +clear_bufferiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer, + const GLint *value, bool no_error) { - GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); - FLUSH_CURRENT(ctx, 0); if (ctx->NewState) { @@ -359,7 +358,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) * value of MAX DRAW BUFFERS minus one; or if buffer is DEPTH, * STENCIL, or DEPTH STENCIL and drawbuffer is not zero." */ - if (drawbuffer != 0) { + if (!no_error && drawbuffer != 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)", drawbuffer); return; @@ -380,7 +379,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) case GL_COLOR: { const GLbitfield mask = make_color_buffer_mask(ctx, drawbuffer); - if (mask == INVALID_MASK) { + if (!no_error && mask == INVALID_MASK) { _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)", drawbuffer); return; @@ -400,19 +399,29 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) } break; default: - /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' - * of the OpenGL 4.5 spec states: - * - * "An INVALID_ENUM error is generated by ClearBufferiv and - * ClearNamedFramebufferiv if buffer is not COLOR or STENCIL." - */ - _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)", - _mesa_enum_to_string(buffer)); + if (!no_error) { + /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' + * of the OpenGL 4.5 spec states: + * + * "An INVALID_ENUM error is generated by ClearBufferiv and + * ClearNamedFramebufferiv if buffer is not COLOR or STENCIL." + */ + _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)", + _mesa_enum_to_string(buffer)); + } return; } } +void GLAPIENTRY +_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + clear_bufferiv(ctx, buffer, drawbuffer, value, false); +} + + /** * The ClearBuffer framework is so complicated and so riddled with the * assumption that the framebuffer is bound that, for now, we will just fake |