diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 6b63dee5502..aebdef5e694 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -368,6 +368,22 @@ radv_get_ballot_bit_size(struct radv_device *device, gl_shader_stage stage, cons return 64; } +static uint32_t +radv_compute_esgs_itemsize(const struct radv_device *device, uint32_t num_varyings) +{ + uint32_t esgs_itemsize; + + esgs_itemsize = num_varyings * 16; + + /* For the ESGS ring in LDS, add 1 dword to reduce LDS bank + * conflicts, i.e. each vertex will start on a different bank. + */ + if (device->physical_device->rad_info.gfx_level >= GFX9 && esgs_itemsize) + esgs_itemsize += 4; + + return esgs_itemsize; +} + static void gather_info_input_decl_vs(const nir_shader *nir, unsigned location, const struct glsl_type *type, const struct radv_pipeline_key *key, struct radv_shader_info *info) @@ -1501,13 +1517,7 @@ radv_link_shaders_info(struct radv_device *device, struct radv_pipeline_stage *p } /* Compute the ESGS item size for VS or TES as ES. */ - producer->info.esgs_itemsize = num_outputs_written * 16; - - /* For the ESGS ring in LDS, add 1 dword to reduce LDS bank - * conflicts, i.e. each vertex will start on a different bank. - */ - if (device->physical_device->rad_info.gfx_level >= GFX9 && producer->info.esgs_itemsize) - producer->info.esgs_itemsize += 4; + producer->info.esgs_itemsize = radv_compute_esgs_itemsize(device, num_outputs_written); } /* Compute NGG info (GFX10+) or GS info. */