From 184642619564127b9c4e4e5e5b87ba3f3bb5145d Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Fri, 3 Mar 2023 08:47:32 -0800 Subject: [PATCH] dzn: Don't dirty bindings if root signature doesn't change Part-of: --- src/microsoft/vulkan/dzn_cmd_buffer.c | 14 +++++++++----- src/microsoft/vulkan/dzn_private.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index a5a82bbc..28cf783 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -3016,20 +3016,24 @@ dzn_cmd_buffer_update_pipeline(struct dzn_cmd_buffer *cmdbuf, uint32_t bindpoint cmdbuf->state.pipeline ? cmdbuf->state.pipeline->state : NULL; if (cmdbuf->state.bindpoint[bindpoint].dirty & DZN_CMD_BINDPOINT_DIRTY_PIPELINE) { - /* Changing root signature always requires re-binding descriptor heaps */ - cmdbuf->state.bindpoint[bindpoint].dirty |= DZN_CMD_BINDPOINT_DIRTY_HEAPS; + if (cmdbuf->state.bindpoint[bindpoint].root_sig != pipeline->root.sig) { + cmdbuf->state.bindpoint[bindpoint].root_sig = pipeline->root.sig; + /* Changing root signature always requires re-binding descriptor heaps */ + cmdbuf->state.bindpoint[bindpoint].dirty |= DZN_CMD_BINDPOINT_DIRTY_HEAPS; + if (bindpoint == VK_PIPELINE_BIND_POINT_GRAPHICS) + ID3D12GraphicsCommandList1_SetGraphicsRootSignature(cmdbuf->cmdlist, pipeline->root.sig); + else + ID3D12GraphicsCommandList1_SetComputeRootSignature(cmdbuf->cmdlist, pipeline->root.sig); + } if (bindpoint == VK_PIPELINE_BIND_POINT_GRAPHICS) { struct dzn_graphics_pipeline *gfx = (struct dzn_graphics_pipeline *)pipeline; - ID3D12GraphicsCommandList1_SetGraphicsRootSignature(cmdbuf->cmdlist, pipeline->root.sig); ID3D12GraphicsCommandList1_IASetPrimitiveTopology(cmdbuf->cmdlist, gfx->ia.topology); dzn_graphics_pipeline_get_state(gfx, &cmdbuf->state.pipeline_variant); if (gfx->multiview.native_view_instancing) ID3D12GraphicsCommandList1_SetViewInstanceMask(cmdbuf->cmdlist, gfx->multiview.view_mask); else ID3D12GraphicsCommandList1_SetViewInstanceMask(cmdbuf->cmdlist, 1); - } else { - ID3D12GraphicsCommandList1_SetComputeRootSignature(cmdbuf->cmdlist, pipeline->root.sig); } } diff --git a/src/microsoft/vulkan/dzn_private.h b/src/microsoft/vulkan/dzn_private.h index ea4324a..7d300c3 100644 --- a/src/microsoft/vulkan/dzn_private.h +++ b/src/microsoft/vulkan/dzn_private.h @@ -597,6 +597,7 @@ struct dzn_cmd_buffer_state { uint32_t dirty; struct { struct dzn_pipeline *pipeline; + ID3D12RootSignature *root_sig; struct dzn_descriptor_state desc_state; uint32_t dirty; } bindpoint[NUM_BIND_POINT]; -- 2.7.4