i965: added texture unit sanity check
authorBrian Paul <brianp@vmware.com>
Wed, 26 Aug 2009 18:07:52 +0000 (12:07 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 26 Aug 2009 18:08:23 +0000 (12:08 -0600)
Check that all the textures needed by the current fragment program
actually exist and are valid.

src/mesa/drivers/dri/i965/brw_state_upload.c

index 95d42d2dcc5bc47f701c017cb826c0df44c0b5d5..414620d0b39990a08e0d4ae1f8fb12435755d0f0 100644 (file)
@@ -322,6 +322,19 @@ void brw_validate_state( struct brw_context *brw )
         }
       }
    }
+
+   /* Make sure that the textures which are referenced by the current
+    * brw fragment program are actually present/valid.
+    * If this fails, we can experience GPU lock-ups.
+    */
+   {
+      const struct brw_fragment_program *fp;
+      fp = brw_fragment_program_const(brw->fragment_program);
+      if (fp) {
+         assert((fp->tex_units_used & ctx->Texture._EnabledUnits)
+                == fp->tex_units_used);
+      }
+   }
 }