From 2a319d0fe90a9312b664c151c715d11f473ead04 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:59 -0600 Subject: [PATCH] nvk/meta: Save/restore descriptor set 0 Part-of: --- src/nouveau/vulkan/nvk_cmd_meta.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/nouveau/vulkan/nvk_cmd_meta.c b/src/nouveau/vulkan/nvk_cmd_meta.c index b48d6bc..de295d0 100644 --- a/src/nouveau/vulkan/nvk_cmd_meta.c +++ b/src/nouveau/vulkan/nvk_cmd_meta.c @@ -49,6 +49,9 @@ struct nvk_meta_save { struct vk_dynamic_graphics_state dynamic; struct nvk_graphics_pipeline *pipeline; struct nvk_addr_range vb0; + struct nvk_descriptor_set *desc0; + bool has_push_desc0; + struct nvk_push_descriptor_set push_desc0; uint8_t push[128]; }; @@ -62,6 +65,11 @@ nvk_meta_begin(struct nvk_cmd_buffer *cmd, save->pipeline = cmd->state.gfx.pipeline; save->vb0 = cmd->state.gfx.vb0; + save->desc0 = cmd->state.gfx.descriptors.sets[0]; + save->has_push_desc0 = cmd->state.gfx.descriptors.push[0]; + if (save->has_push_desc0) + save->push_desc0 = *cmd->state.gfx.descriptors.push[0]; + STATIC_ASSERT(sizeof(save->push) == sizeof(cmd->state.gfx.descriptors.root.push)); memcpy(save->push, cmd->state.gfx.descriptors.root.push, sizeof(save->push)); @@ -88,6 +96,14 @@ static void nvk_meta_end(struct nvk_cmd_buffer *cmd, struct nvk_meta_save *save) { + if (save->desc0) { + cmd->state.gfx.descriptors.sets[0] = save->desc0; + cmd->state.gfx.descriptors.sets_dirty |= BITFIELD_BIT(0); + } else if (save->has_push_desc0) { + *cmd->state.gfx.descriptors.push[0] = save->push_desc0; + cmd->state.gfx.descriptors.push_dirty |= BITFIELD_BIT(0); + } + /* Restore the dynamic state */ assert(save->dynamic.vi == &cmd->state.gfx._dynamic_vi); cmd->vk.dynamic_graphics_state = save->dynamic; -- 2.7.4