aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2016-10-25 11:56:07 -0700
committerAnuj Phogat <[email protected]>2016-11-07 16:13:02 -0800
commita1bd2f6950f8ab8ab355fa5f7ff3d7bf372eab13 (patch)
treebabc526b231bf0dd39cc8a7dc6442de08db3a043
parent0295c792b4b47865ddf7760ebe2980fc6f7a536b (diff)
mesa: Add helper function _mesa_is_alpha_to_coverage_enabled()
Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
-rw-r--r--src/mesa/main/framebuffer.c13
-rw-r--r--src/mesa/main/framebuffer.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 361ed668587..9c7f0c9451f 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 a6adb1c9661..745c1dabf64 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 */