Module: Mesa Branch: master Commit: 0295c792b4b47865ddf7760ebe2980fc6f7a536b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0295c792b4b47865ddf7760ebe2980fc6f7a536b
Author: Anuj Phogat <[email protected]> Date: Tue Oct 25 11:55:44 2016 -0700 mesa: Add helper function _mesa_is_alpha_test_enabled() Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ben Widawsky <[email protected]> --- src/mesa/main/framebuffer.c | 11 +++++++++++ src/mesa/main/framebuffer.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index e1505fa..361ed66 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -1005,3 +1005,14 @@ _mesa_is_multisample_enabled(const struct gl_context *ctx) ctx->DrawBuffer && _mesa_geometric_nonvalidated_samples(ctx->DrawBuffer) > 1; } + +/** + * Is alpha testing enabled and applicable to the currently bound + * framebuffer? + */ +bool +_mesa_is_alpha_test_enabled(const struct gl_context *ctx) +{ + bool buffer0_is_integer = ctx->DrawBuffer->_IntegerBuffers & 0x1; + return (ctx->Color.AlphaEnabled && !buffer0_is_integer); +} diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 384f749..a6adb1c 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -149,4 +149,7 @@ _mesa_is_front_buffer_drawing(const struct gl_framebuffer *fb); extern bool _mesa_is_multisample_enabled(const struct gl_context *ctx); +extern bool +_mesa_is_alpha_test_enabled(const struct gl_context *ctx); + #endif /* FRAMEBUFFER_H */ _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
