summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-24 15:49:54 -0700
committerBrian <[email protected]>2007-02-24 15:49:54 -0700
commit292a80466d3e0b1cec998f2dc1b0abe25dc10fb8 (patch)
tree49fd3624ec9536c222c91b19736cc49bcfa72034 /src
parent5e80c62f3178a65bebca942aa0b1e5d16c34b2a9 (diff)
Outputs[] array wasn't large enough, define MAX_PROGRAM_OUTPUTS, new assertions.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/prog_execute.c5
-rw-r--r--src/mesa/shader/prog_execute.h6
2 files changed, 8 insertions, 3 deletions
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 6417a88e900..063d572428b 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -153,8 +153,7 @@ get_register_pointer(GLcontext * ctx,
}
case PROGRAM_OUTPUT:
- /* This is only for PRINT */
- ASSERT(source->Index < FRAG_RESULT_MAX);
+ ASSERT(source->Index < MAX_PROGRAM_OUTPUTS);
return machine->Outputs[source->Index];
case PROGRAM_LOCAL_PARAM:
@@ -453,9 +452,11 @@ store_vector4(const struct prog_instruction *inst,
switch (dest->File) {
case PROGRAM_OUTPUT:
+ ASSERT(dest->Index < MAX_PROGRAM_OUTPUTS);
dstReg = machine->Outputs[dest->Index];
break;
case PROGRAM_TEMPORARY:
+ ASSERT(dest->Index < MAX_PROGRAM_TEMPS);
dstReg = machine->Temporaries[dest->Index];
break;
case PROGRAM_WRITE_ONLY:
diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h
index 0e737657e34..1eb9e73d01a 100644
--- a/src/mesa/shader/prog_execute.h
+++ b/src/mesa/shader/prog_execute.h
@@ -35,6 +35,10 @@ typedef void (*FetchTexelDerivFunc)(GLcontext *ctx, const GLfloat texcoord[4],
GLuint unit, GLfloat color[4]);
+/** The larger of VERT_RESULT_MAX, FRAG_RESULT_MAX */
+#define MAX_PROGRAM_OUTPUTS VERT_RESULT_MAX
+
+
/**
* Virtual machine state used during execution of vertex/fragment programs.
*/
@@ -50,7 +54,7 @@ struct gl_program_machine
GLfloat VertAttribs[VERT_ATTRIB_MAX][4];
GLfloat Temporaries[MAX_PROGRAM_TEMPS][4];
- GLfloat Outputs[FRAG_RESULT_MAX][4];
+ GLfloat Outputs[MAX_PROGRAM_OUTPUTS][4];
GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */
GLint AddressReg[MAX_VERTEX_PROGRAM_ADDRESS_REGS][4];