From 6bb2853ca025f2f12201218d15a635a80f987879 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 29 Sep 2022 21:14:28 +0100 Subject: [PATCH] Keep track of combined image samplers for quick bind --- .../interconnect/maxwell_3d/pipeline_manager.cpp | 13 ++++++++++++- .../gpu/interconnect/maxwell_3d/pipeline_manager.h | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp index 9222e634..b85d2a94 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp @@ -275,7 +275,18 @@ namespace skyline::gpu::interconnect::maxwell3d { pushBindings(vk::DescriptorType::eStorageTexelBuffer, stage.info.image_buffer_descriptors, stageDescInfo.storageTexelBufferDescCount, [](const auto &, u32) {}); descriptorInfo.totalTexelBufferDescCount += stageDescInfo.uniformTexelBufferDescCount + stageDescInfo.storageTexelBufferDescCount; - pushBindings(vk::DescriptorType::eCombinedImageSampler, stage.info.texture_descriptors, stageDescInfo.combinedImageSamplerDescCount, [](const auto &, u32) {}, needsIndividualTextureBindingWrites); + pushBindings(vk::DescriptorType::eCombinedImageSampler, stage.info.texture_descriptors, stageDescInfo.combinedImageSamplerDescCount, [&](const Shader::TextureDescriptor &desc, u32 descIdx) { + auto addUsage{[&](auto idx) { + auto &usage{stageDescInfo.cbufUsages[desc.cbuf_index]}; + usage.combinedImageSamplers.push_back({bindingIndex, descIdx}); + usage.totalImageDescCount += desc.count; + usage.writeDescCount++; + }}; + + addUsage(desc.cbuf_index); + if (desc.has_secondary) + addUsage(desc.secondary_cbuf_index); + }, needsIndividualTextureBindingWrites); pushBindings(vk::DescriptorType::eStorageImage, stage.info.image_descriptors, stageDescInfo.storageImageDescCount, [](const auto &, u32) {}); descriptorInfo.totalImageDescCount += stageDescInfo.combinedImageSamplerDescCount + stageDescInfo.storageImageDescCount; } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.h b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.h index 7765f0e6..d202b731 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.h @@ -63,13 +63,16 @@ namespace skyline::gpu::interconnect::maxwell3d { boost::container::small_vector uniformBuffers; boost::container::small_vector storageBuffers; + boost::container::small_vector combinedImageSamplers; u32 totalBufferDescCount; + u32 totalImageDescCount; u32 writeDescCount; }; std::array cbufUsages; }; + std::vector copyDescs; std::array stages; u32 totalStorageBufferCount; @@ -78,7 +81,6 @@ namespace skyline::gpu::interconnect::maxwell3d { u32 totalBufferDescCount; u32 totalTexelBufferDescCount; u32 totalImageDescCount; - u32 totalElemCount; }; private: