radv: Only enter the immutable samplers init loop when we have some.
Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
@@ -67,6 +67,7 @@ VkResult radv_CreateDescriptorSetLayout(
|
|||||||
set_layout->binding_count = max_binding + 1;
|
set_layout->binding_count = max_binding + 1;
|
||||||
set_layout->shader_stages = 0;
|
set_layout->shader_stages = 0;
|
||||||
set_layout->dynamic_shader_stages = 0;
|
set_layout->dynamic_shader_stages = 0;
|
||||||
|
set_layout->has_immutable_samplers = false;
|
||||||
set_layout->size = 0;
|
set_layout->size = 0;
|
||||||
|
|
||||||
memset(set_layout->binding, 0, size - sizeof(struct radv_descriptor_set_layout));
|
memset(set_layout->binding, 0, size - sizeof(struct radv_descriptor_set_layout));
|
||||||
@@ -132,6 +133,7 @@ VkResult radv_CreateDescriptorSetLayout(
|
|||||||
if (binding->pImmutableSamplers) {
|
if (binding->pImmutableSamplers) {
|
||||||
set_layout->binding[b].immutable_samplers_offset = samplers_offset;
|
set_layout->binding[b].immutable_samplers_offset = samplers_offset;
|
||||||
set_layout->binding[b].immutable_samplers_equal = true;
|
set_layout->binding[b].immutable_samplers_equal = true;
|
||||||
|
set_layout->has_immutable_samplers = true;
|
||||||
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < binding->descriptorCount; i++)
|
for (uint32_t i = 0; i < binding->descriptorCount; i++)
|
||||||
@@ -329,6 +331,7 @@ radv_descriptor_set_create(struct radv_device *device,
|
|||||||
return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR);
|
return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout->has_immutable_samplers) {
|
||||||
for (unsigned i = 0; i < layout->binding_count; ++i) {
|
for (unsigned i = 0; i < layout->binding_count; ++i) {
|
||||||
if (!layout->binding[i].immutable_samplers_offset ||
|
if (!layout->binding[i].immutable_samplers_offset ||
|
||||||
layout->binding[i].immutable_samplers_equal)
|
layout->binding[i].immutable_samplers_equal)
|
||||||
@@ -345,6 +348,7 @@ radv_descriptor_set_create(struct radv_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*out_set = set;
|
*out_set = set;
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,8 @@ struct radv_descriptor_set_layout {
|
|||||||
/* Number of dynamic offsets used by this descriptor set */
|
/* Number of dynamic offsets used by this descriptor set */
|
||||||
uint16_t dynamic_offset_count;
|
uint16_t dynamic_offset_count;
|
||||||
|
|
||||||
|
bool has_immutable_samplers;
|
||||||
|
|
||||||
/* Bindings in this descriptor set */
|
/* Bindings in this descriptor set */
|
||||||
struct radv_descriptor_set_binding_layout binding[0];
|
struct radv_descriptor_set_binding_layout binding[0];
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user