aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texenv.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-22 19:42:40 +0000
committermarha <marha@users.sourceforge.net>2010-11-22 19:42:40 +0000
commit85ef9930f56bf15181f9a0b238f03d55303cf411 (patch)
tree63b43286956ebd1c35c96e9b3d5305aabdf71a0f /mesalib/src/mesa/main/texenv.c
parent94810d19989336862251dbf69c3f3acb18a9b06d (diff)
downloadvcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.tar.gz
vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.tar.bz2
vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.zip
Updated to mesalib 7.9
Diffstat (limited to 'mesalib/src/mesa/main/texenv.c')
-rw-r--r--mesalib/src/mesa/main/texenv.c119
1 files changed, 37 insertions, 82 deletions
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index 4442fb8cf..3a55128c7 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -196,57 +196,34 @@ set_combiner_source(GLcontext *ctx,
/*
* Translate pname to (term, alpha).
+ *
+ * The enums were given sequential values for a reason.
*/
switch (pname) {
case GL_SOURCE0_RGB:
- term = 0;
- alpha = GL_FALSE;
- break;
case GL_SOURCE1_RGB:
- term = 1;
- alpha = GL_FALSE;
- break;
case GL_SOURCE2_RGB:
- term = 2;
- alpha = GL_FALSE;
- break;
case GL_SOURCE3_RGB_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_FALSE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_SOURCE0_RGB;
+ alpha = GL_FALSE;
break;
case GL_SOURCE0_ALPHA:
- term = 0;
- alpha = GL_TRUE;
- break;
case GL_SOURCE1_ALPHA:
- term = 1;
- alpha = GL_TRUE;
- break;
case GL_SOURCE2_ALPHA:
- term = 2;
- alpha = GL_TRUE;
- break;
case GL_SOURCE3_ALPHA_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_TRUE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_SOURCE0_ALPHA;
+ alpha = GL_TRUE;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
+ if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+
assert(term < MAX_COMBINER_TERMS);
/*
@@ -310,68 +287,33 @@ set_combiner_operand(GLcontext *ctx,
return;
}
+ /* The enums were given sequential values for a reason.
+ */
switch (pname) {
case GL_OPERAND0_RGB:
- term = 0;
- alpha = GL_FALSE;
- break;
case GL_OPERAND1_RGB:
- term = 1;
- 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;
- }
- break;
case GL_OPERAND3_RGB_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_FALSE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_OPERAND0_RGB;
+ alpha = GL_FALSE;
break;
case GL_OPERAND0_ALPHA:
- term = 0;
- alpha = GL_TRUE;
- break;
case GL_OPERAND1_ALPHA:
- term = 1;
- 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;
- }
- break;
case GL_OPERAND3_ALPHA_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_TRUE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_OPERAND0_ALPHA;
+ alpha = GL_TRUE;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
+ if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+
assert(term < MAX_COMBINER_TERMS);
/*
@@ -380,10 +322,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: