v3dv: handle multisample rasterization with empty framebuffers

Graphics / Mesa 3D Graphics Library / Mesa - Iago Toral Quiroga [igalia.com] - 13 October 2020 21:21 UTC

If the framebuffer has no attachments then multisample rasterization is enabled based on the rasterizationSamples multisample state of the pipelines. It should be noted that since we don't support the variableMultisampleRate feature, all pipelines in the same subpass must have matching number of samples.

V3D requires that we specifically setup our frames to enable multisampling or not, and we do this when we create jobs inside a subpass. Since we create the first job for a subpass as soon as the subpas starts, this is problematic: if we don't have any attachments, we don't won't enable MSAA at this point, but later on we might bind an MSAA pipeline, since pipelines can be bound at any point in the lifespan of a command buffer.

Here, we fix this by testing if the first draw call in a job uses an MSAA pipeline but the job the was setup to not use MSAA, and in that case we re-start the job with MSAA enabled.

We also take care of a corner case that seems to be tested by CTS where a framebuffer with no attachments doesn't bind any pipelines with MSAA enabled (so according to the Vulkan spec, multisample rasterization must be disabled) but the fragment shader in use reads gl_SampleID (which enables per-sample shading). This would lead to enabling per-sample shading with single-sample rasterization, which doesn't make sense and makes the simulator complain, so we just disable per-sample shading in that case.

Fixes: dEQP-VK.pipeline.multisample.mixed_count.*

Part-of:

29ef4ddcf9b v3dv: handle multisample rasterization with empty framebuffers
src/broadcom/vulkan/v3dv_cmd_buffer.c | 108 ++++++++++++++++++++++++++++++----
src/broadcom/vulkan/v3dv_pipeline.c | 26 ++++++--
src/broadcom/vulkan/v3dv_private.h | 1 +
3 files changed, 120 insertions(+), 15 deletions(-)

Upstream: cgit.freedesktop.org


  • Share