From b769a549ee6325e3759a60af19de034e5666ffdb Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sun, 7 Apr 2019 17:16:50 +0200 Subject: [PATCH] radv: Add hashing for the ycbcr samplers. Otherwise caching gets very confused. Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/radv_descriptor_set.c | 11 ++++------- src/amd/vulkan/radv_descriptor_set.h | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index e1b5992d635..4e9c73c94d0 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -109,12 +109,13 @@ VkResult radv_CreateDescriptorSetLayout( size += ycbcr_sampler_count * sizeof(struct radv_sampler_ycbcr_conversion) + (max_binding + 1) * sizeof(uint32_t); } - set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + set_layout = vk_zalloc2(&device->alloc, pAllocator, size, 8, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (!set_layout) return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY); set_layout->flags = pCreateInfo->flags; + set_layout->layout_size = size; /* We just allocate all the samplers at the end of the struct */ uint32_t *samplers = (uint32_t*)&set_layout->binding[max_binding + 1]; @@ -429,12 +430,8 @@ VkResult radv_CreatePipelineLayout( for (uint32_t b = 0; b < set_layout->binding_count; b++) { dynamic_offset_count += set_layout->binding[b].array_size * set_layout->binding[b].dynamic_offset_count; dynamic_shader_stages |= set_layout->dynamic_shader_stages; - if (set_layout->binding[b].immutable_samplers_offset) - _mesa_sha1_update(&ctx, radv_immutable_samplers(set_layout, set_layout->binding + b), - set_layout->binding[b].array_size * 4 * sizeof(uint32_t)); } - _mesa_sha1_update(&ctx, set_layout->binding, - sizeof(set_layout->binding[0]) * set_layout->binding_count); + _mesa_sha1_update(&ctx, set_layout, set_layout->layout_size); } layout->dynamic_offset_count = dynamic_offset_count; diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h index 55cc1c9c462..5fd19d94482 100644 --- a/src/amd/vulkan/radv_descriptor_set.h +++ b/src/amd/vulkan/radv_descriptor_set.h @@ -58,6 +58,9 @@ struct radv_descriptor_set_layout { /* Total size of the descriptor set with room for all array entries */ uint32_t size; + /* CPU size of this struct + all associated data, for hashing. */ + uint32_t layout_size; + /* Shader stages affected by this descriptor set */ uint16_t shader_stages; uint16_t dynamic_shader_stages; -- 2.30.2