mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-19 18:50:43 +02:00
vulkan: Add a new dynamic state for render pass attachments
This is useful for implementing VK_EXT_dynamic_rendering_unused_attachments Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
This commit is contained in:
parent
6ec177b116
commit
5e71e6f3f6
2 changed files with 31 additions and 2 deletions
|
|
@ -133,8 +133,10 @@ get_dynamic_state_groups(BITSET_WORD *dynamic,
|
|||
if (groups & MESA_VK_GRAPHICS_STATE_INPUT_ATTACHMENT_MAP_BIT)
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_INPUT_ATTACHMENT_MAP);
|
||||
|
||||
if (groups & MESA_VK_GRAPHICS_STATE_RENDER_PASS_BIT)
|
||||
if (groups & MESA_VK_GRAPHICS_STATE_RENDER_PASS_BIT) {
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_RP_ATTACHMENTS);
|
||||
BITSET_SET(dynamic, MESA_VK_DYNAMIC_ATTACHMENT_FEEDBACK_LOOP_ENABLE);
|
||||
}
|
||||
}
|
||||
|
||||
static enum mesa_vk_graphics_state_groups
|
||||
|
|
@ -1247,7 +1249,9 @@ static void
|
|||
vk_dynamic_graphics_state_init_rp(struct vk_dynamic_graphics_state *dst,
|
||||
const BITSET_WORD *needed,
|
||||
const struct vk_render_pass_state *rp)
|
||||
{ }
|
||||
{
|
||||
dst->rp.attachments = rp->attachments;
|
||||
}
|
||||
|
||||
#define FOREACH_STATE_GROUP(f) \
|
||||
f(MESA_VK_GRAPHICS_STATE_VERTEX_INPUT_BIT, \
|
||||
|
|
@ -2188,6 +2192,8 @@ vk_dynamic_graphics_state_copy(struct vk_dynamic_graphics_state *dst,
|
|||
if (IS_SET_IN_SRC(CB_BLEND_CONSTANTS))
|
||||
COPY_ARRAY(CB_BLEND_CONSTANTS, cb.blend_constants, 4);
|
||||
|
||||
COPY_IF_SET(RP_ATTACHMENTS, rp.attachments);
|
||||
|
||||
if (IS_SET_IN_SRC(COLOR_ATTACHMENT_MAP)) {
|
||||
COPY_ARRAY(COLOR_ATTACHMENT_MAP, cal.color_map,
|
||||
MESA_VK_MAX_COLOR_ATTACHMENTS);
|
||||
|
|
@ -3010,6 +3016,15 @@ vk_cmd_set_cb_attachment_count(struct vk_command_buffer *cmd,
|
|||
SET_DYN_VALUE(dyn, CB_ATTACHMENT_COUNT, cb.attachment_count, attachment_count);
|
||||
}
|
||||
|
||||
void
|
||||
vk_cmd_set_rp_attachments(struct vk_command_buffer *cmd,
|
||||
enum vk_rp_attachment_flags attachments)
|
||||
{
|
||||
struct vk_dynamic_graphics_state *dyn = &cmd->dynamic_graphics_state;
|
||||
|
||||
SET_DYN_VALUE(dyn, RP_ATTACHMENTS, rp.attachments, attachments);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_CmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer,
|
||||
VkBool32 discardRectangleEnable)
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ enum mesa_vk_dynamic_graphics_state {
|
|||
MESA_VK_DYNAMIC_CB_BLEND_EQUATIONS,
|
||||
MESA_VK_DYNAMIC_CB_WRITE_MASKS,
|
||||
MESA_VK_DYNAMIC_CB_BLEND_CONSTANTS,
|
||||
MESA_VK_DYNAMIC_RP_ATTACHMENTS,
|
||||
MESA_VK_DYNAMIC_ATTACHMENT_FEEDBACK_LOOP_ENABLE,
|
||||
MESA_VK_DYNAMIC_COLOR_ATTACHMENT_MAP,
|
||||
MESA_VK_DYNAMIC_INPUT_ATTACHMENT_MAP,
|
||||
|
|
@ -897,6 +898,10 @@ struct vk_dynamic_graphics_state {
|
|||
/** Color blend state */
|
||||
struct vk_color_blend_state cb;
|
||||
|
||||
struct {
|
||||
enum vk_rp_attachment_flags attachments;
|
||||
} rp;
|
||||
|
||||
/** MESA_VK_DYNAMIC_ATTACHMENT_FEEDBACK_LOOP_ENABLE */
|
||||
VkImageAspectFlags feedback_loops;
|
||||
|
||||
|
|
@ -1237,6 +1242,15 @@ void
|
|||
vk_cmd_set_cb_attachment_count(struct vk_command_buffer *cmd,
|
||||
uint32_t attachment_count);
|
||||
|
||||
/* Set render pass attachments on a command buffer.
|
||||
*
|
||||
* This is required for VK_EXT_shader_object in order to disable attachments
|
||||
* based on bound shaders.
|
||||
*/
|
||||
void
|
||||
vk_cmd_set_rp_attachments(struct vk_command_buffer *cmd,
|
||||
enum vk_rp_attachment_flags attachments);
|
||||
|
||||
const char *
|
||||
vk_dynamic_graphic_state_to_str(enum mesa_vk_dynamic_graphics_state state);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue