summaryrefslogtreecommitdiffstats
path: root/src/video_core/engines/maxwell_dma.cpp
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-12-25 02:26:06 +0100
committerGitHub <noreply@github.com>2022-12-25 02:26:06 +0100
commit3e6850f00bdd541202a8369438bda7988c8001f5 (patch)
tree34691ecb826bc402f68a075de07f4f6aaebf8c44 /src/video_core/engines/maxwell_dma.cpp
parentqt: fix 'Pause' menu item (#9497) (diff)
parentscratch_buffer: Explicitly defing resize and resize_destructive functions (diff)
downloadyuzu-3e6850f00bdd541202a8369438bda7988c8001f5.tar
yuzu-3e6850f00bdd541202a8369438bda7988c8001f5.tar.gz
yuzu-3e6850f00bdd541202a8369438bda7988c8001f5.tar.bz2
yuzu-3e6850f00bdd541202a8369438bda7988c8001f5.tar.lz
yuzu-3e6850f00bdd541202a8369438bda7988c8001f5.tar.xz
yuzu-3e6850f00bdd541202a8369438bda7988c8001f5.tar.zst
yuzu-3e6850f00bdd541202a8369438bda7988c8001f5.zip
Diffstat (limited to 'src/video_core/engines/maxwell_dma.cpp')
-rw-r--r--src/video_core/engines/maxwell_dma.cpp34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index a189e60ae..f73d7bf0f 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -184,12 +184,8 @@ void MaxwellDMA::CopyBlockLinearToPitch() {
const size_t src_size =
CalculateSize(true, bytes_per_pixel, width, height, depth, block_height, block_depth);
- if (read_buffer.size() < src_size) {
- read_buffer.resize(src_size);
- }
- if (write_buffer.size() < dst_size) {
- write_buffer.resize(dst_size);
- }
+ read_buffer.resize_destructive(src_size);
+ write_buffer.resize_destructive(dst_size);
memory_manager.ReadBlock(regs.offset_in, read_buffer.data(), src_size);
memory_manager.ReadBlock(regs.offset_out, write_buffer.data(), dst_size);
@@ -235,12 +231,8 @@ void MaxwellDMA::CopyPitchToBlockLinear() {
CalculateSize(true, bytes_per_pixel, width, height, depth, block_height, block_depth);
const size_t src_size = static_cast<size_t>(regs.pitch_in) * regs.line_count;
- if (read_buffer.size() < src_size) {
- read_buffer.resize(src_size);
- }
- if (write_buffer.size() < dst_size) {
- write_buffer.resize(dst_size);
- }
+ read_buffer.resize_destructive(src_size);
+ write_buffer.resize_destructive(dst_size);
memory_manager.ReadBlock(regs.offset_in, read_buffer.data(), src_size);
if (Settings::IsGPULevelExtreme()) {
@@ -269,12 +261,8 @@ void MaxwellDMA::FastCopyBlockLinearToPitch() {
pos_x = pos_x % x_in_gob;
pos_y = pos_y % 8;
- if (read_buffer.size() < src_size) {
- read_buffer.resize(src_size);
- }
- if (write_buffer.size() < dst_size) {
- write_buffer.resize(dst_size);
- }
+ read_buffer.resize_destructive(src_size);
+ write_buffer.resize_destructive(dst_size);
if (Settings::IsGPULevelExtreme()) {
memory_manager.ReadBlock(regs.offset_in + offset, read_buffer.data(), src_size);
@@ -333,14 +321,10 @@ void MaxwellDMA::CopyBlockLinearToBlockLinear() {
const u32 pitch = x_elements * bytes_per_pixel;
const size_t mid_buffer_size = pitch * regs.line_count;
- if (read_buffer.size() < src_size) {
- read_buffer.resize(src_size);
- }
- if (write_buffer.size() < dst_size) {
- write_buffer.resize(dst_size);
- }
+ read_buffer.resize_destructive(src_size);
+ write_buffer.resize_destructive(dst_size);
- intermediate_buffer.resize(mid_buffer_size);
+ intermediate_buffer.resize_destructive(mid_buffer_size);
memory_manager.ReadBlock(regs.offset_in, read_buffer.data(), src_size);
memory_manager.ReadBlock(regs.offset_out, write_buffer.data(), dst_size);