From c69f9297cfb6a1f29579fefd3b969d7ad78ec869 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 3 Jan 2019 16:12:20 -0800 Subject: [PATCH] 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 Acked-by: Jason Ekstrand --- src/compiler/glsl/gl_nir_lower_samplers_as_deref.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c index 9ff5708f503..0c12dea3e90 100644 --- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c +++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c @@ -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; } -- 2.30.2