From 85deb9f706c8cbccd928eaf84f3f550662bf83bd Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 26 Apr 2024 15:29:58 +0200 Subject: [PATCH] radv: simplify DB_Z_INFO.NUM_SAMPLES with null ds target on GFX11 According to PAL, the hw uses the smaller value of DB_Z_INFO.NUM_SAMPLES and PA_SC_AA_CONFIG.MSAA_EXPOSED_SAMPLES when there is no bound depth/stencil buffer, and it uses 8x to make sure the used value is MSAA_EXPOSED_SAMPLES. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index cf51821f71f..426d8c699d1 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -3084,11 +3084,13 @@ radv_emit_null_ds_state(struct radv_cmd_buffer *cmd_buffer) unsigned db_render_control = 0; unsigned num_samples = 0; - /* On GFX11, DB_Z_INFO.NUM_SAMPLES should always match MSAA_EXPOSED_SAMPLES. It affects VRS, - * occlusion queries and Primitive Ordered Pixel Shading if depth and stencil are not bound. + /* On GFX11, the hw intentionally looks at DB_Z_INFO.NUM_SAMPLES when there is no bound + * depth/stencil buffer and it clamps the number of samples like MIN2(DB_Z_INFO.NUM_SAMPLES, + * PA_SC_AA_CONFIG.MSAA_EXPOSED_SAMPLES). Use 8x for DB_Z_INFO.NUM_SAMPLES to make sure it's not + * the constraining factor. This affects VRS, occlusion queries and POPS. */ if (gfx_level == GFX11) { - num_samples = util_logbase2(radv_get_rasterization_samples(cmd_buffer)); + num_samples = 3; radv_gfx11_set_db_render_control(device, 1, &db_render_control); }