summaryrefslogtreecommitdiff
path: root/src/freedreno
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2020-03-24 18:00:21 +0100
committerMarge Bot <eric+marge@anholt.net>2020-04-09 15:56:55 +0000
commite1595026f675d5dee721d7fcd7f4c856a357ba96 (patch)
tree5bdd4e66b44c0a7ebb9a3480040c312da34aa6af /src/freedreno
parenta07b55443b59572d022924b65c2ab67cd91250e4 (diff)
tu: Add missing code for immutable samplers
Actually fill out the samplers, based on the radv implementation. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4358>
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/vulkan/tu_descriptor_set.c20
1 files changed, 20 insertions, 0 deletions
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;
}