radv: add a helper to compute the ESGS itemsize

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>
This commit is contained in:
Samuel Pitoiset 2023-07-21 10:39:39 +02:00 committed by Marge Bot
parent 54ab7b24a2
commit 7c2d38f4d1

View file

@ -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. */