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 <ashish.chauhan@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38423>
This commit is contained in:
Erik Faye-Lund 2025-11-13 11:12:28 +01:00 committed by Marge Bot
parent afff4be21c
commit da414f102c

View file

@ -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;