From 8d44f838443d8d403ed20f1414916bf59f660901 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 29 Aug 2019 11:16:44 +0200 Subject: [PATCH] radv: move lowering PS inputs/outputs at the right place At shaders creation, just after NIR linking. Signed-off-by: Samuel Pitoiset Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_pipeline.c | 3 +++ src/amd/vulkan/radv_shader.c | 7 ++----- src/amd/vulkan/radv_shader.h | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 52f8cd048c3..0897b2d153e 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -2578,6 +2578,9 @@ void radv_create_shaders(struct radv_pipeline *pipeline, nir_print_shader(nir[i], stderr); } + if (nir[MESA_SHADER_FRAGMENT]) + radv_lower_fs_io(nir[MESA_SHADER_FRAGMENT]); + radv_fill_shader_keys(device, keys, key, nir); if (nir[MESA_SHADER_FRAGMENT]) { diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index a3e9b45a752..82858bc906a 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -520,8 +520,8 @@ lower_view_index(nir_shader *nir) return progress; } -static void -lower_fs_io(nir_shader *nir) +void +radv_lower_fs_io(nir_shader *nir) { NIR_PASS_V(nir, lower_view_index); nir_assign_io_var_locations(&nir->inputs, &nir->num_inputs, @@ -1072,9 +1072,6 @@ shader_variant_compile(struct radv_device *device, struct radv_shader_variant_info variant_info = {0}; bool thread_compiler; - if (shaders[0]->info.stage == MESA_SHADER_FRAGMENT) - lower_fs_io(shaders[0]); - options->family = chip_family; options->chip_class = device->physical_device->rad_info.chip_class; options->dump_shader = radv_can_dump_shader(device, module, gs_copy_shader); diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index b8770b8c999..67c45a0f0bd 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -449,4 +449,7 @@ radv_can_dump_shader_stats(struct radv_device *device, unsigned shader_io_get_unique_index(gl_varying_slot slot); +void +radv_lower_fs_io(nir_shader *nir); + #endif -- 2.30.2