diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-07-28 07:47:06 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:28 +0100 |
commit | 56ccda1d9952368d0c1e29d7c4b486c547de9549 (patch) | |
tree | b2064ced92ef5ee0f4a67169df10462414664db9 /src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |
parent | Vulkan: Fix downscaling Blit. (diff) | |
download | yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.gz yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.bz2 yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.lz yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.xz yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.zst yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_compute_pipeline.cpp')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 5c591e345..f89b84c6e 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp @@ -108,10 +108,8 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, texture_cache.SynchronizeComputeDescriptors(); static constexpr size_t max_elements = 64; - std::array<ImageId, max_elements> image_view_ids; - boost::container::static_vector<u32, max_elements> image_view_indices; + boost::container::static_vector<VideoCommon::ImageViewInOut, max_elements> views; boost::container::static_vector<VkSampler, max_elements> samplers; - boost::container::static_vector<bool, max_elements> image_view_blacklist; const auto& qmd{kepler_compute.launch_description}; const auto& cbufs{qmd.const_buffer_config}; @@ -135,54 +133,37 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, } return TexturePair(gpu_memory.Read<u32>(addr), via_header_index); }}; - const auto add_image{[&](const auto& desc) { + const auto add_image{[&](const auto& desc, bool blacklist) { for (u32 index = 0; index < desc.count; ++index) { const auto handle{read_handle(desc, index)}; - image_view_indices.push_back(handle.first); + views.push_back({ + .index = handle.first, + .blacklist = blacklist, + .id = {}, + }); } }}; - std::ranges::for_each(info.texture_buffer_descriptors, add_image); - std::ranges::for_each(info.image_buffer_descriptors, add_image); + for (const auto& desc : info.texture_buffer_descriptors) { + add_image(desc, false); + } + for (const auto& desc : info.image_buffer_descriptors) { + add_image(desc, false); + } for (const auto& desc : info.texture_descriptors) { for (u32 index = 0; index < desc.count; ++index) { const auto handle{read_handle(desc, index)}; - image_view_indices.push_back(handle.first); + views.push_back({handle.first}); Sampler* const sampler = texture_cache.GetComputeSampler(handle.second); samplers.push_back(sampler->Handle()); } } - const u32 black_list_base = image_view_indices.size(); - bool atleast_one_blacklisted = false; for (const auto& desc : info.image_descriptors) { - const bool is_black_listed = - desc.is_written && (desc.type == Shader::TextureType::Color2D || - desc.type == Shader::TextureType::ColorArray2D); - for (u32 index = 0; index < desc.count; ++index) { - image_view_blacklist.push_back(is_black_listed); - } - atleast_one_blacklisted |= is_black_listed; - add_image(desc); + add_image(desc, true); } - - const std::span indices_span(image_view_indices.data(), image_view_indices.size()); - bool has_listed_stuffs; - do { - has_listed_stuffs = false; - texture_cache.FillComputeImageViews(indices_span, image_view_ids); - if (atleast_one_blacklisted) { - for (u32 index = 0; index < image_view_blacklist.size(); index++) { - if (image_view_blacklist[index]) { - ImageView& image_view{ - texture_cache.GetImageView(image_view_ids[index + black_list_base])}; - has_listed_stuffs |= texture_cache.BlackListImage(image_view.image_id); - } - } - } - } while (has_listed_stuffs); + texture_cache.FillComputeImageViews(std::span(views.data(), views.size())); buffer_cache.UnbindComputeTextureBuffers(); - ImageId* texture_buffer_ids{image_view_ids.data()}; size_t index{}; const auto add_buffer{[&](const auto& desc) { constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; @@ -191,11 +172,10 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, if constexpr (is_image) { is_written = desc.is_written; } - ImageView& image_view = texture_cache.GetImageView(*texture_buffer_ids); + ImageView& image_view = texture_cache.GetImageView(views[index].id); buffer_cache.BindComputeTextureBuffer(index, image_view.GpuAddr(), image_view.BufferSize(), image_view.format, is_written, is_image); - ++texture_buffer_ids; ++index; } }}; @@ -207,9 +187,9 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, RescalingPushConstant rescaling(num_textures); const VkSampler* samplers_it{samplers.data()}; - const ImageId* views_it{image_view_ids.data()}; - PushImageDescriptors(info, samplers_it, views_it, texture_cache, update_descriptor_queue, - rescaling); + const VideoCommon::ImageViewInOut* views_it{views.data()}; + PushImageDescriptors(texture_cache, update_descriptor_queue, info, rescaling, samplers_it, + views_it); if (!is_built.load(std::memory_order::relaxed)) { // Wait for the pipeline to be built |