mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-12-24 14:33:12 +00:00
pipeline_helper: Simplify descriptor objects initialization
This commit is contained in:
parent
415c7e46ed
commit
a33014022e
1 changed files with 25 additions and 33 deletions
|
@ -85,42 +85,34 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Add(const Shader::Info& info, VkShaderStageFlags stage) {
|
void Add(const Shader::Info& info, VkShaderStageFlags stage) {
|
||||||
for ([[maybe_unused]] const auto& desc : info.constant_buffer_descriptors) {
|
Add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, stage, info.constant_buffer_descriptors.size());
|
||||||
Add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, stage);
|
Add(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, stage, info.storage_buffers_descriptors.size());
|
||||||
}
|
Add(VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, stage, info.texture_buffer_descriptors.size());
|
||||||
for ([[maybe_unused]] const auto& desc : info.storage_buffers_descriptors) {
|
Add(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, stage, info.texture_descriptors.size());
|
||||||
Add(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, stage);
|
Add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, stage, info.image_descriptors.size());
|
||||||
}
|
|
||||||
for ([[maybe_unused]] const auto& desc : info.texture_buffer_descriptors) {
|
|
||||||
Add(VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, stage);
|
|
||||||
}
|
|
||||||
for ([[maybe_unused]] const auto& desc : info.texture_descriptors) {
|
|
||||||
Add(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, stage);
|
|
||||||
}
|
|
||||||
for ([[maybe_unused]] const auto& desc : info.image_descriptors) {
|
|
||||||
Add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, stage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Add(VkDescriptorType type, VkShaderStageFlags stage) {
|
void Add(VkDescriptorType type, VkShaderStageFlags stage, size_t num) {
|
||||||
bindings.push_back({
|
for (size_t i = 0; i < num; ++i) {
|
||||||
.binding = binding,
|
bindings.push_back({
|
||||||
.descriptorType = type,
|
.binding = binding,
|
||||||
.descriptorCount = 1,
|
.descriptorType = type,
|
||||||
.stageFlags = stage,
|
.descriptorCount = 1,
|
||||||
.pImmutableSamplers = nullptr,
|
.stageFlags = stage,
|
||||||
});
|
.pImmutableSamplers = nullptr,
|
||||||
entries.push_back(VkDescriptorUpdateTemplateEntryKHR{
|
});
|
||||||
.dstBinding = binding,
|
entries.push_back({
|
||||||
.dstArrayElement = 0,
|
.dstBinding = binding,
|
||||||
.descriptorCount = 1,
|
.dstArrayElement = 0,
|
||||||
.descriptorType = type,
|
.descriptorCount = 1,
|
||||||
.offset = offset,
|
.descriptorType = type,
|
||||||
.stride = sizeof(DescriptorUpdateEntry),
|
.offset = offset,
|
||||||
});
|
.stride = sizeof(DescriptorUpdateEntry),
|
||||||
++binding;
|
});
|
||||||
offset += sizeof(DescriptorUpdateEntry);
|
++binding;
|
||||||
|
offset += sizeof(DescriptorUpdateEntry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const vk::Device* device{};
|
const vk::Device* device{};
|
||||||
|
|
Loading…
Reference in a new issue