nir: Fix gl_nir_lower_samplers_as_deref's structure type handling.

We recurse to remove structures, and at each step, re-modify the
resulting type for our link in the deref chain.  For arrays, the
result of recursion is the new underlying type - so we wrap it with
the array dimensionality again.  For structs, we want to simply use
the new underlying type, skipping the struct altogether.

The correct way to do this is to do nothing at all.  Previously, we
had reset type to next->type, which is the /old/ field type, not the
new field type we obtained by recursing.  This undid our recursive work.

Fixes about 338 tests with nested structs, such as:

dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.nested_structs_arrays.sampler2D_samplerCube_fragment

Note that currently only radeonsi uses this pass, and NIR support is
disabled there by default, so the breakage was likely not seen by most
people.  The next commit uses this pass for more drivers, so this fix
prevents regressions from that change.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Kenneth Graunke 2019-01-03 16:12:20 -08:00
parent be6cee51c0
commit c69f9297cf
1 changed files with 0 additions and 3 deletions

View File

@ -109,9 +109,6 @@ remove_struct_derefs_prep(nir_deref_instr **p, char **name,
glsl_get_struct_elem_name(cur->type, next->strct.index));
remove_struct_derefs_prep(&p[1], name, location, type);
/* skip over the struct type: */
*type = next->type;
break;
}