From: Connor Abbott Date: Tue, 24 Mar 2020 17:00:21 +0000 (+0100) Subject: tu: Add missing code for immutable samplers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1595026f675d5dee721d7fcd7f4c856a357ba96;p=mesa.git tu: Add missing code for immutable samplers Actually fill out the samplers, based on the radv implementation. Part-of: --- diff --git a/src/freedreno/vulkan/tu_descriptor_set.c b/src/freedreno/vulkan/tu_descriptor_set.c index f6327b85c50..d693ac45c30 100644 --- a/src/freedreno/vulkan/tu_descriptor_set.c +++ b/src/freedreno/vulkan/tu_descriptor_set.c @@ -489,6 +489,26 @@ tu_descriptor_set_create(struct tu_device *device, return vk_error(device->instance, VK_ERROR_OUT_OF_POOL_MEMORY); } + if (layout->has_immutable_samplers) { + for (unsigned i = 0; i < layout->binding_count; ++i) { + if (!layout->binding[i].immutable_samplers_offset) + continue; + + unsigned offset = layout->binding[i].offset / 4; + if (layout->binding[i].type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) + offset += A6XX_TEX_CONST_DWORDS; + + const struct tu_sampler *samplers = + (const struct tu_sampler *)((const char *)layout + + layout->binding[i].immutable_samplers_offset); + for (unsigned j = 0; j < layout->binding[i].array_size; ++j) { + memcpy(set->mapped_ptr + offset, samplers + j, + sizeof(struct tu_sampler)); + offset += layout->binding[i].size / 4; + } + } + } + *out_set = set; return VK_SUCCESS; }