diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-21 14:23:35 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-08-02 12:54:32 +0200 |
commit | b18b1fa6bc50a304f213fc007395528ba68c925e (patch) | |
tree | 6452adbda664d4e0e666b93086255288d1155fdc /src/mesa/main | |
parent | 73c5e750d799a8b35f282767fe6fa57f32190089 (diff) |
mesa: add clear_bufferuiv() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/clear.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 62a00c04018..5ee1eb24337 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -435,11 +435,10 @@ _mesa_ClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, * New in GL 3.0 * Clear unsigned integer color buffer (not depth, not stencil). */ -void GLAPIENTRY -_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) +static ALWAYS_INLINE void +clear_bufferuiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer, + const GLuint *value, bool no_error) { - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); @@ -451,7 +450,7 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *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, "glClearBufferuiv(drawbuffer=%d)", drawbuffer); return; @@ -471,19 +470,29 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *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 ClearBufferuiv and - * ClearNamedFramebufferuiv if buffer is not COLOR." - */ - _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferuiv(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 ClearBufferuiv and + * ClearNamedFramebufferuiv if buffer is not COLOR." + */ + _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferuiv(buffer=%s)", + _mesa_enum_to_string(buffer)); + } return; } } +void GLAPIENTRY +_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + clear_bufferuiv(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 |