From fa77cc2fbb8de94147ab058a985ebfa627cedabf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 7 Oct 2020 13:59:35 -0400 Subject: [PATCH] zink: add a null sampler view descriptor hash to the screen pre-hashing this saves us time later since we can just reuse it Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/gallium/drivers/zink/zink_screen.c | 8 ++++++++ src/gallium/drivers/zink/zink_screen.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index a15b9a5f2d5..6c8dd8242d7 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1249,6 +1249,13 @@ zink_create_logical_device(struct zink_screen *screen) return dev; } +static void +pre_hash_descriptor_states(struct zink_screen *screen) +{ + VkDescriptorImageInfo null_info = {}; + screen->null_descriptor_hashes.sampler_view = _mesa_hash_data(&null_info, sizeof(VkDescriptorImageInfo)); +} + static struct zink_screen * zink_internal_create_screen(const struct pipe_screen_config *config) { @@ -1319,6 +1326,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config) zink_screen_init_compiler(screen); disk_cache_init(screen); populate_format_props(screen); + pre_hash_descriptor_states(screen); VkPipelineCacheCreateInfo pcci; pcci.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index ef73322db42..c7f95c473e1 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -126,6 +126,9 @@ struct zink_screen { } driconf; VkFormatProperties format_props[PIPE_FORMAT_COUNT]; + struct { + uint32_t sampler_view; + } null_descriptor_hashes; }; static inline struct zink_screen *