From fa1c9618f970ffd5e1ddf1fc0a4783bbee1d911e Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 25 Jan 2024 15:24:49 -0800 Subject: [PATCH] dzn: Don't set view instancing mask until after the PSO Part-of: --- src/microsoft/vulkan/dzn_cmd_buffer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index cf68511c4c1..ea624201e1a 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -3109,6 +3109,7 @@ dzn_cmd_buffer_update_pipeline(struct dzn_cmd_buffer *cmdbuf, uint32_t bindpoint ID3D12PipelineState *old_pipeline_state = cmdbuf->state.pipeline ? cmdbuf->state.pipeline->state : NULL; + uint32_t view_instance_mask = 0; if (cmdbuf->state.bindpoint[bindpoint].dirty & DZN_CMD_BINDPOINT_DIRTY_PIPELINE) { if (cmdbuf->state.bindpoint[bindpoint].root_sig != pipeline->root.sig) { cmdbuf->state.bindpoint[bindpoint].root_sig = pipeline->root.sig; @@ -3144,9 +3145,9 @@ dzn_cmd_buffer_update_pipeline(struct dzn_cmd_buffer *cmdbuf, uint32_t bindpoint 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); + view_instance_mask = gfx->multiview.view_mask; else - ID3D12GraphicsCommandList1_SetViewInstanceMask(cmdbuf->cmdlist, 1); + view_instance_mask = 1; if (gfx->zsa.dynamic_depth_bias && gfx->use_gs_for_polygon_mode_point) cmdbuf->state.bindpoint[bindpoint].dirty |= DZN_CMD_BINDPOINT_DIRTY_SYSVALS; @@ -3159,6 +3160,11 @@ dzn_cmd_buffer_update_pipeline(struct dzn_cmd_buffer *cmdbuf, uint32_t bindpoint ID3D12GraphicsCommandList1_SetPipelineState(cmdbuf->cmdlist, pipeline->state); cmdbuf->state.pipeline = pipeline; } + + /* Deferring this until after the pipeline has been set due to an NVIDIA driver bug + * when view instancing mask is set with no pipeline bound. */ + if (view_instance_mask) + ID3D12GraphicsCommandList1_SetViewInstanceMask(cmdbuf->cmdlist, view_instance_mask); } static void