summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-09-08 10:37:54 -0700
committerIan Romanick <[email protected]>2010-09-08 16:26:07 -0700
commit1a2d498b4164f457c48e9fde9ae8bbadfcf7fa72 (patch)
tree8762a80aa69900f0624f38370b5e54d4af165a12 /src/mesa/main
parentf24ec6367b1cf6c6822fa998df8a877288711427 (diff)
mesa: Fix handling of texenv operands for EXT vs ARB version
GL_EXT_texture_env_combine has slightly more restrictive limits on the valid sources for some operands. This wasn't caught before because almost every driver in Mesa that supports the EXT version also supports the ARB version. Inspired by a patch posted the the mesa-dev mailing list by Andrew Randrianasulu.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texenv.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 4442fb8cf8e..9b9c4b1ccd5 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -320,14 +320,8 @@ set_combiner_operand(GLcontext *ctx,
alpha = GL_FALSE;
break;
case GL_OPERAND2_RGB:
- if (ctx->Extensions.ARB_texture_env_combine) {
- term = 2;
- alpha = GL_FALSE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = 2;
+ alpha = GL_FALSE;
break;
case GL_OPERAND3_RGB_NV:
if (ctx->Extensions.NV_texture_env_combine4) {
@@ -348,14 +342,8 @@ set_combiner_operand(GLcontext *ctx,
alpha = GL_TRUE;
break;
case GL_OPERAND2_ALPHA:
- if (ctx->Extensions.ARB_texture_env_combine) {
- term = 2;
- alpha = GL_TRUE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = 2;
+ alpha = GL_TRUE;
break;
case GL_OPERAND3_ALPHA_NV:
if (ctx->Extensions.NV_texture_env_combine4) {
@@ -380,10 +368,23 @@ set_combiner_operand(GLcontext *ctx,
switch (param) {
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
- legal = !alpha;
+ /* The color input can only be used with GL_OPERAND[01]_RGB in the EXT
+ * version. In the ARB and NV versions they can be used for any RGB
+ * operand.
+ */
+ legal = !alpha
+ && ((term < 2) || ctx->Extensions.ARB_texture_env_combine
+ || ctx->Extensions.NV_texture_env_combine4);
break;
- case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
+ /* GL_ONE_MINUS_SRC_ALPHA can only be used with
+ * GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV
+ * versions it can be used for any operand.
+ */
+ legal = (term < 2) || ctx->Extensions.ARB_texture_env_combine
+ || ctx->Extensions.NV_texture_env_combine4;
+ break;
+ case GL_SRC_ALPHA:
legal = GL_TRUE;
break;
default: