st/mesa: call is_format_supported() for compressed formats
[mesa.git] / src / mesa / state_tracker / st_mesa_to_tgsi.c
index bb52d2d10f432121bd902e1964ad56db903f0537..e8eb9ec3904157d224c4ecda8d9e78d5f39aa437 100644 (file)
@@ -181,6 +181,7 @@ src_register( struct st_translate *t,
       ASSERT(index >= 0);
       if (ureg_dst_is_undef(t->temps[index]))
          t->temps[index] = ureg_DECL_temporary( t->ureg );
+      assert(index < Elements(t->temps));
       return ureg_src(t->temps[index]);
 
    case PROGRAM_NAMED_PARAM:
@@ -197,9 +198,11 @@ src_register( struct st_translate *t,
          return t->constants[index];
 
    case PROGRAM_INPUT:
+      assert(t->inputMapping[index] < Elements(t->inputs));
       return t->inputs[t->inputMapping[index]];
 
    case PROGRAM_OUTPUT:
+      assert(t->outputMapping[index] < Elements(t->outputs));
       return ureg_src(t->outputs[t->outputMapping[index]]); /* not needed? */
 
    case PROGRAM_ADDRESS:
@@ -957,8 +960,9 @@ st_translate_mesa_program(
                * do this before emitting the constant decls below, or this
                * will be missed:
                */
-            unsigned pointSizeClampConst = _mesa_add_state_reference(program->Parameters,
-                                                                     pointSizeClampState);
+            unsigned pointSizeClampConst =
+               _mesa_add_state_reference(program->Parameters,
+                                         pointSizeClampState);
             struct ureg_dst psizregtemp = ureg_DECL_temporary( ureg );
             t->pointSizeConst = ureg_DECL_constant( ureg, pointSizeClampConst );
             t->psizregreal = t->outputs[i];
@@ -977,12 +981,10 @@ st_translate_mesa_program(
       t->address[0] = ureg_DECL_address( ureg );
    }
 
-
    /* Emit constants and immediates.  Mesa uses a single index space
     * for these, so we put all the translated regs in t->constants.
     */
    if (program->Parameters) {
-      
       t->constants = CALLOC( program->Parameters->NumParameters,
                              sizeof t->constants[0] );
       if (t->constants == NULL) {
@@ -1037,7 +1039,8 @@ st_translate_mesa_program(
          possible early return */
       if (t->prevInstWrotePsiz && program->Id) {
          set_insn_start( t, ureg_get_instruction_number( ureg ));
-         ureg_MAX( t->ureg, ureg_writemask(t->outputs[t->psizoutindex], WRITEMASK_X),
+         ureg_MAX( t->ureg,
+                   ureg_writemask(t->outputs[t->psizoutindex], WRITEMASK_X),
                    ureg_src(t->outputs[t->psizoutindex]),
                    ureg_swizzle(t->pointSizeConst, 1,1,1,1));
          ureg_MIN( t->ureg, ureg_writemask(t->psizregreal, WRITEMASK_X),