Always add Vulkan descriptor count for immutable samplers to descriptor pool.
This commit is contained in:
@@ -4224,14 +4224,16 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
|
||||
vk_writes[writes_amount] = {};
|
||||
vk_writes[writes_amount].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
|
||||
bool add_write = true;
|
||||
uint32_t num_descriptors = 1;
|
||||
|
||||
switch (uniform.type) {
|
||||
case UNIFORM_TYPE_SAMPLER: {
|
||||
if (uniform.immutable_sampler && immutable_samplers_enabled) {
|
||||
continue; // Skipping immutable samplers.
|
||||
}
|
||||
num_descriptors = uniform.ids.size();
|
||||
|
||||
if (uniform.immutable_sampler && immutable_samplers_enabled) {
|
||||
add_write = false;
|
||||
} else {
|
||||
VkDescriptorImageInfo *vk_img_infos = ALLOCA_ARRAY(VkDescriptorImageInfo, num_descriptors);
|
||||
|
||||
for (uint32_t j = 0; j < num_descriptors; j++) {
|
||||
@@ -4243,6 +4245,7 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
|
||||
|
||||
vk_writes[writes_amount].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
vk_writes[writes_amount].pImageInfo = vk_img_infos;
|
||||
}
|
||||
} break;
|
||||
case UNIFORM_TYPE_SAMPLER_WITH_TEXTURE: {
|
||||
num_descriptors = uniform.ids.size() / 2;
|
||||
@@ -4419,15 +4422,16 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
|
||||
}
|
||||
}
|
||||
|
||||
if (add_write) {
|
||||
vk_writes[writes_amount].dstBinding = uniform.binding;
|
||||
vk_writes[writes_amount].descriptorCount = num_descriptors;
|
||||
|
||||
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) + ").");
|
||||
pool_key.uniform_type[uniform.type] += num_descriptors;
|
||||
writes_amount++;
|
||||
}
|
||||
|
||||
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) + ").");
|
||||
pool_key.uniform_type[uniform.type] += num_descriptors;
|
||||
}
|
||||
|
||||
bool linear_pool = p_linear_pool_index >= 0;
|
||||
DescriptorSetPools::Iterator pool_sets_it = linear_pool ? linear_descriptor_set_pools[p_linear_pool_index].find(pool_key) : descriptor_set_pools.find(pool_key);
|
||||
if (!pool_sets_it) {
|
||||
|
||||
Reference in New Issue
Block a user