summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-09-20 02:36:41 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-09-20 02:36:41 +0200
commit24049591f6a0737d663904b633cf720fa8264774 (patch)
treef0a69b1b682988dee4572c73d6412ac4b9802c26 /src
parentbuffer_cache: Minor fixes (diff)
downloadyuzu-24049591f6a0737d663904b633cf720fa8264774.tar
yuzu-24049591f6a0737d663904b633cf720fa8264774.tar.gz
yuzu-24049591f6a0737d663904b633cf720fa8264774.tar.bz2
yuzu-24049591f6a0737d663904b633cf720fa8264774.tar.lz
yuzu-24049591f6a0737d663904b633cf720fa8264774.tar.xz
yuzu-24049591f6a0737d663904b633cf720fa8264774.tar.zst
yuzu-24049591f6a0737d663904b633cf720fa8264774.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_dma.cpp64
-rw-r--r--src/video_core/engines/maxwell_dma.h2
2 files changed, 33 insertions, 33 deletions
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index c7ec1eac9..67388d980 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -82,41 +82,41 @@ void MaxwellDMA::Launch() {
}
void MaxwellDMA::CopyPitchToPitch() {
- // When `multi_line_enable` bit is disabled the copy is performed as if we were copying a 1D
- // buffer of length `line_length_in`.
- // Otherwise we copy a 2D image of dimensions (line_length_in, line_count).
- auto& accelerate = rasterizer->AccessAccelerateDMA();
- if (!regs.launch_dma.multi_line_enable) {
- const bool is_buffer_clear = regs.launch_dma.remap_enable != 0 &&
- regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A;
- // TODO: allow multisized components.
- if (is_buffer_clear) {
- ASSERT(regs.remap_const.component_size_minus_one == 3);
- accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value);
- std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value);
- memory_manager.WriteBlockUnsafe(regs.offset_out,
- reinterpret_cast<u8*>(tmp_buffer.data()),
- regs.line_length_in * sizeof(u32));
- return;
- }
- UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0);
- if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
- std::vector<u8> tmp_buffer(regs.line_length_in);
- memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in);
- memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in);
+ // When `multi_line_enable` bit is enabled we copy a 2D image of dimensions
+ // (line_length_in, line_count).
+ // Otherwise the copy is performed as if we were copying a 1D buffer of length line_length_in.
+ const bool remap_enabled = regs.launch_dma.remap_enable != 0;
+ if (regs.launch_dma.multi_line_enable) {
+ UNIMPLEMENTED_IF(remap_enabled);
+
+ // Perform a line-by-line copy.
+ // We're going to take a subrect of size (line_length_in, line_count) from the source
+ // rectangle. There is no need to manually flush/invalidate the regions because CopyBlock
+ // does that for us.
+ for (u32 line = 0; line < regs.line_count; ++line) {
+ const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in;
+ const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out;
+ memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in);
}
return;
}
-
- UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0);
-
- // Perform a line-by-line copy.
- // We're going to take a subrect of size (line_length_in, line_count) from the source rectangle.
- // There is no need to manually flush/invalidate the regions because CopyBlock does that for us.
- for (u32 line = 0; line < regs.line_count; ++line) {
- const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in;
- const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out;
- memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in);
+ // TODO: allow multisized components.
+ auto& accelerate = rasterizer->AccessAccelerateDMA();
+ const bool is_const_a_dst = regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A;
+ const bool is_buffer_clear = remap_enabled && is_const_a_dst;
+ if (is_buffer_clear) {
+ ASSERT(regs.remap_const.component_size_minus_one == 3);
+ accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value);
+ std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value);
+ memory_manager.WriteBlockUnsafe(regs.offset_out, reinterpret_cast<u8*>(tmp_buffer.data()),
+ regs.line_length_in * sizeof(u32));
+ return;
+ }
+ UNIMPLEMENTED_IF(remap_enabled);
+ if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
+ std::vector<u8> tmp_buffer(regs.line_length_in);
+ memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in);
+ memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in);
}
}
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index 9e457ae16..a04514425 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -175,7 +175,7 @@ public:
static_assert(sizeof(LaunchDMA) == 4);
struct RemapConst {
- enum Swizzle : u32 {
+ enum class Swizzle : u32 {
SRC_X = 0,
SRC_Y = 1,
SRC_Z = 2,