vk_pipeline_cache: Make use of designated initializers where applicable
This commit is contained in:
parent
7d5f93832c
commit
d43e923990
@ -88,12 +88,13 @@ void AddBindings(std::vector<VkDescriptorSetLayoutBinding>& bindings, u32& bindi
|
|||||||
// Combined image samplers can be arrayed.
|
// Combined image samplers can be arrayed.
|
||||||
count = container[i].size;
|
count = container[i].size;
|
||||||
}
|
}
|
||||||
VkDescriptorSetLayoutBinding& entry = bindings.emplace_back();
|
bindings.push_back({
|
||||||
entry.binding = binding++;
|
.binding = binding++,
|
||||||
entry.descriptorType = descriptor_type;
|
.descriptorType = descriptor_type,
|
||||||
entry.descriptorCount = count;
|
.descriptorCount = count,
|
||||||
entry.stageFlags = stage_flags;
|
.stageFlags = stage_flags,
|
||||||
entry.pImmutableSamplers = nullptr;
|
.pImmutableSamplers = nullptr,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,10 +260,10 @@ VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCach
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Specialization specialization;
|
const Specialization specialization{
|
||||||
specialization.workgroup_size = key.workgroup_size;
|
.workgroup_size = key.workgroup_size,
|
||||||
specialization.shared_memory_size = key.shared_memory_size;
|
.shared_memory_size = key.shared_memory_size,
|
||||||
|
};
|
||||||
const SPIRVShader spirv_shader{Decompile(device, shader->GetIR(), ShaderType::Compute,
|
const SPIRVShader spirv_shader{Decompile(device, shader->GetIR(), ShaderType::Compute,
|
||||||
shader->GetRegistry(), specialization),
|
shader->GetRegistry(), specialization),
|
||||||
shader->GetEntries()};
|
shader->GetEntries()};
|
||||||
@ -370,13 +371,14 @@ void AddEntry(std::vector<VkDescriptorUpdateTemplateEntry>& template_entries, u3
|
|||||||
if constexpr (descriptor_type == COMBINED_IMAGE_SAMPLER) {
|
if constexpr (descriptor_type == COMBINED_IMAGE_SAMPLER) {
|
||||||
for (u32 i = 0; i < count; ++i) {
|
for (u32 i = 0; i < count; ++i) {
|
||||||
const u32 num_samplers = container[i].size;
|
const u32 num_samplers = container[i].size;
|
||||||
VkDescriptorUpdateTemplateEntry& entry = template_entries.emplace_back();
|
template_entries.push_back({
|
||||||
entry.dstBinding = binding;
|
.dstBinding = binding,
|
||||||
entry.dstArrayElement = 0;
|
.dstArrayElement = 0,
|
||||||
entry.descriptorCount = num_samplers;
|
.descriptorCount = num_samplers,
|
||||||
entry.descriptorType = descriptor_type;
|
.descriptorType = descriptor_type,
|
||||||
entry.offset = offset;
|
.offset = offset,
|
||||||
entry.stride = entry_size;
|
.stride = entry_size,
|
||||||
|
});
|
||||||
|
|
||||||
++binding;
|
++binding;
|
||||||
offset += num_samplers * entry_size;
|
offset += num_samplers * entry_size;
|
||||||
@ -389,22 +391,24 @@ void AddEntry(std::vector<VkDescriptorUpdateTemplateEntry>& template_entries, u3
|
|||||||
// Nvidia has a bug where updating multiple texels at once causes the driver to crash.
|
// Nvidia has a bug where updating multiple texels at once causes the driver to crash.
|
||||||
// Note: Fixed in driver Windows 443.24, Linux 440.66.15
|
// Note: Fixed in driver Windows 443.24, Linux 440.66.15
|
||||||
for (u32 i = 0; i < count; ++i) {
|
for (u32 i = 0; i < count; ++i) {
|
||||||
VkDescriptorUpdateTemplateEntry& entry = template_entries.emplace_back();
|
template_entries.push_back({
|
||||||
entry.dstBinding = binding + i;
|
.dstBinding = binding + i,
|
||||||
entry.dstArrayElement = 0;
|
.dstArrayElement = 0,
|
||||||
entry.descriptorCount = 1;
|
.descriptorCount = 1,
|
||||||
entry.descriptorType = descriptor_type;
|
.descriptorType = descriptor_type,
|
||||||
entry.offset = static_cast<std::size_t>(offset + i * entry_size);
|
.offset = static_cast<std::size_t>(offset + i * entry_size),
|
||||||
entry.stride = entry_size;
|
.stride = entry_size,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (count > 0) {
|
} else if (count > 0) {
|
||||||
VkDescriptorUpdateTemplateEntry& entry = template_entries.emplace_back();
|
template_entries.push_back({
|
||||||
entry.dstBinding = binding;
|
.dstBinding = binding,
|
||||||
entry.dstArrayElement = 0;
|
.dstArrayElement = 0,
|
||||||
entry.descriptorCount = count;
|
.descriptorCount = count,
|
||||||
entry.descriptorType = descriptor_type;
|
.descriptorType = descriptor_type,
|
||||||
entry.offset = offset;
|
.offset = offset,
|
||||||
entry.stride = entry_size;
|
.stride = entry_size,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
offset += count * entry_size;
|
offset += count * entry_size;
|
||||||
binding += count;
|
binding += count;
|
||||||
|
Loading…
Reference in New Issue
Block a user