mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
glsl: don't remove redefined per vertex block
Commit 719bf30165 added this removal code with the following
justification:
"The GLSL 4.10 rules for redeclaration of built-in interface blocks
(which we've chosen to regard as clarifications of GLSL 1.50) only
require gl_PerVertex blocks to match in shaders that actually use
those blocks. The easiest way to implement this is to detect
situations where a compiled shader doesn't refer to any elements of
gl_PerVertex, and remove all the associated ir_variables from the
shader at the end of ast-to-ir conversion."
However the intention is to avoid matching a redeclared block with
gl's default block if unused. We are still required to do block
matching in the shader should the block be redeclared, even if unused.
So with this change we only remove the block if it is both unused
and not redeclared.
The existing glsl IR code managed to avoid failing CTS tests for this
due to seemingly magical or hacky use of the symbol table but fixing
it will make things much clearer, and also allow a nir version of
this validation in a following patch.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28538>
This commit is contained in:
parent
c46827d52a
commit
20978004a7
1 changed files with 2 additions and 1 deletions
|
|
@ -9216,7 +9216,8 @@ remove_per_vertex_blocks(exec_list *instructions,
|
|||
foreach_in_list_safe(ir_instruction, node, instructions) {
|
||||
ir_variable *const var = node->as_variable();
|
||||
if (var != NULL && var->get_interface_type() == per_vertex &&
|
||||
var->data.mode == mode) {
|
||||
var->data.mode == mode &&
|
||||
var->data.how_declared == ir_var_declared_implicitly) {
|
||||
state->symbols->disable_variable(var->name);
|
||||
var->remove();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue