radv: Set DB_Z_INFO.NUM_SAMPLES to MSAA_EXPOSED_SAMPLES without Z/S
authorVitaliy Triang3l Kuzmin <triang3l@yandex.ru>
Sun, 2 Apr 2023 18:05:53 +0000 (21:05 +0300)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Apr 2023 15:07:30 +0000 (15:07 +0000)
commita6ab0cff08f58de890b48f09fa1ec0f392834aae
treef66f58a94297f091814e41e352dd641874bb27ef
parent75a7dcf35faab45c5cd09f030f7ac9ef682872d9
radv: Set DB_Z_INFO.NUM_SAMPLES to MSAA_EXPOSED_SAMPLES without Z/S

This case is a new addition in GFX11, and according to PAL, when no
depth/stencil attachment is bound, it must be set to the number of coverage
samples (the number of SampleMask bits - which is MSAA_EXPOSED_SAMPLES):

https://github.com/GPUOpen-Drivers/pal/blob/4640888b579bc9b0951c586b08a4552f71780d0d/src/core/hw/gfxip/gfx9/gfx9UniversalCmdBuffer.cpp#L6978

Without this change, the maximum of depth/stencil and color sample counts
is used, and if there are no depth/stencil or color attachments (target-
independent rasterization), the Depth Block assumes 1 coverage sample, and
thus Primitive Ordered Pixel Shading doesn't work correctly (and fails 4xAA
fragment shader interlock CTS tests), and occlusion queries don't count the
correct number of samples (according to the "Sample Counting" section of
the Vulkan specification, "the occlusion query sample counter increments by
one for each sample with a coverage value of 1...")

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Vitaliy Triang3l Kuzmin <triang3l@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22375>
src/amd/vulkan/radv_cmd_buffer.c