From df7be7323a300fe7f146ce07dd3d804849cd628a Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 19 May 2023 19:48:55 +0200 Subject: [PATCH] vk/graphics_state: Don't track each vertex input field It's unlikely that anyone will call vkCmdSetVertexInputEXT() twice with the exact same arguments, so this wasn't really doing anything, and it hurt performance in the common case as shown via "vkoverhead -test 21" on turnip. Reviewed-by: Lionel Landwerlin Reviewed-by: Faith Ekstrand Part-of: --- src/vulkan/runtime/vk_graphics_state.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index 8b749d11e74..04114fe3362 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -2056,15 +2056,15 @@ vk_common_CmdSetVertexInputEXT(VkCommandBuffer commandBuffer, const uint32_t b = desc->binding; bindings_valid |= BITFIELD_BIT(b); - SET_DYN_VALUE(dyn, VI, vi->bindings[b].stride, desc->stride); - SET_DYN_VALUE(dyn, VI, vi->bindings[b].input_rate, desc->inputRate); - SET_DYN_VALUE(dyn, VI, vi->bindings[b].divisor, desc->divisor); + dyn->vi->bindings[b].stride = desc->stride; + dyn->vi->bindings[b].input_rate = desc->inputRate; + dyn->vi->bindings[b].divisor = desc->divisor; /* Also set bindings_strides in case a driver is keying off that */ - SET_DYN_VALUE(dyn, VI_BINDING_STRIDES, - vi_binding_strides[b], desc->stride); + dyn->vi_binding_strides[b] = desc->stride; } - SET_DYN_VALUE(dyn, VI, vi->bindings_valid, bindings_valid); + + dyn->vi->bindings_valid = bindings_valid; SET_DYN_VALUE(dyn, VI_BINDINGS_VALID, vi_bindings_valid, bindings_valid); uint32_t attributes_valid = 0; @@ -2078,11 +2078,16 @@ vk_common_CmdSetVertexInputEXT(VkCommandBuffer commandBuffer, const uint32_t a = desc->location; attributes_valid |= BITFIELD_BIT(a); - SET_DYN_VALUE(dyn, VI, vi->attributes[a].binding, desc->binding); - SET_DYN_VALUE(dyn, VI, vi->attributes[a].format, desc->format); - SET_DYN_VALUE(dyn, VI, vi->attributes[a].offset, desc->offset); + dyn->vi->attributes[a].binding = desc->binding; + dyn->vi->attributes[a].format = desc->format; + dyn->vi->attributes[a].offset = desc->offset; } - SET_DYN_VALUE(dyn, VI, vi->attributes_valid, attributes_valid); + dyn->vi->attributes_valid = attributes_valid; + + BITSET_SET(dyn->set, MESA_VK_DYNAMIC_VI); + BITSET_SET(dyn->set, MESA_VK_DYNAMIC_VI_BINDING_STRIDES); + BITSET_SET(dyn->dirty, MESA_VK_DYNAMIC_VI); + BITSET_SET(dyn->dirty, MESA_VK_DYNAMIC_VI_BINDING_STRIDES); } void