[Mesa-dev] [PATCH 1/2] glsl: Validate that built-in uniforms have backing state

Ian Romanick idr at freedesktop.org
Wed May 28 18:35:47 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

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 at intel.com>
---
 src/glsl/ir_validate.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 2fca437..8f50980 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -685,6 +685,14 @@ ir_validate::visit(ir_variable *ir)
       abort();
    }
 
+   if (ir->data.mode == ir_var_uniform
+       && strncmp(ir->name, "gl_", 3) == 0
+       && ir->get_state_slots() == NULL) {
+      printf("built-in uniform has no state\n");
+      ir->print();
+      abort();
+   }
+
    return visit_continue;
 }
 
-- 
1.8.1.4



More information about the mesa-dev mailing list