Always add Vulkan descriptor count for immutable samplers to descriptor pool.
This commit is contained in:
@@ -4224,25 +4224,28 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
|
|||||||
vk_writes[writes_amount] = {};
|
vk_writes[writes_amount] = {};
|
||||||
vk_writes[writes_amount].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
vk_writes[writes_amount].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
|
|
||||||
|
bool add_write = true;
|
||||||
uint32_t num_descriptors = 1;
|
uint32_t num_descriptors = 1;
|
||||||
|
|
||||||
switch (uniform.type) {
|
switch (uniform.type) {
|
||||||
case UNIFORM_TYPE_SAMPLER: {
|
case UNIFORM_TYPE_SAMPLER: {
|
||||||
if (uniform.immutable_sampler && immutable_samplers_enabled) {
|
|
||||||
continue; // Skipping immutable samplers.
|
|
||||||
}
|
|
||||||
num_descriptors = uniform.ids.size();
|
num_descriptors = uniform.ids.size();
|
||||||
VkDescriptorImageInfo *vk_img_infos = ALLOCA_ARRAY(VkDescriptorImageInfo, num_descriptors);
|
|
||||||
|
|
||||||
for (uint32_t j = 0; j < num_descriptors; j++) {
|
if (uniform.immutable_sampler && immutable_samplers_enabled) {
|
||||||
vk_img_infos[j] = {};
|
add_write = false;
|
||||||
vk_img_infos[j].sampler = (VkSampler)uniform.ids[j].id;
|
} else {
|
||||||
vk_img_infos[j].imageView = VK_NULL_HANDLE;
|
VkDescriptorImageInfo *vk_img_infos = ALLOCA_ARRAY(VkDescriptorImageInfo, num_descriptors);
|
||||||
vk_img_infos[j].imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
|
||||||
|
for (uint32_t j = 0; j < num_descriptors; j++) {
|
||||||
|
vk_img_infos[j] = {};
|
||||||
|
vk_img_infos[j].sampler = (VkSampler)uniform.ids[j].id;
|
||||||
|
vk_img_infos[j].imageView = VK_NULL_HANDLE;
|
||||||
|
vk_img_infos[j].imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
vk_writes[writes_amount].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||||
|
vk_writes[writes_amount].pImageInfo = vk_img_infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_writes[writes_amount].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
|
|
||||||
vk_writes[writes_amount].pImageInfo = vk_img_infos;
|
|
||||||
} break;
|
} break;
|
||||||
case UNIFORM_TYPE_SAMPLER_WITH_TEXTURE: {
|
case UNIFORM_TYPE_SAMPLER_WITH_TEXTURE: {
|
||||||
num_descriptors = uniform.ids.size() / 2;
|
num_descriptors = uniform.ids.size() / 2;
|
||||||
@@ -4419,13 +4422,14 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_writes[writes_amount].dstBinding = uniform.binding;
|
if (add_write) {
|
||||||
vk_writes[writes_amount].descriptorCount = num_descriptors;
|
vk_writes[writes_amount].dstBinding = uniform.binding;
|
||||||
|
vk_writes[writes_amount].descriptorCount = num_descriptors;
|
||||||
|
writes_amount++;
|
||||||
|
}
|
||||||
|
|
||||||
ERR_FAIL_COND_V_MSG(pool_key.uniform_type[uniform.type] == MAX_UNIFORM_POOL_ELEMENT, UniformSetID(),
|
ERR_FAIL_COND_V_MSG(pool_key.uniform_type[uniform.type] == MAX_UNIFORM_POOL_ELEMENT, UniformSetID(), "Uniform set reached the limit of bindings for the same type (" + itos(MAX_UNIFORM_POOL_ELEMENT) + ").");
|
||||||
"Uniform set reached the limit of bindings for the same type (" + itos(MAX_UNIFORM_POOL_ELEMENT) + ").");
|
|
||||||
pool_key.uniform_type[uniform.type] += num_descriptors;
|
pool_key.uniform_type[uniform.type] += num_descriptors;
|
||||||
writes_amount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool linear_pool = p_linear_pool_index >= 0;
|
bool linear_pool = p_linear_pool_index >= 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user