mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 07:30:37 +02:00
tu: Handle case where pipeline writes unused color attachments
With VK_EXT_unused_attachments, we may have a case where the FS writes
to attachments 0 and 1, both have valid formats and are enabled, yet the
renderpass only has 1 color attachment. In this case we would set
RB_PS_MRT_CNTL to 2, but since we never emitted RB_MRT_BUF_INFO[1] and
so on, we would get garbage attachment info from the last render pass
and end up writing to an attachment that doesn't exist.
Fix this by disabling attachments that are unused. We can't move setting
RB_PS_MRT_CNTL to emitting when we emit color RT state, because then we
have the inverse problem of a FS that writes to attachments 0 and 1, a
renderpass that has 2 attachments, but a blend state that only includes
1 attachment (and therefore disables color writes for attachment 1). At
least one side (blending or RT emission) has to assume that the other
side may have more RTs enabled and disable the rest of the RTs up to
MAX_RTS.
Fixes: c2eb768eb2 ("tu: Expose VK_EXT_dynamic_rendering_unused_attachments")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38250>
This commit is contained in:
parent
47d86e5f66
commit
6064e3a7d8
1 changed files with 5 additions and 1 deletions
|
|
@ -687,7 +687,7 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
|
|||
}
|
||||
|
||||
u_foreach_bit (i, ~written) {
|
||||
if (i >= subpass->color_count)
|
||||
if (i >= MAX_RTS)
|
||||
break;
|
||||
|
||||
/* From the VkPipelineRenderingCreateInfo definition:
|
||||
|
|
@ -701,6 +701,10 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
|
|||
* here should prevent them from writing to anything. This also seems
|
||||
* to also be required for alpha-to-coverage which can use the alpha
|
||||
* value for an otherwise-unused attachment.
|
||||
*
|
||||
* With VK_EXT_dynamic_rendering_unused_attachments, pipelines may also
|
||||
* write to attachments beyond those that exist in the render pass, so
|
||||
* we have all attachments not written up to MAX_RTS.
|
||||
*/
|
||||
tu_cs_emit_regs(cs,
|
||||
RB_MRT_BUF_INFO(CHIP, i),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue