diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-19 11:12:16 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:39 +0200 |
commit | e42775ba684eadaaa5a1f258c2e713a24206facb (patch) | |
tree | 08ce6266fdc42110c9c4fcb35fb1d10926dfa088 /src/mesa/main/buffers.c | |
parent | d952485d7c4b500753b825053ea28c0fe5bd1c3a (diff) |
mesa: add draw_buffer_error() helper
And make draw_buffer() always inline.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/buffers.c')
-rw-r--r-- | src/mesa/main/buffers.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 6359e1b51fd..a37b39cf525 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -264,9 +264,9 @@ is_legal_es3_readbuffer_enum(GLenum buf) * * See the GL_EXT_framebuffer_object spec for more info. */ -static void +static ALWAYS_INLINE void draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, - GLenum buffer, const char *caller) + GLenum buffer, const char *caller, bool no_error) { GLbitfield destMask; @@ -283,14 +283,14 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, const GLbitfield supportedMask = supported_buffer_bitmask(ctx, fb); destMask = draw_buffer_enum_to_bitmask(ctx, buffer); - if (destMask == BAD_MASK) { + if (!no_error && destMask == BAD_MASK) { /* totally bogus buffer */ _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)", caller, _mesa_enum_to_string(buffer)); return; } destMask &= supportedMask; - if (destMask == 0x0) { + if (!no_error && destMask == 0x0) { /* none of the named color buffers exist! */ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid buffer %s)", caller, _mesa_enum_to_string(buffer)); @@ -311,11 +311,19 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, } +static void +draw_buffer_error(struct gl_context *ctx, struct gl_framebuffer *fb, + GLenum buffer, const char *caller) +{ + draw_buffer(ctx, fb, buffer, caller, false); +} + + void GLAPIENTRY _mesa_DrawBuffer(GLenum buffer) { GET_CURRENT_CONTEXT(ctx); - draw_buffer(ctx, ctx->DrawBuffer, buffer, "glDrawBuffer"); + draw_buffer_error(ctx, ctx->DrawBuffer, buffer, "glDrawBuffer"); } @@ -334,7 +342,7 @@ _mesa_NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf) else fb = ctx->WinSysDrawBuffer; - draw_buffer(ctx, fb, buf, "glNamedFramebufferDrawBuffer"); + draw_buffer_error(ctx, fb, buf, "glNamedFramebufferDrawBuffer"); } |