diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-02-27 09:29:26 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-02-28 20:46:02 +0100 |
commit | dd2a0c7aef0887554a36134fc2fa762afa90287b (patch) | |
tree | c754d06f8435e0b749948025d14cfade9c91ad0e /src | |
parent | 884f65e1856733697a894c86f94803343cfa9a21 (diff) |
radv: Store the immutable samplers as uint32_t[4].
So we don't need to know about radv_sampler in ac_nir_to_llvm.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/vulkan/radv_descriptor_set.c | 14 | ||||
-rw-r--r-- | src/amd/vulkan/radv_descriptor_set.h | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index e2bd9b92d90..b24ff91d3ed 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -52,7 +52,7 @@ VkResult radv_CreateDescriptorSetLayout( size_t size = sizeof(struct radv_descriptor_set_layout) + (max_binding + 1) * sizeof(set_layout->binding[0]) + - immutable_sampler_count * sizeof(struct radv_sampler *); + immutable_sampler_count * 4 * sizeof(uint32_t); set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); @@ -60,8 +60,7 @@ VkResult radv_CreateDescriptorSetLayout( return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); /* We just allocate all the samplers at the end of the struct */ - struct radv_sampler **samplers = - (struct radv_sampler **)&set_layout->binding[max_binding + 1]; + uint32_t *samplers = (uint32_t*)&set_layout->binding[max_binding + 1]; set_layout->binding_count = max_binding + 1; set_layout->shader_stages = 0; @@ -133,11 +132,10 @@ VkResult radv_CreateDescriptorSetLayout( if (binding->pImmutableSamplers) { set_layout->binding[b].immutable_samplers = samplers; - samplers += binding->descriptorCount; + samplers += 4 * binding->descriptorCount; for (uint32_t i = 0; i < binding->descriptorCount; i++) - set_layout->binding[b].immutable_samplers[i] = - radv_sampler_from_handle(binding->pImmutableSamplers[i]); + memcpy(set_layout->binding[b].immutable_samplers + 4 * i, &radv_sampler_from_handle(binding->pImmutableSamplers[i])->state, 16); } else { set_layout->binding[b].immutable_samplers = NULL; } @@ -331,9 +329,7 @@ radv_descriptor_set_create(struct radv_device *device, offset += 16; for (unsigned j = 0; j < layout->binding[i].array_size; ++j) { - struct radv_sampler* sampler = layout->binding[i].immutable_samplers[j]; - - memcpy(set->mapped_ptr + offset, &sampler->state, 16); + memcpy(set->mapped_ptr + offset, layout->binding[i].immutable_samplers + 4 * j, 16); offset += layout->binding[i].size / 4; } diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h index 0674822759b..8849d053121 100644 --- a/src/amd/vulkan/radv_descriptor_set.h +++ b/src/amd/vulkan/radv_descriptor_set.h @@ -44,7 +44,7 @@ struct radv_descriptor_set_binding_layout { uint16_t dynamic_offset_count; /* Immutable samplers (or NULL if no immutable samplers) */ - struct radv_sampler **immutable_samplers; + uint32_t *immutable_samplers; }; struct radv_descriptor_set_layout { |