diff options
-rw-r--r-- | src/amd/vulkan/radv_shader.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_nir.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index b6de97deb24..729aabaf272 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -442,6 +442,13 @@ radv_shader_compile_to_nir(struct radv_device *device, */ nir_lower_var_copies(nir); + /* Lower large variables that are always constant with load_constant + * intrinsics, which get turned into PC-relative loads from a data + * section next to the shader. + */ + NIR_PASS_V(nir, nir_opt_large_constants, + glsl_get_natural_size_align_bytes, 16); + /* Indirect lowering must be called after the radv_optimize_nir() loop * has been called at least once. Otherwise indirect lowering can * bloat the instruction count of the loop and cause it to be diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index a71b8fbbb9c..fdd139141e2 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -986,6 +986,13 @@ void si_lower_nir(struct si_shader_selector *sel) }; NIR_PASS_V(sel->nir, nir_lower_subgroups, &subgroups_options); + /* Lower large variables that are always constant with load_constant + * intrinsics, which get turned into PC-relative loads from a data + * section next to the shader. + */ + NIR_PASS_V(sel->nir, nir_opt_large_constants, + glsl_get_natural_size_align_bytes, 16); + ac_lower_indirect_derefs(sel->nir, sel->screen->info.chip_class); si_nir_opts(sel->nir); |