summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-08-22 12:34:13 +0200
committerSamuel Pitoiset <[email protected]>2018-08-22 13:57:18 +0200
commit24ee53231da84a1be5ec08abebe8a2ff6aa019ca (patch)
treee66a69d17b430bda13f4f33d4c1bd6eb5a1823e1
parentbea4d4c78c3a6a85d1c7d0ad5c2c5694e19d20f2 (diff)
radv: remove dead variables after splitting per member structs
Otherwise, nir_lower_clip_cull_distance_arrays might report wrong number of output clips/culls because it relies on shader output variables and some of them might be dead. This fixes a rendering issue with Dolphin and Super Mario Sunshine. Fixes: b0c643d8f5 ("spirv: Use NIR per-member splitting") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107610 CC: 18.2 <[email protected]> Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/vulkan/radv_shader.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 7d4265cfdad..207e5b050eb 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -259,9 +259,6 @@ radv_shader_compile_to_nir(struct radv_device *device,
*/
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_shader_out);
- NIR_PASS_V(nir, nir_remove_dead_variables,
- nir_var_shader_in | nir_var_shader_out | nir_var_system_value);
-
/* Now that we've deleted all but the main function, we can go ahead and
* lower the rest of the constant initializers.
*/
@@ -273,6 +270,9 @@ radv_shader_compile_to_nir(struct radv_device *device,
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_split_per_member_structs);
+ NIR_PASS_V(nir, nir_remove_dead_variables,
+ nir_var_shader_in | nir_var_shader_out | nir_var_system_value);
+
NIR_PASS_V(nir, nir_lower_system_values);
NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
}