summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-05-15 10:31:38 +1000
committerTimothy Arceri <[email protected]>2017-05-17 10:12:03 +1000
commitb5c67f469a5e8b406c12c529399d631a887700ee (patch)
tree028c17121704f1334377a6c434c79e6027adf259 /src
parentb3888b7a681d5ef598ef55f3c3822082daa46fda (diff)
mesa: add blend_func_separatei() helper
This will be used to add KHR_no_error support. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/blend.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 955fda1158c..ed519bcc0e0 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -292,24 +292,23 @@ _mesa_BlendFunciARB(GLuint buf, GLenum sfactor, GLenum dfactor)
}
-/**
- * Set separate blend source/dest factors for one color buffer/target.
- */
-void GLAPIENTRY
-_mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA)
+static ALWAYS_INLINE void
+blend_func_separatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA, bool no_error)
{
GET_CURRENT_CONTEXT(ctx);
- if (!ctx->Extensions.ARB_draw_buffers_blend) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendFunc[Separate]i()");
- return;
- }
+ if (!no_error) {
+ if (!ctx->Extensions.ARB_draw_buffers_blend) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendFunc[Separate]i()");
+ return;
+ }
- if (buf >= ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glBlendFuncSeparatei(buffer=%u)",
- buf);
- return;
+ if (buf >= ctx->Const.MaxDrawBuffers) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBlendFuncSeparatei(buffer=%u)",
+ buf);
+ return;
+ }
}
if (ctx->Color.Blend[buf].SrcRGB == sfactorRGB &&
@@ -318,9 +317,9 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
ctx->Color.Blend[buf].DstA == dfactorA)
return; /* no change */
- if (!validate_blend_factors(ctx, "glBlendFuncSeparatei",
- sfactorRGB, dfactorRGB,
- sfactorA, dfactorA)) {
+ if (!no_error && !validate_blend_factors(ctx, "glBlendFuncSeparatei",
+ sfactorRGB, dfactorRGB,
+ sfactorA, dfactorA)) {
return;
}
@@ -336,6 +335,18 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
/**
+ * Set separate blend source/dest factors for one color buffer/target.
+ */
+void GLAPIENTRY
+_mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA)
+{
+ blend_func_separatei(buf, sfactorRGB, dfactorRGB, sfactorA, dfactorA,
+ false);
+}
+
+
+/**
* Return true if \p mode is a legal blending equation, excluding
* GL_KHR_blend_equation_advanced modes.
*/