Outputs[] array wasn't large enough, define MAX_PROGRAM_OUTPUTS, new assertions.
authorBrian <brian@yutani.localnet.net>
Sat, 24 Feb 2007 22:49:54 +0000 (15:49 -0700)
committerBrian <brian@yutani.localnet.net>
Sat, 24 Feb 2007 22:49:54 +0000 (15:49 -0700)
src/mesa/shader/prog_execute.c
src/mesa/shader/prog_execute.h

index 6417a88e900557d6caeb8252efa76aba26aea876..063d572428b38766159257b5f238006ab04dad32 100644 (file)
@@ -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:
index 0e737657e345e18fa79ab2b1ef1c392cd044d1d9..1eb9e73d01abd211186810266508bc506ee57b9f 100644 (file)
@@ -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];