dzn: Don't dirty bindings if root signature doesn't change

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21913>
This commit is contained in:
Jesse Natalie 2023-03-03 08:47:32 -08:00 committed by Marge Bot
parent 5d2b4ee4f4
commit 1846426195
2 changed files with 10 additions and 5 deletions

View file

@ -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);
}
}

View file

@ -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];