aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpineappleEA <pineaea@gmail.com>2023-05-07 21:53:35 +0200
committerpineappleEA <pineaea@gmail.com>2023-05-07 21:53:35 +0200
commitee3e26bfd1f69b361036fbd684e6d42ce43e7ae9 (patch)
treeade19aebbfed0466f2d84f4a739275d663b09036
parentcdb7d0d547d9be23a64bf2b03814dbd5c005fb3b (diff)
early-access version 3565EA-3565
-rwxr-xr-xREADME.md2
-rwxr-xr-xsrc/common/scratch_buffer.h15
-rwxr-xr-xsrc/video_core/engines/sw_blitter/blitter.cpp25
-rwxr-xr-xsrc/video_core/texture_cache/texture_cache.h2
-rwxr-xr-xsrc/yuzu/applets/qt_profile_select.cpp1
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 @@
1yuzu emulator early access 1yuzu emulator early access
2============= 2=============
3 3
4This is the source code for early-access 3564. 4This is the source code for early-access 3565.
5 5
6## Legal Notice 6## Legal Notice
7 7
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:
23 buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {} 23 buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {}
24 24
25 ~ScratchBuffer() = default; 25 ~ScratchBuffer() = default;
26 ScratchBuffer(const ScratchBuffer&) = delete;
27 ScratchBuffer& operator=(const ScratchBuffer&) = delete;
26 ScratchBuffer(ScratchBuffer&&) = default; 28 ScratchBuffer(ScratchBuffer&&) = default;
29 ScratchBuffer& operator=(ScratchBuffer&&) = default;
27 30
28 /// This will only grow the buffer's capacity if size is greater than the current capacity. 31 /// This will only grow the buffer's capacity if size is greater than the current capacity.
29 /// The previously held data will remain intact. 32 /// The previously held data will remain intact.
@@ -87,6 +90,18 @@ public:
87 return buffer_capacity; 90 return buffer_capacity;
88 } 91 }
89 92
93 void swap(ScratchBuffer& other) {
94 std::swap(last_requested_size, other.last_requested_size);
95 std::swap(buffer_capacity, other.buffer_capacity);
96 std::swap(buffer, other.buffer);
97 }
98
99 void swap(ScratchBuffer&& other) {
100 std::swap(last_requested_size, other.last_requested_size);
101 std::swap(buffer_capacity, other.buffer_capacity);
102 std::swap(buffer, other.buffer);
103 }
104
90private: 105private:
91 size_t last_requested_size{}; 106 size_t last_requested_size{};
92 size_t buffer_capacity{}; 107 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 @@
5#include <cmath> 5#include <cmath>
6#include <vector> 6#include <vector>
7 7
8#include "common/scratch_buffer.h"
8#include "video_core/engines/sw_blitter/blitter.h" 9#include "video_core/engines/sw_blitter/blitter.h"
9#include "video_core/engines/sw_blitter/converter.h" 10#include "video_core/engines/sw_blitter/converter.h"
10#include "video_core/memory_manager.h" 11#include "video_core/memory_manager.h"
@@ -112,11 +113,11 @@ void Bilinear(std::span<const f32> input, std::span<f32> output, size_t src_widt
112} // namespace 113} // namespace
113 114
114struct SoftwareBlitEngine::BlitEngineImpl { 115struct SoftwareBlitEngine::BlitEngineImpl {
115 std::vector<u8> tmp_buffer; 116 Common::ScratchBuffer<u8> tmp_buffer;
116 std::vector<u8> src_buffer; 117 Common::ScratchBuffer<u8> src_buffer;
117 std::vector<u8> dst_buffer; 118 Common::ScratchBuffer<u8> dst_buffer;
118 std::vector<f32> intermediate_src; 119 Common::ScratchBuffer<f32> intermediate_src;
119 std::vector<f32> intermediate_dst; 120 Common::ScratchBuffer<f32> intermediate_dst;
120 ConverterFactory converter_factory; 121 ConverterFactory converter_factory;
121}; 122};
122 123
@@ -158,14 +159,14 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst,
158 const auto src_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format)); 159 const auto src_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format));
159 const auto dst_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(dst.format)); 160 const auto dst_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(dst.format));
160 const size_t src_size = get_surface_size(src, src_bytes_per_pixel); 161 const size_t src_size = get_surface_size(src, src_bytes_per_pixel);
161 impl->tmp_buffer.resize(src_size); 162 impl->tmp_buffer.resize_destructive(src_size);
162 memory_manager.ReadBlock(src.Address(), impl->tmp_buffer.data(), src_size); 163 memory_manager.ReadBlock(src.Address(), impl->tmp_buffer.data(), src_size);
163 164
164 const size_t src_copy_size = src_extent_x * src_extent_y * src_bytes_per_pixel; 165 const size_t src_copy_size = src_extent_x * src_extent_y * src_bytes_per_pixel;
165 166
166 const size_t dst_copy_size = dst_extent_x * dst_extent_y * dst_bytes_per_pixel; 167 const size_t dst_copy_size = dst_extent_x * dst_extent_y * dst_bytes_per_pixel;
167 168
168 impl->src_buffer.resize(src_copy_size); 169 impl->src_buffer.resize_destructive(src_copy_size);
169 170
170 const bool no_passthrough = 171 const bool no_passthrough =
171 src.format != dst.format || src_extent_x != dst_extent_x || src_extent_y != dst_extent_y; 172 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,
177 178
178 const auto convertion_phase_ir = [&]() { 179 const auto convertion_phase_ir = [&]() {
179 auto* input_converter = impl->converter_factory.GetFormatConverter(src.format); 180 auto* input_converter = impl->converter_factory.GetFormatConverter(src.format);
180 impl->intermediate_src.resize((src_copy_size / src_bytes_per_pixel) * ir_components); 181 impl->intermediate_src.resize_destructive((src_copy_size / src_bytes_per_pixel) *
181 impl->intermediate_dst.resize((dst_copy_size / dst_bytes_per_pixel) * ir_components); 182 ir_components);
183 impl->intermediate_dst.resize_destructive((dst_copy_size / dst_bytes_per_pixel) *
184 ir_components);
182 input_converter->ConvertTo(impl->src_buffer, impl->intermediate_src); 185 input_converter->ConvertTo(impl->src_buffer, impl->intermediate_src);
183 186
184 if (config.filter != Fermi2D::Filter::Bilinear) { 187 if (config.filter != Fermi2D::Filter::Bilinear) {
@@ -195,7 +198,7 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst,
195 198
196 // Do actual Blit 199 // Do actual Blit
197 200
198 impl->dst_buffer.resize(dst_copy_size); 201 impl->dst_buffer.resize_destructive(dst_copy_size);
199 if (src.linear == Fermi2D::MemoryLayout::BlockLinear) { 202 if (src.linear == Fermi2D::MemoryLayout::BlockLinear) {
200 UnswizzleSubrect(impl->src_buffer, impl->tmp_buffer, src_bytes_per_pixel, src.width, 203 UnswizzleSubrect(impl->src_buffer, impl->tmp_buffer, src_bytes_per_pixel, src.width,
201 src.height, src.depth, config.src_x0, config.src_y0, src_extent_x, 204 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,
218 } 221 }
219 222
220 const size_t dst_size = get_surface_size(dst, dst_bytes_per_pixel); 223 const size_t dst_size = get_surface_size(dst, dst_bytes_per_pixel);
221 impl->tmp_buffer.resize(dst_size); 224 impl->tmp_buffer.resize_destructive(dst_size);
222 memory_manager.ReadBlock(dst.Address(), impl->tmp_buffer.data(), dst_size); 225 memory_manager.ReadBlock(dst.Address(), impl->tmp_buffer.data(), dst_size);
223 226
224 if (dst.linear == Fermi2D::MemoryLayout::BlockLinear) { 227 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<typename TextureCache<P>::BlitImages> TextureCache<P>::GetBlitImag
1465 if (!copy.must_accelerate) { 1465 if (!copy.must_accelerate) {
1466 do { 1466 do {
1467 if (!src_id && !dst_id) { 1467 if (!src_id && !dst_id) {
1468 return std::nullopt; 1468 break;
1469 } 1469 }
1470 if (src_id && True(slot_images[src_id].flags & ImageFlagBits::GpuModified)) { 1470 if (src_id && True(slot_images[src_id].flags & ImageFlagBits::GpuModified)) {
1471 break; 1471 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(
95 scroll_area->setLayout(layout); 95 scroll_area->setLayout(layout);
96 96
97 connect(tree_view, &QTreeView::clicked, this, &QtProfileSelectionDialog::SelectUser); 97 connect(tree_view, &QTreeView::clicked, this, &QtProfileSelectionDialog::SelectUser);
98 connect(tree_view, &QTreeView::doubleClicked, this, &QtProfileSelectionDialog::accept);
98 connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent, 99 connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
99 [this](Qt::Key key) { 100 [this](Qt::Key key) {
100 if (!this->isActiveWindow()) { 101 if (!this->isActiveWindow()) {