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

Kenneth Graunke kenneth at whitecape.org
Sat May 31 09:51:55 PDT 2014


On Wednesday, May 28, 2014 06:35:47 PM Ian Romanick wrote:
> 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;
>  }

This patch is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

(It's always good to have more validation, and I verified that this condition 
ought to hold in all cases, AFAICS.) 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140531/e5075f1e/attachment.sig>


More information about the mesa-dev mailing list