From 77005cfabd263e593cec37cd5933443785d6b9aa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 28 May 2014 17:05:14 -0700 Subject: [PATCH] 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 Reviewed-by: Matt Turner Acked-by: Anuj Phogat --- 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 97a581dc2d5..5ed8abba0b4 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; } -- 2.30.2