mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 19:30:11 +01:00
vk/graphic_state, tu: Use dynamic blend count from subpass
A future spec clarification will state that pipelines will not have to fill out the blend attachment count if every blend state is dynamic. Instead, this comes from the subpass/rendering/inheritance info. To fix this while still being able to use the same code to emit dynamic and precompiled state, we have to set the attachment count in the blend struct at the beginning of the subpass. This will also help with ESO where it already worked like this. Closes: #9709 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24957>
This commit is contained in:
parent
8bc0f6be67
commit
ceb1d81763
3 changed files with 31 additions and 0 deletions
|
|
@ -2015,6 +2015,8 @@ tu_BeginCommandBuffer(VkCommandBuffer commandBuffer,
|
|||
tu_fill_render_pass_state(&cmd_buffer->state.vk_rp,
|
||||
cmd_buffer->state.pass,
|
||||
cmd_buffer->state.subpass);
|
||||
vk_cmd_set_cb_attachment_count(&cmd_buffer->vk,
|
||||
cmd_buffer->state.subpass->color_count);
|
||||
cmd_buffer->state.dirty |= TU_CMD_DIRTY_SUBPASS;
|
||||
|
||||
cmd_buffer->patchpoints_ctx = ralloc_parent(NULL);
|
||||
|
|
@ -3649,6 +3651,8 @@ tu_emit_subpass_begin(struct tu_cmd_buffer *cmd)
|
|||
|
||||
tu_set_input_attachments(cmd, cmd->state.subpass);
|
||||
|
||||
vk_cmd_set_cb_attachment_count(&cmd->vk, cmd->state.subpass->color_count);
|
||||
|
||||
cmd->state.dirty |= TU_CMD_DIRTY_SUBPASS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -275,6 +275,15 @@ vk_get_dynamic_graphics_states(BITSET_WORD *dynamic,
|
|||
unreachable("Unsupported dynamic graphics state");
|
||||
}
|
||||
}
|
||||
|
||||
/* attachmentCount is ignored if all of the states using it are dyanmic.
|
||||
*
|
||||
* TODO: Handle advanced blending here when supported.
|
||||
*/
|
||||
if (BITSET_TEST(dynamic, MESA_VK_DYNAMIC_CB_BLEND_ENABLES) &&
|
||||
BITSET_TEST(dynamic, MESA_VK_DYNAMIC_CB_BLEND_EQUATIONS) &&
|
||||
BITSET_TEST(dynamic, MESA_VK_DYNAMIC_CB_WRITE_MASKS))
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_CB_ATTACHMENT_COUNT);
|
||||
}
|
||||
|
||||
#define IS_DYNAMIC(STATE) \
|
||||
|
|
@ -2806,6 +2815,15 @@ vk_common_CmdSetColorBlendAdvancedEXT(VkCommandBuffer commandBuffer,
|
|||
unreachable("VK_EXT_blend_operation_advanced unsupported");
|
||||
}
|
||||
|
||||
void
|
||||
vk_cmd_set_cb_attachment_count(struct vk_command_buffer *cmd,
|
||||
uint32_t attachment_count)
|
||||
{
|
||||
struct vk_dynamic_graphics_state *dyn = &cmd->dynamic_graphics_state;
|
||||
|
||||
SET_DYN_VALUE(dyn, CB_ATTACHMENT_COUNT, cb.attachment_count, attachment_count);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_CmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer,
|
||||
VkBool32 discardRectangleEnable)
|
||||
|
|
|
|||
|
|
@ -1110,6 +1110,15 @@ vk_cmd_set_vertex_binding_strides(struct vk_command_buffer *cmd,
|
|||
uint32_t binding_count,
|
||||
const VkDeviceSize *strides);
|
||||
|
||||
/* Set color attachment count for blending on a command buffer.
|
||||
*
|
||||
* This is an implicit part of starting a subpass or a secondary command
|
||||
* buffer in a subpass.
|
||||
*/
|
||||
void
|
||||
vk_cmd_set_cb_attachment_count(struct vk_command_buffer *cmd,
|
||||
uint32_t attachment_count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue