diff --git a/src/imagination/vulkan/pvr_descriptor_set.c b/src/imagination/vulkan/pvr_descriptor_set.c index 85756637d99..892dec1393a 100644 --- a/src/imagination/vulkan/pvr_descriptor_set.c +++ b/src/imagination/vulkan/pvr_descriptor_set.c @@ -201,7 +201,7 @@ pvr_descriptor_set_layout_allocate(struct pvr_device *device, struct pvr_descriptor_set_layout_binding *bindings; struct pvr_descriptor_set_layout *layout; __typeof__(layout->per_stage_descriptor_count) counts; - struct pvr_sampler **immutable_samplers; + const struct pvr_sampler **immutable_samplers; VK_MULTIALLOC(ma); vk_multialloc_add(&ma, &layout, __typeof__(*layout), 1); @@ -531,6 +531,7 @@ VkResult pvr_CreateDescriptorSetLayout( case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: case VK_DESCRIPTOR_TYPE_SAMPLER: if (binding->pImmutableSamplers && binding->descriptorCount > 0) { + internal_binding->has_immutable_samplers = true; internal_binding->immutable_samplers_index = layout->immutable_sampler_count; @@ -1186,9 +1187,7 @@ pvr_descriptor_set_create(struct pvr_device *device, const struct pvr_descriptor_set_layout_binding *binding = &layout->bindings[i]; - if (binding->descriptor_count == 0 || - (binding->type != VK_DESCRIPTOR_TYPE_SAMPLER && - binding->type != VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) + if (binding->descriptor_count == 0 || !binding->has_immutable_samplers) continue; for (uint32_t stage = 0; @@ -1199,7 +1198,7 @@ pvr_descriptor_set_create(struct pvr_device *device, for (uint32_t j = 0; j < binding->descriptor_count; j++) { uint32_t idx = binding->immutable_samplers_index + j; - struct pvr_sampler *sampler = layout->immutable_samplers[idx]; + const struct pvr_sampler *sampler = layout->immutable_samplers[idx]; unsigned int offset_in_dwords = pvr_get_descriptor_primary_offset(device, layout, diff --git a/src/imagination/vulkan/pvr_private.h b/src/imagination/vulkan/pvr_private.h index a0ed4d17df6..2eaf159f2f5 100644 --- a/src/imagination/vulkan/pvr_private.h +++ b/src/imagination/vulkan/pvr_private.h @@ -396,9 +396,9 @@ struct pvr_descriptor_set_layout_binding { uint32_t secondary; } per_stage_offset_in_dwords[PVR_STAGE_ALLOCATION_COUNT]; + bool has_immutable_samplers; /* Index at which the samplers can be found in the descriptor_set_layout. * 0 when the samplers are at index 0 or no samplers are present. - * Check descriptor_count to differentiate. It will be 0 for 0 samplers. */ uint32_t immutable_samplers_index; }; @@ -428,7 +428,7 @@ struct pvr_descriptor_set_layout { struct pvr_descriptor_set_layout_binding *bindings; uint32_t immutable_sampler_count; - struct pvr_sampler **immutable_samplers; + const struct pvr_sampler **immutable_samplers; /* Shader stages requiring access to descriptors in this set. */ VkShaderStageFlags shader_stages;