From 0549649bcfbc32cc4a2d2d72baeb6541f7f6584b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 21 Apr 2024 12:20:54 -0400 Subject: [PATCH] vulkan: optimize vk_dynamic_graphics_state_any_dirty For drivers using the new state tracking, __bitset_test_range can be surprisingly hot because we have a lot of dirty bits and __bitset_test_range has to handle lots of special cases. __bitset_is_empty does not have to worry about those special cases so can be much faster. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Lionel Landwerlin Reviewed-by: Konstantin Seurer Reviewed-by: Christian Gmeiner Part-of: --- src/vulkan/runtime/vk_graphics_state.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vulkan/runtime/vk_graphics_state.h b/src/vulkan/runtime/vk_graphics_state.h index 9fa4bf7b638..4e4cd3667ec 100644 --- a/src/vulkan/runtime/vk_graphics_state.h +++ b/src/vulkan/runtime/vk_graphics_state.h @@ -1187,8 +1187,7 @@ vk_dynamic_graphics_state_clear_dirty(struct vk_dynamic_graphics_state *d) static inline bool vk_dynamic_graphics_state_any_dirty(const struct vk_dynamic_graphics_state *d) { - return BITSET_TEST_RANGE(d->dirty, - 0, MESA_VK_DYNAMIC_GRAPHICS_STATE_ENUM_MAX - 1); + return !BITSET_IS_EMPTY(d->dirty); } /** Copies all set state from src to dst