diff options
| author | 2020-07-16 18:32:29 -0400 | |
|---|---|---|
| committer | 2020-07-16 18:32:29 -0400 | |
| commit | d43e9239909710482cbb6b7d651f5695ff2c9529 (patch) | |
| tree | c9e6b1472a426d8f715e06c06f6750fdda6ead7c /src | |
| parent | vk_memory_manager: Make use of designated initializers where applicable (diff) | |
| download | yuzu-d43e9239909710482cbb6b7d651f5695ff2c9529.tar.gz yuzu-d43e9239909710482cbb6b7d651f5695ff2c9529.tar.xz yuzu-d43e9239909710482cbb6b7d651f5695ff2c9529.zip | |
vk_pipeline_cache: Make use of designated initializers where applicable
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 3da835324..42b3a744c 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -88,12 +88,13 @@ void AddBindings(std::vector<VkDescriptorSetLayoutBinding>& bindings, u32& bindi | |||
| 88 | // Combined image samplers can be arrayed. | 88 | // Combined image samplers can be arrayed. |
| 89 | count = container[i].size; | 89 | count = container[i].size; |
| 90 | } | 90 | } |
| 91 | VkDescriptorSetLayoutBinding& entry = bindings.emplace_back(); | 91 | bindings.push_back({ |
| 92 | entry.binding = binding++; | 92 | .binding = binding++, |
| 93 | entry.descriptorType = descriptor_type; | 93 | .descriptorType = descriptor_type, |
| 94 | entry.descriptorCount = count; | 94 | .descriptorCount = count, |
| 95 | entry.stageFlags = stage_flags; | 95 | .stageFlags = stage_flags, |
| 96 | entry.pImmutableSamplers = nullptr; | 96 | .pImmutableSamplers = nullptr, |
| 97 | }); | ||
| 97 | } | 98 | } |
| 98 | } | 99 | } |
| 99 | 100 | ||
| @@ -259,10 +260,10 @@ VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCach | |||
| 259 | } | 260 | } |
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | Specialization specialization; | 263 | const Specialization specialization{ |
| 263 | specialization.workgroup_size = key.workgroup_size; | 264 | .workgroup_size = key.workgroup_size, |
| 264 | specialization.shared_memory_size = key.shared_memory_size; | 265 | .shared_memory_size = key.shared_memory_size, |
| 265 | 266 | }; | |
| 266 | const SPIRVShader spirv_shader{Decompile(device, shader->GetIR(), ShaderType::Compute, | 267 | const SPIRVShader spirv_shader{Decompile(device, shader->GetIR(), ShaderType::Compute, |
| 267 | shader->GetRegistry(), specialization), | 268 | shader->GetRegistry(), specialization), |
| 268 | shader->GetEntries()}; | 269 | shader->GetEntries()}; |
| @@ -370,13 +371,14 @@ void AddEntry(std::vector<VkDescriptorUpdateTemplateEntry>& template_entries, u3 | |||
| 370 | if constexpr (descriptor_type == COMBINED_IMAGE_SAMPLER) { | 371 | if constexpr (descriptor_type == COMBINED_IMAGE_SAMPLER) { |
| 371 | for (u32 i = 0; i < count; ++i) { | 372 | for (u32 i = 0; i < count; ++i) { |
| 372 | const u32 num_samplers = container[i].size; | 373 | const u32 num_samplers = container[i].size; |
| 373 | VkDescriptorUpdateTemplateEntry& entry = template_entries.emplace_back(); | 374 | template_entries.push_back({ |
| 374 | entry.dstBinding = binding; | 375 | .dstBinding = binding, |
| 375 | entry.dstArrayElement = 0; | 376 | .dstArrayElement = 0, |
| 376 | entry.descriptorCount = num_samplers; | 377 | .descriptorCount = num_samplers, |
| 377 | entry.descriptorType = descriptor_type; | 378 | .descriptorType = descriptor_type, |
| 378 | entry.offset = offset; | 379 | .offset = offset, |
| 379 | entry.stride = entry_size; | 380 | .stride = entry_size, |
| 381 | }); | ||
| 380 | 382 | ||
| 381 | ++binding; | 383 | ++binding; |
| 382 | offset += num_samplers * entry_size; | 384 | offset += num_samplers * entry_size; |
| @@ -389,22 +391,24 @@ void AddEntry(std::vector<VkDescriptorUpdateTemplateEntry>& template_entries, u3 | |||
| 389 | // Nvidia has a bug where updating multiple texels at once causes the driver to crash. | 391 | // Nvidia has a bug where updating multiple texels at once causes the driver to crash. |
| 390 | // Note: Fixed in driver Windows 443.24, Linux 440.66.15 | 392 | // Note: Fixed in driver Windows 443.24, Linux 440.66.15 |
| 391 | for (u32 i = 0; i < count; ++i) { | 393 | for (u32 i = 0; i < count; ++i) { |
| 392 | VkDescriptorUpdateTemplateEntry& entry = template_entries.emplace_back(); | 394 | template_entries.push_back({ |
| 393 | entry.dstBinding = binding + i; | 395 | .dstBinding = binding + i, |
| 394 | entry.dstArrayElement = 0; | 396 | .dstArrayElement = 0, |
| 395 | entry.descriptorCount = 1; | 397 | .descriptorCount = 1, |
| 396 | entry.descriptorType = descriptor_type; | 398 | .descriptorType = descriptor_type, |
| 397 | entry.offset = static_cast<std::size_t>(offset + i * entry_size); | 399 | .offset = static_cast<std::size_t>(offset + i * entry_size), |
| 398 | entry.stride = entry_size; | 400 | .stride = entry_size, |
| 401 | }); | ||
| 399 | } | 402 | } |
| 400 | } else if (count > 0) { | 403 | } else if (count > 0) { |
| 401 | VkDescriptorUpdateTemplateEntry& entry = template_entries.emplace_back(); | 404 | template_entries.push_back({ |
| 402 | entry.dstBinding = binding; | 405 | .dstBinding = binding, |
| 403 | entry.dstArrayElement = 0; | 406 | .dstArrayElement = 0, |
| 404 | entry.descriptorCount = count; | 407 | .descriptorCount = count, |
| 405 | entry.descriptorType = descriptor_type; | 408 | .descriptorType = descriptor_type, |
| 406 | entry.offset = offset; | 409 | .offset = offset, |
| 407 | entry.stride = entry_size; | 410 | .stride = entry_size, |
| 411 | }); | ||
| 408 | } | 412 | } |
| 409 | offset += count * entry_size; | 413 | offset += count * entry_size; |
| 410 | binding += count; | 414 | binding += count; |