From: Paul Berry Date: Tue, 15 Oct 2013 21:56:28 +0000 (-0700) Subject: glsl: When disabling gl_PerVertex variables, check that mode matches. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8f6f244bb1963c4af81f431865355beef1b9cbb;p=mesa.git glsl: When disabling gl_PerVertex variables, check that mode matches. In commit 1b4a737 (glsl: Support redeclaration of VS and GS gl_PerVertex output), I added code to ensure that when an unnamed gl_PerVertex interface block is redeclared, any ir_variables that weren't included in the redeclaration are removed from the IR (and the symbol table). This ensures that only those variables that were explicitly redeclared may be used. However, when I wrote this code, I neglected to match the variable mode when finding variables to remove. This meant that redeclaring a built-in output block might cause the built-in input gl_in to be accidentally removed. Fixes piglit test gs-redeclares-pervertex-out-only. Reviewed-by: Ian Romanick Reviewed-by: Matt Turner --- diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 5b49efaf093..3551a59561a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -5042,7 +5042,8 @@ ast_interface_block::hir(exec_list *instructions, foreach_list_safe(node, instructions) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var != NULL && - var->get_interface_type() == earlier_per_vertex) { + var->get_interface_type() == earlier_per_vertex && + var->mode == var_mode) { state->symbols->disable_variable(var->name); var->remove(); }