Mesa (master): glsl: Validate that built-in uniforms have backing state

Ian Romanick idr at kemper.freedesktop.org
Tue Sep 30 20:35:11 UTC 2014


Module: Mesa
Branch: master
Commit: 77005cfabd263e593cec37cd5933443785d6b9aa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=77005cfabd263e593cec37cd5933443785d6b9aa

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed May 28 17:05:14 2014 -0700

glsl: Validate that built-in uniforms have backing state

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>
Reviewed-by: Matt Turner <mattst88 at gmail.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 97a581d..5ed8abb 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -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;
 }
 




More information about the mesa-commit mailing list