mirror of
https://github.com/godotengine/godot.git
synced 2026-02-07 19:32:36 +00:00
Merge pull request #114657 from DarioSamo/immutable-sampler-descriptor-fix
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].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();
|
||||
VkDescriptorImageInfo *vk_img_infos = ALLOCA_ARRAY(VkDescriptorImageInfo, num_descriptors);
|
||||
|
||||
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;
|
||||
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++) {
|
||||
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;
|
||||
case UNIFORM_TYPE_SAMPLER_WITH_TEXTURE: {
|
||||
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;
|
||||
vk_writes[writes_amount].descriptorCount = num_descriptors;
|
||||
if (add_write) {
|
||||
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(),
|
||||
"Uniform set reached the limit of bindings for the same type (" + itos(MAX_UNIFORM_POOL_ELEMENT) + ").");
|
||||
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++;
|
||||
}
|
||||
|
||||
bool linear_pool = p_linear_pool_index >= 0;
|
||||
|
||||
Reference in New Issue
Block a user