From e8a69b782dc3f93664e47704ce19ec08fdccfd0c Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 13 Apr 2020 13:35:33 +0200 Subject: [PATCH] radv: add support for dynamic and scissor count Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 28 ++++++++++++++++++++++++++-- src/amd/vulkan/radv_pipeline.c | 2 ++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 6e188a42185..9723c28f7cc 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -113,7 +113,11 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, dest->sample_location.count = src->sample_location.count; if (copy_mask & RADV_DYNAMIC_VIEWPORT) { - dest->viewport.count = src->viewport.count; + if (dest->viewport.count != src->viewport.count) { + dest->viewport.count = src->viewport.count; + dest_mask |= RADV_DYNAMIC_VIEWPORT; + } + if (memcmp(&dest->viewport.viewports, &src->viewport.viewports, src->viewport.count * sizeof(VkViewport))) { typed_memcpy(dest->viewport.viewports, @@ -124,7 +128,11 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, } if (copy_mask & RADV_DYNAMIC_SCISSOR) { - dest->scissor.count = src->scissor.count; + if (dest->scissor.count != src->scissor.count) { + dest->scissor.count = src->scissor.count; + dest_mask |= RADV_DYNAMIC_SCISSOR; + } + if (memcmp(&dest->scissor.scissors, &src->scissor.scissors, src->scissor.count * sizeof(VkRect2D))) { typed_memcpy(dest->scissor.scissors, @@ -4318,6 +4326,22 @@ void radv_CmdSetPrimitiveTopologyEXT( state->dirty |= RADV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY; } +void radv_CmdSetViewportWithCountEXT( + VkCommandBuffer commandBuffer, + uint32_t viewportCount, + const VkViewport* pViewports) +{ + radv_CmdSetViewport(commandBuffer, 0, viewportCount, pViewports); +} + +void radv_CmdSetScissorWithCountEXT( + VkCommandBuffer commandBuffer, + uint32_t scissorCount, + const VkRect2D* pScissors) +{ + radv_CmdSetScissor(commandBuffer, 0, scissorCount, pScissors); +} + void radv_CmdExecuteCommands( VkCommandBuffer commandBuffer, uint32_t commandBufferCount, diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index edcff4a83ef..00303b0627a 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -1243,8 +1243,10 @@ static unsigned radv_dynamic_state_mask(VkDynamicState state) { switch(state) { case VK_DYNAMIC_STATE_VIEWPORT: + case VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT: return RADV_DYNAMIC_VIEWPORT; case VK_DYNAMIC_STATE_SCISSOR: + case VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT: return RADV_DYNAMIC_SCISSOR; case VK_DYNAMIC_STATE_LINE_WIDTH: return RADV_DYNAMIC_LINE_WIDTH; -- 2.30.2