From e856386764172e65e99d2c22d8f2f0160c77a0fe Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 15 Sep 2021 09:03:26 +0200 Subject: [PATCH] panvk: Fix the static scissor/viewport case Even if we can build a static viewport descriptor, we will need the static scissor/viewport data to fill the viewport sysvals. Signed-off-by: Boris Brezillon Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/vulkan/panvk_cmd_buffer.c | 5 +++++ src/panfrost/vulkan/panvk_vX_pipeline.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/panfrost/vulkan/panvk_cmd_buffer.c b/src/panfrost/vulkan/panvk_cmd_buffer.c index af0fcf3..3b427a2 100644 --- a/src/panfrost/vulkan/panvk_cmd_buffer.c +++ b/src/panfrost/vulkan/panvk_cmd_buffer.c @@ -141,6 +141,11 @@ panvk_CmdBindPipeline(VkCommandBuffer commandBuffer, memset(cmdbuf->descriptors[pipelineBindPoint].sysvals, 0, sizeof(cmdbuf->descriptors[pipelineBindPoint].sysvals)); + if (!(pipeline->dynamic_state_mask & BITFIELD_BIT(VK_DYNAMIC_STATE_VIEWPORT))) + cmdbuf->state.viewport = pipeline->viewport; + if (!(pipeline->dynamic_state_mask & BITFIELD_BIT(VK_DYNAMIC_STATE_SCISSOR))) + cmdbuf->state.scissor = pipeline->scissor; + /* Sysvals are passed through UBOs, we need dirty the UBO array if the * pipeline contain shaders using sysvals. */ diff --git a/src/panfrost/vulkan/panvk_vX_pipeline.c b/src/panfrost/vulkan/panvk_vX_pipeline.c index dfa11e0..a60fc23 100644 --- a/src/panfrost/vulkan/panvk_vX_pipeline.c +++ b/src/panfrost/vulkan/panvk_vX_pipeline.c @@ -376,13 +376,12 @@ panvk_pipeline_builder_parse_viewport(struct panvk_pipeline_builder *builder, vpd); pipeline->vpd = pipeline->state_bo->ptr.gpu + builder->vpd_offset; - } else { - if (builder->create_info->pViewportState->pViewports) - pipeline->viewport = builder->create_info->pViewportState->pViewports[0]; - - if (builder->create_info->pViewportState->pScissors) - pipeline->scissor = builder->create_info->pViewportState->pScissors[0]; } + if (panvk_pipeline_static_state(pipeline, VK_DYNAMIC_STATE_VIEWPORT)) + pipeline->viewport = builder->create_info->pViewportState->pViewports[0]; + + if (panvk_pipeline_static_state(pipeline, VK_DYNAMIC_STATE_SCISSOR)) + pipeline->scissor = builder->create_info->pViewportState->pScissors[0]; } static void -- 2.7.4