Module: Mesa
Branch: master
Commit: e8d9b7ab02fc56cadffc7a2bb993b39cccde2b66
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8d9b7ab02fc56cadffc7a2bb993b39cccde2b66

Author: Dave Airlie <airl...@redhat.com>
Date:   Mon Mar 19 04:27:49 2018 +0000

radv: lower constant initializers on output variables earlier

If a shader only writes to an output via a constant initializer we
need to lower it before we call nir_remove_dead_variables so that
this pass sees the stores from the initializer and doesn't kill the
output.

Fixes test failures in new work-in-progress CTS tests:
dEQP-VK.spirv_assembly.instruction.graphics.variable_init.output.float

This is ported from anv:
99b57daf4a anv/pipeline: lower constant initializers on output variables earlier
from Iago Toral Quiroga <ito...@igalia.com>

Reviewed-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>

---

 src/amd/vulkan/radv_shader.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 180b427a44..ac577c36e9 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -244,6 +244,11 @@ radv_shader_compile_to_nir(struct radv_device *device,
                assert(exec_list_length(&nir->functions) == 1);
                entry_point->name = ralloc_strdup(entry_point, "main");
 
+               /* Make sure we lower constant initializers on output variables 
so that
+                * nir_remove_dead_variables below sees the corresponding stores
+                */
+               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);
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to