Make missing interpolator inputs fatal
authorAapo Tahkola <aet@rasterburn.org>
Tue, 6 Dec 2005 22:26:21 +0000 (22:26 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Tue, 6 Dec 2005 22:26:21 +0000 (22:26 +0000)
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_vertexprog.c

index f4d588af526180f8156e2b474c513d4a1afffb1d..0987735b5053e32ad4b2c7ad61cefb3350adf15d 100644 (file)
@@ -1152,10 +1152,9 @@ void r300_setup_rs_unit(GLcontext *ctx)
                        if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i))) {
                                vp_reg++;
                        } else {
-                               /* Unsure of how to handle this situation, for now print errors and
-                                * the program will just recieve bogus data
-                                */
+                               /* Passing invalid data here can lock the GPU. */
                                fprintf(stderr, "fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
+                               exit(-1);
                        }
                        InputsRead &= ~(FRAG_BIT_TEX0<<i);
                        fp_reg++;
@@ -1163,8 +1162,10 @@ void r300_setup_rs_unit(GLcontext *ctx)
        }
 
        if (InputsRead & FRAG_BIT_COL0) {
-               if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL0) : _TNL_BIT_COLOR0)))
+               if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL0) : _TNL_BIT_COLOR0))) {
                        fprintf(stderr, "fragprog wants col0, vp doesn't provide it\n");
+                       exit(-1);
+               }
 
                r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
                                | R300_RS_ROUTE_0_COLOR
@@ -1174,8 +1175,10 @@ void r300_setup_rs_unit(GLcontext *ctx)
        }
        
        if (InputsRead & FRAG_BIT_COL1) {
-               if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL1) : _TNL_BIT_COLOR1)))
+               if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL1) : _TNL_BIT_COLOR1))) {
                        fprintf(stderr, "fragprog wants col1, vp doesn't provide it\n");
+                       exit(-1);
+               }
 
                r300->hw.rr.cmd[R300_RR_ROUTE_1] |= R300_RS_ROUTE_1_UNKNOWN11
                                | R300_RS_ROUTE_1_COLOR1
@@ -1576,6 +1579,36 @@ void r300UpdateShaderStates(r300ContextPtr rmesa)
 #ifdef CB_DPATH
        r300UpdateTextureState(ctx);
 #endif
+
+#if 0
+#define B_FLAG(x) ((x)?1:0)
+
+       if(hw_tcl_on){
+               int i;
+               GLuint InputsRead;
+               GLuint OutputsWritten;
+               
+               InputsRead = ctx->FragmentProgram._Current->Base.InputsRead;
+               OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->Base.OutputsWritten;
+               
+               for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
+                       /*if(B_FLAG(OutputsWritten & (1 << (VERT_RESULT_TEX0+i))) != B_FLAG(InputsRead & (FRAG_BIT_TEX0<<i))){
+                               fprintf(stderr, "vp_out != fp_in fails for unit %d\n", i);
+                               exit(1);
+                       }*/
+                       /*
+                       if(B_FLAG(ctx->Texture.Unit[i]._ReallyEnabled) != B_FLAG(InputsRead & (FRAG_BIT_TEX0<<i))){
+                               fprintf(stderr, "re != fp_in fails for unit %d\n", i);
+                               exit(1);
+                       }
+                       
+                       if(B_FLAG(ctx->Texture.Unit[i]._ReallyEnabled) != B_FLAG(OutputsWritten & (1 << (VERT_RESULT_TEX0+i)))){
+                               fprintf(stderr, "re != vp_out fails for unit %d\n", i);
+                               exit(1);
+                       }*/
+               }
+       }
+#endif
        
        r300_setup_textures(ctx);
        r300_setup_rs_unit(ctx);
index c7a0c105266f74b7f0fec331c9b7cfc2d5ddb3ea..b24444112940725b30104af0f5aa50a9fbab7f1e 100644 (file)
@@ -463,7 +463,6 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
                vp->outputs[i] = -1;
        
        assert(mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_HPOS));
-       assert(mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_COL0));
        
        /* Assign outputs */
        if(mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))