From f4ec8e1ad5290f526e80b66e653ee0f533064b4a Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 15 Sep 2022 16:01:36 +0200 Subject: [PATCH] radv: emit the rasterization samples through an user SGPR if needed When the main FS needs sample positions and the number of samples isn't known at compile time with GPL. Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- src/amd/vulkan/radv_pipeline.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index a1e05186a37..1b7bc7f4ef3 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -5543,6 +5543,13 @@ radv_pipeline_emit_fragment_shader(struct radeon_cmdbuf *ctx_cs, struct radeon_c ctx_cs, R_028710_SPI_SHADER_Z_FORMAT, ac_get_spi_shader_z_format(ps->info.ps.writes_z, ps->info.ps.writes_stencil, ps->info.ps.writes_sample_mask, false)); + + struct radv_userdata_info *loc = + radv_lookup_user_sgpr(&pipeline->base, MESA_SHADER_FRAGMENT, AC_UD_PS_NUM_SAMPLES); + if (loc->sgpr_idx != -1) { + uint32_t base_reg = pipeline->base.user_data_0[MESA_SHADER_FRAGMENT]; + radeon_set_sh_reg(cs, base_reg + loc->sgpr_idx * 4, pipeline->ms.num_samples); + } } static void