From da414f102c59e13d91f28c0f61c4db945c0219f5 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 13 Nov 2025 11:12:28 +0100 Subject: [PATCH] pvr: factor out write_immutable_samplers This is the only part of pvr_descriptor_set_create() that actually depends on architecture specific details (in particular, the write_sampler calls), so let's factor this out to a separate function. This is going to be helpful when we're doing multi-arch support. Reviewed-by: Ashish Chauhan Part-of: --- src/imagination/vulkan/pvr_descriptor_set.c | 29 +++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/imagination/vulkan/pvr_descriptor_set.c b/src/imagination/vulkan/pvr_descriptor_set.c index 08e79cc0211..7d88fc0770f 100644 --- a/src/imagination/vulkan/pvr_descriptor_set.c +++ b/src/imagination/vulkan/pvr_descriptor_set.c @@ -400,6 +400,23 @@ write_sampler(const struct pvr_descriptor_set *set, const struct pvr_descriptor_set_layout_binding *binding, uint32_t elem); +static void +write_immutable_samplers(struct pvr_descriptor_set_layout *layout, + struct pvr_descriptor_set *set) +{ + for (unsigned u = 0; u < layout->binding_count; ++u) { + const struct pvr_descriptor_set_layout_binding *binding = + &layout->bindings[u]; + + if (binding->type == VK_DESCRIPTOR_TYPE_SAMPLER && + binding->immutable_samplers) { + for (uint32_t j = 0; j < binding->descriptor_count; j++) { + write_sampler(set, NULL, binding, j); + } + } + } +} + static VkResult pvr_descriptor_set_create(struct pvr_device *device, struct pvr_descriptor_pool *pool, @@ -437,17 +454,7 @@ pvr_descriptor_set_create(struct pvr_device *device, list_addtail(&set->link, &pool->desc_sets); /* Setup immutable samplers. */ - for (unsigned u = 0; u < layout->binding_count; ++u) { - const struct pvr_descriptor_set_layout_binding *binding = - &layout->bindings[u]; - - if (binding->type == VK_DESCRIPTOR_TYPE_SAMPLER && - binding->immutable_samplers) { - for (uint32_t j = 0; j < binding->descriptor_count; j++) { - write_sampler(set, NULL, binding, j); - } - } - } + write_immutable_samplers(layout, set); *descriptor_set_out = set;