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

Ian Romanick idr at freedesktop.org
Mon Jul 14 15:48:33 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>
Acked-by: Anuj Phogat <anuj.phogat at gmail.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 42142da..ef660e8 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -696,6 +696,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;
 }
 
-- 
1.8.1.4



More information about the mesa-dev mailing list