glsl: Validate that built-in uniforms have backing state
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 29 May 2014 00:05:14 +0000 (17:05 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 30 Sep 2014 20:34:41 +0000 (13:34 -0700)
All built-in uniforms are supposed to be backed by some GL state.  The
state_slots field describes this backing state.

This helped me track down a bug in a later patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
src/glsl/ir_validate.cpp

index 97a581d..5ed8abb 100644 (file)
@@ -700,6 +700,14 @@ ir_validate::visit(ir_variable *ir)
       abort();
    }
 
+   if (ir->data.mode == ir_var_uniform
+       && strncmp(ir->name, "gl_", 3) == 0
+       && ir->state_slots == NULL) {
+      printf("built-in uniform has no state\n");
+      ir->print();
+      abort();
+   }
+
    return visit_continue;
 }