summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2017-01-08 23:17:38 +0100
committerBas Nieuwenhuizen <[email protected]>2017-01-12 21:39:46 +0100
commit65cbb993d33976d9ee24eff01ade8ed9013617ca (patch)
treef29766d6e841ec63738f0c970d0c46760fb9a831 /src/amd
parent18e70edd8c283463b2a5c8a22b6a5ea9a8d8fcd3 (diff)
radv: Call nir_lower_constant_initializers.
Port of c5d664f9dc2d281c74844cef36ecb9f5862a8f6a "anv/pipeline: Call nir_lower_constant_initializers" Signed-off-by: Bas Nieuwenhuizen <[email protected]> Cc: <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_pipeline.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 03603f5ecc2..d818938e1e4 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -205,6 +205,13 @@ radv_shader_compile_to_nir(struct radv_device *device,
free(spec_entries);
+ /* We have to lower away local constant initializers right before we
+ * inline functions. That way they get properly initialized at the top
+ * of the function and not at the top of its caller.
+ */
+ nir_lower_constant_initializers(nir, nir_var_local);
+ nir_validate_shader(nir);
+
nir_lower_returns(nir);
nir_validate_shader(nir);
@@ -224,6 +231,12 @@ radv_shader_compile_to_nir(struct radv_device *device,
nir_var_system_value);
nir_validate_shader(nir);
+ /* Now that we've deleted all but the main function, we can go ahead and
+ * lower the rest of the constant initializers.
+ */
+ nir_lower_constant_initializers(nir, ~0);
+ nir_validate_shader(nir);
+
nir_lower_system_values(nir);
nir_validate_shader(nir);
}