diff options
author | Bas Nieuwenhuizen <[email protected]> | 2019-04-07 17:16:50 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2019-04-25 19:56:20 +0000 |
commit | b769a549ee6325e3759a60af19de034e5666ffdb (patch) | |
tree | bf96a855675e18e4bcf5ef8b880f6aa94945d1d5 /src/amd/vulkan | |
parent | 5c3467e74a05787a63cfb1451d41c84b92d41ee9 (diff) |
radv: Add hashing for the ycbcr samplers.
Otherwise caching gets very confused.
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_descriptor_set.c | 11 | ||||
-rw-r--r-- | 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; |