summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-08-30 23:38:03 +0000
committerBrian Paul <[email protected]>2006-08-30 23:38:03 +0000
commitb7fc1c32f8f4814987b35e2e92891c2fd6f9973b (patch)
tree63cbbb51c7c957d8fa7b84cea1d9d56f7918fbd0 /src
parentf6de865e56c953c8d0ddec2468b5283e644675be (diff)
Check that we don't try to reference more than one target of a texture unit.texmem_0_2_20060912
For example, referencing both "texture[0], 2D" and "texture[0], CUBE" in one program is an error.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/arbprogparse.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 4edd921b160..6d5567ec85b 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -2643,6 +2643,10 @@ parse_fp_vector_src_reg(GLcontext * ctx, GLubyte ** inst,
}
+/**
+ * Parse fragment program destination register.
+ * \return 1 if error, 0 if no error.
+ */
static GLuint
parse_fp_dst_reg(GLcontext * ctx, GLubyte ** inst,
struct var_cache **vc_head, struct arb_program *Program,
@@ -2666,6 +2670,7 @@ parse_fp_dst_reg(GLcontext * ctx, GLubyte ** inst,
/**
* Parse fragment program scalar src register.
+ * \return 1 if error, 0 if no error.
*/
static GLuint
parse_fp_scalar_src_reg (GLcontext * ctx, GLubyte ** inst,
@@ -2703,6 +2708,7 @@ parse_fp_scalar_src_reg (GLcontext * ctx, GLubyte ** inst,
/**
* This is a big mother that handles getting opcodes into the instruction
* and handling the src & dst registers for fragment program instructions
+ * \return 1 if error, 0 if no error
*/
static GLuint
parse_fp_instruction (GLcontext * ctx, GLubyte ** inst,
@@ -3051,7 +3057,14 @@ parse_fp_instruction (GLcontext * ctx, GLubyte ** inst,
/* TODO ARB_fragment_program_shadow code */
break;
}
- Program->TexturesUsed[texcoord] |= (1<<fp->TexSrcTarget);
+ Program->TexturesUsed[texcoord] |= (1 << fp->TexSrcTarget);
+ /* Check that both "2D" and "CUBE" (for example) aren't both used */
+ if (_mesa_bitcount(Program->TexturesUsed[texcoord]) > 1) {
+ char *msg = "multiple targets used on one texture image unit";
+ _mesa_set_program_error(ctx, Program->Position, msg);
+ _mesa_error(ctx, GL_INVALID_OPERATION, msg);
+ return 1;
+ }
break;
case OP_TEX_KIL:
@@ -3060,6 +3073,9 @@ parse_fp_instruction (GLcontext * ctx, GLubyte ** inst,
return 1;
fp->Opcode = OPCODE_KIL;
break;
+ default:
+ _mesa_problem(ctx, "bad type 0x%x in parse_fp_instruction()", type);
+ return 1;
}
return 0;