Mesa (master): mesa: Add helper function _mesa_is_alpha_to_coverage_enabled()

Anuj Phogat aphogat at kemper.freedesktop.org
Tue Nov 8 00:19:17 UTC 2016


Module: Mesa
Branch: master
Commit: a1bd2f6950f8ab8ab355fa5f7ff3d7bf372eab13
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1bd2f6950f8ab8ab355fa5f7ff3d7bf372eab13

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Tue Oct 25 11:56:07 2016 -0700

mesa: Add helper function _mesa_is_alpha_to_coverage_enabled()

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ben Widawsky <ben at bwidawsk.net>

---

 src/mesa/main/framebuffer.c | 13 +++++++++++++
 src/mesa/main/framebuffer.h |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 361ed66..9c7f0c9 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -1016,3 +1016,16 @@ _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);
 }
+
+/**
+ * Is alpha to coverage enabled and applicable to the currently bound
+ * framebuffer?
+ */
+bool
+_mesa_is_alpha_to_coverage_enabled(const struct gl_context *ctx)
+{
+   bool buffer0_is_integer = ctx->DrawBuffer->_IntegerBuffers & 0x1;
+   return (ctx->Multisample.SampleAlphaToCoverage &&
+           _mesa_is_multisample_enabled(ctx) &&
+           !buffer0_is_integer);
+}
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index a6adb1c..745c1da 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -152,4 +152,7 @@ _mesa_is_multisample_enabled(const struct gl_context *ctx);
 extern bool
 _mesa_is_alpha_test_enabled(const struct gl_context *ctx);
 
+extern bool
+_mesa_is_alpha_to_coverage_enabled(const struct gl_context *ctx);
+
 #endif /* FRAMEBUFFER_H */




More information about the mesa-commit mailing list