summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h15
-rw-r--r--src/mesa/main/texenv.c50
-rw-r--r--src/mesa/main/texenvprogram.c13
3 files changed, 40 insertions, 38 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e77dd1d226a..c1f06885ec4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1338,18 +1338,23 @@ struct gl_texture_object
};
+/** Up to four combiner sources are possible with GL_NV_texture_env_combine4 */
+#define MAX_COMBINER_TERMS 4
+
+
/**
* Texture combine environment state.
- * Up to four combiner sources are possible with GL_NV_texture_env_combine4.
*/
struct gl_tex_env_combine_state
{
GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
- GLenum SourceRGB[4]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
- GLenum SourceA[4]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
- GLenum OperandRGB[4]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
- GLenum OperandA[4]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
+ /** Source terms: GL_PRIMARY_COLOR, GL_TEXTURE, etc */
+ GLenum SourceRGB[MAX_COMBINER_TERMS];
+ GLenum SourceA[MAX_COMBINER_TERMS];
+ /** Source operands: GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, etc */
+ GLenum OperandRGB[MAX_COMBINER_TERMS];
+ GLenum OperandA[MAX_COMBINER_TERMS];
GLuint ScaleShiftRGB; /**< 0, 1 or 2 */
GLuint ScaleShiftA; /**< 0, 1 or 2 */
GLuint _NumArgsRGB; /**< Number of inputs used for the RGB combiner */
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index c2960fc8208..4d511f2f7ed 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -184,7 +184,7 @@ set_combiner_source(GLcontext *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLenum param)
{
- GLuint src;
+ GLuint term;
GLboolean alpha, legal;
if (!ctx->Extensions.EXT_texture_env_combine &&
@@ -194,24 +194,24 @@ set_combiner_source(GLcontext *ctx,
}
/*
- * Translate pname to (src, alpha).
+ * Translate pname to (term, alpha).
*/
switch (pname) {
case GL_SOURCE0_RGB:
- src = 0;
+ term = 0;
alpha = GL_FALSE;
break;
case GL_SOURCE1_RGB:
- src = 1;
+ term = 1;
alpha = GL_FALSE;
break;
case GL_SOURCE2_RGB:
- src = 2;
+ term = 2;
alpha = GL_FALSE;
break;
case GL_SOURCE3_RGB_NV:
if (ctx->Extensions.NV_texture_env_combine4) {
- src = 3;
+ term = 3;
alpha = GL_FALSE;
}
else {
@@ -220,20 +220,20 @@ set_combiner_source(GLcontext *ctx,
}
break;
case GL_SOURCE0_ALPHA:
- src = 0;
+ term = 0;
alpha = GL_TRUE;
break;
case GL_SOURCE1_ALPHA:
- src = 1;
+ term = 1;
alpha = GL_TRUE;
break;
case GL_SOURCE2_ALPHA:
- src = 2;
+ term = 2;
alpha = GL_TRUE;
break;
case GL_SOURCE3_ALPHA_NV:
if (ctx->Extensions.NV_texture_env_combine4) {
- src = 3;
+ term = 3;
alpha = GL_TRUE;
}
else {
@@ -246,7 +246,7 @@ set_combiner_source(GLcontext *ctx,
return;
}
- assert(src < 4);
+ assert(term < MAX_COMBINER_TERMS);
/*
* Error-check param (the source term)
@@ -288,9 +288,9 @@ set_combiner_source(GLcontext *ctx,
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
if (alpha)
- texUnit->Combine.SourceA[src] = param;
+ texUnit->Combine.SourceA[term] = param;
else
- texUnit->Combine.SourceRGB[src] = param;
+ texUnit->Combine.SourceRGB[term] = param;
}
@@ -300,7 +300,7 @@ set_combiner_operand(GLcontext *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLenum param)
{
- GLuint op;
+ GLuint term;
GLboolean alpha, legal;
if (!ctx->Extensions.EXT_texture_env_combine &&
@@ -311,16 +311,16 @@ set_combiner_operand(GLcontext *ctx,
switch (pname) {
case GL_OPERAND0_RGB:
- op = 0;
+ term = 0;
alpha = GL_FALSE;
break;
case GL_OPERAND1_RGB:
- op = 1;
+ term = 1;
alpha = GL_FALSE;
break;
case GL_OPERAND2_RGB:
if (ctx->Extensions.ARB_texture_env_combine) {
- op = 2;
+ term = 2;
alpha = GL_FALSE;
}
else {
@@ -330,7 +330,7 @@ set_combiner_operand(GLcontext *ctx,
break;
case GL_OPERAND3_RGB_NV:
if (ctx->Extensions.NV_texture_env_combine4) {
- op = 3;
+ term = 3;
alpha = GL_FALSE;
}
else {
@@ -339,16 +339,16 @@ set_combiner_operand(GLcontext *ctx,
}
break;
case GL_OPERAND0_ALPHA:
- op = 0;
+ term = 0;
alpha = GL_TRUE;
break;
case GL_OPERAND1_ALPHA:
- op = 1;
+ term = 1;
alpha = GL_TRUE;
break;
case GL_OPERAND2_ALPHA:
if (ctx->Extensions.ARB_texture_env_combine) {
- op = 2;
+ term = 2;
alpha = GL_TRUE;
}
else {
@@ -358,7 +358,7 @@ set_combiner_operand(GLcontext *ctx,
break;
case GL_OPERAND3_ALPHA_NV:
if (ctx->Extensions.NV_texture_env_combine4) {
- op = 3;
+ term = 3;
alpha = GL_TRUE;
}
else {
@@ -371,7 +371,7 @@ set_combiner_operand(GLcontext *ctx,
return;
}
- assert(op < 4);
+ assert(term < MAX_COMBINER_TERMS);
/*
* Error-check param (the source operand)
@@ -397,9 +397,9 @@ set_combiner_operand(GLcontext *ctx,
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
if (alpha)
- texUnit->Combine.OperandA[op] = param;
+ texUnit->Combine.OperandA[term] = param;
else
- texUnit->Combine.OperandRGB[op] = param;
+ texUnit->Combine.OperandRGB[term] = param;
}
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 3fbd119b347..4a124bf27e2 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -39,9 +39,6 @@
#include "texenvprogram.h"
-#define MAX_TERMS 4
-
-
/*
* Note on texture units:
*
@@ -95,11 +92,11 @@ struct state_key {
GLuint NumArgsRGB:3;
GLuint ModeRGB:5;
- struct mode_opt OptRGB[MAX_TERMS];
+ struct mode_opt OptRGB[MAX_COMBINER_TERMS];
GLuint NumArgsA:3;
GLuint ModeA:5;
- struct mode_opt OptA[MAX_TERMS];
+ struct mode_opt OptA[MAX_COMBINER_TERMS];
} unit[8];
};
@@ -389,7 +386,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB;
key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftA;
- for (j = 0; j < MAX_TERMS; j++) {
+ for (j = 0; j < MAX_COMBINER_TERMS; j++) {
key->unit[i].OptRGB[j].Operand =
translate_operand(texUnit->_CurrentCombine->OperandRGB[j]);
key->unit[i].OptA[j].Operand =
@@ -972,11 +969,11 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
GLuint mode,
const struct mode_opt *opt)
{
- struct ureg src[MAX_TERMS];
+ struct ureg src[MAX_COMBINER_TERMS];
struct ureg tmp, half;
GLuint i;
- assert(nr <= MAX_TERMS);
+ assert(nr <= MAX_COMBINER_TERMS);
tmp = undef; /* silence warning (bug 5318) */