aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/context.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-16 09:37:37 +0200
committermarha <marha@users.sourceforge.net>2012-04-16 09:43:48 +0200
commit00eae6f01bf11ec6a90dfc68e607b6a1a250a118 (patch)
treeb814d518076840b7433d02bc3b5957c1dd54de25 /mesalib/src/mesa/main/context.c
parenta50d2ee664302147942dd5ed6428f9bab9d4e76a (diff)
parentd6d3999ccb2cb72d55820770260172eccbbb68d7 (diff)
downloadvcxsrv-00eae6f01bf11ec6a90dfc68e607b6a1a250a118.tar.gz
vcxsrv-00eae6f01bf11ec6a90dfc68e607b6a1a250a118.tar.bz2
vcxsrv-00eae6f01bf11ec6a90dfc68e607b6a1a250a118.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/Xext/securitysrv.h xorg-server/glx/glxext.h xorg-server/glx/indirect_reqsize.c xorg-server/glx/indirect_size_get.c xorg-server/hw/xwin/winclip.c xorg-server/hw/xwin/winfont.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winglobals.h xorg-server/hw/xwin/winmonitors.h xorg-server/include/closestr.h xorg-server/include/pixmapstr.h xorg-server/include/servermd.h xorg-server/include/site.h xorg-server/include/windowstr.h xorg-server/include/xkbstr.h
Diffstat (limited to 'mesalib/src/mesa/main/context.c')
-rw-r--r--mesalib/src/mesa/main/context.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 83e5de47a..51b024143 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1695,7 +1695,39 @@ _mesa_set_mvp_with_dp4( struct gl_context *ctx,
ctx->mvp_with_dp4 = flag;
}
+static GLboolean
+blend_factor_is_dual_src(GLenum factor)
+{
+ return factor == GL_SRC1_COLOR || factor == GL_SRC1_ALPHA ||
+ factor == GL_ONE_MINUS_SRC1_COLOR || factor == GL_ONE_MINUS_SRC1_ALPHA;
+}
+/*
+ * ARB_blend_func_extended - ERRORS section
+ * "The error INVALID_OPERATION is generated by Begin or any procedure that
+ * implicitly calls Begin if any draw buffer has a blend function requiring the
+ * second color input (SRC1_COLOR, ONE_MINUS_SRC1_COLOR, SRC1_ALPHA or
+ * ONE_MINUS_SRC1_ALPHA), and a framebuffer is bound that has more than
+ * the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active color attachements."
+ */
+static GLboolean
+_mesa_check_blend_func_error(struct gl_context *ctx)
+{
+ GLuint i;
+ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
+ if (blend_factor_is_dual_src(ctx->Color.Blend[i].SrcRGB) ||
+ blend_factor_is_dual_src(ctx->Color.Blend[i].DstRGB) ||
+ blend_factor_is_dual_src(ctx->Color.Blend[i].SrcA) ||
+ blend_factor_is_dual_src(ctx->Color.Blend[i].DstA)) {
+ if (i >= ctx->Const.MaxDualSourceDrawBuffers) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "dual source blend on illegal attachment");
+ return GL_FALSE;
+ }
+ }
+ }
+ return GL_TRUE;
+}
/**
* Prior to drawing anything with glBegin, glDrawArrays, etc. this function
@@ -1816,6 +1848,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
return GL_FALSE;
}
+ if (_mesa_check_blend_func_error(ctx) == GL_FALSE) {
+ return GL_FALSE;
+ }
+
#ifdef DEBUG
if (ctx->Shader.Flags & GLSL_LOG) {
struct gl_shader_program *shProg[MESA_SHADER_TYPES];