From ee3e26bfd1f69b361036fbd684e6d42ce43e7ae9 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 7 May 2023 21:53:35 +0200 Subject: [PATCH] early-access version 3565 --- README.md | 2 +- src/common/scratch_buffer.h | 15 +++++++++++ src/video_core/engines/sw_blitter/blitter.cpp | 25 +++++++++++-------- src/video_core/texture_cache/texture_cache.h | 2 +- src/yuzu/applets/qt_profile_select.cpp | 1 + 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b95414035..6ce249283 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3564. +This is the source code for early-access 3565. ## Legal Notice diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index 26d4e76dc..fd01dacb7 100755 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h @@ -23,7 +23,10 @@ public: buffer{Common::make_unique_for_overwrite(initial_capacity)} {} ~ScratchBuffer() = default; + ScratchBuffer(const ScratchBuffer&) = delete; + ScratchBuffer& operator=(const ScratchBuffer&) = delete; ScratchBuffer(ScratchBuffer&&) = default; + ScratchBuffer& operator=(ScratchBuffer&&) = default; /// This will only grow the buffer's capacity if size is greater than the current capacity. /// The previously held data will remain intact. @@ -87,6 +90,18 @@ public: return buffer_capacity; } + void swap(ScratchBuffer& other) { + std::swap(last_requested_size, other.last_requested_size); + std::swap(buffer_capacity, other.buffer_capacity); + std::swap(buffer, other.buffer); + } + + void swap(ScratchBuffer&& other) { + std::swap(last_requested_size, other.last_requested_size); + std::swap(buffer_capacity, other.buffer_capacity); + std::swap(buffer, other.buffer); + } + private: size_t last_requested_size{}; size_t buffer_capacity{}; diff --git a/src/video_core/engines/sw_blitter/blitter.cpp b/src/video_core/engines/sw_blitter/blitter.cpp index 3c9f38559..ff88cd03d 100755 --- a/src/video_core/engines/sw_blitter/blitter.cpp +++ b/src/video_core/engines/sw_blitter/blitter.cpp @@ -5,6 +5,7 @@ #include #include +#include "common/scratch_buffer.h" #include "video_core/engines/sw_blitter/blitter.h" #include "video_core/engines/sw_blitter/converter.h" #include "video_core/memory_manager.h" @@ -112,11 +113,11 @@ void Bilinear(std::span input, std::span output, size_t src_widt } // namespace struct SoftwareBlitEngine::BlitEngineImpl { - std::vector tmp_buffer; - std::vector src_buffer; - std::vector dst_buffer; - std::vector intermediate_src; - std::vector intermediate_dst; + Common::ScratchBuffer tmp_buffer; + Common::ScratchBuffer src_buffer; + Common::ScratchBuffer dst_buffer; + Common::ScratchBuffer intermediate_src; + Common::ScratchBuffer intermediate_dst; ConverterFactory converter_factory; }; @@ -158,14 +159,14 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst, const auto src_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format)); const auto dst_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(dst.format)); const size_t src_size = get_surface_size(src, src_bytes_per_pixel); - impl->tmp_buffer.resize(src_size); + impl->tmp_buffer.resize_destructive(src_size); memory_manager.ReadBlock(src.Address(), impl->tmp_buffer.data(), src_size); const size_t src_copy_size = src_extent_x * src_extent_y * src_bytes_per_pixel; const size_t dst_copy_size = dst_extent_x * dst_extent_y * dst_bytes_per_pixel; - impl->src_buffer.resize(src_copy_size); + impl->src_buffer.resize_destructive(src_copy_size); const bool no_passthrough = src.format != dst.format || src_extent_x != dst_extent_x || src_extent_y != dst_extent_y; @@ -177,8 +178,10 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst, const auto convertion_phase_ir = [&]() { auto* input_converter = impl->converter_factory.GetFormatConverter(src.format); - impl->intermediate_src.resize((src_copy_size / src_bytes_per_pixel) * ir_components); - impl->intermediate_dst.resize((dst_copy_size / dst_bytes_per_pixel) * ir_components); + impl->intermediate_src.resize_destructive((src_copy_size / src_bytes_per_pixel) * + ir_components); + impl->intermediate_dst.resize_destructive((dst_copy_size / dst_bytes_per_pixel) * + ir_components); input_converter->ConvertTo(impl->src_buffer, impl->intermediate_src); if (config.filter != Fermi2D::Filter::Bilinear) { @@ -195,7 +198,7 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst, // Do actual Blit - impl->dst_buffer.resize(dst_copy_size); + impl->dst_buffer.resize_destructive(dst_copy_size); if (src.linear == Fermi2D::MemoryLayout::BlockLinear) { UnswizzleSubrect(impl->src_buffer, impl->tmp_buffer, src_bytes_per_pixel, src.width, src.height, src.depth, config.src_x0, config.src_y0, src_extent_x, @@ -218,7 +221,7 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst, } const size_t dst_size = get_surface_size(dst, dst_bytes_per_pixel); - impl->tmp_buffer.resize(dst_size); + impl->tmp_buffer.resize_destructive(dst_size); memory_manager.ReadBlock(dst.Address(), impl->tmp_buffer.data(), dst_size); if (dst.linear == Fermi2D::MemoryLayout::BlockLinear) { diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 2e2d4bb14..cd11b954e 100755 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1465,7 +1465,7 @@ std::optional::BlitImages> TextureCache

::GetBlitImag if (!copy.must_accelerate) { do { if (!src_id && !dst_id) { - return std::nullopt; + break; } if (src_id && True(slot_images[src_id].flags & ImageFlagBits::GpuModified)) { break; diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp index c1e160b19..68496866d 100755 --- a/src/yuzu/applets/qt_profile_select.cpp +++ b/src/yuzu/applets/qt_profile_select.cpp @@ -95,6 +95,7 @@ QtProfileSelectionDialog::QtProfileSelectionDialog( scroll_area->setLayout(layout); connect(tree_view, &QTreeView::clicked, this, &QtProfileSelectionDialog::SelectUser); + connect(tree_view, &QTreeView::doubleClicked, this, &QtProfileSelectionDialog::accept); connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent, [this](Qt::Key key) { if (!this->isActiveWindow()) {