summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-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() {
82} 82}
83 83
84void MaxwellDMA::CopyPitchToPitch() { 84void MaxwellDMA::CopyPitchToPitch() {
85 // When `multi_line_enable` bit is disabled the copy is performed as if we were copying a 1D 85 // When `multi_line_enable` bit is enabled we copy a 2D image of dimensions
86 // buffer of length `line_length_in`. 86 // (line_length_in, line_count).
87 // Otherwise we copy a 2D image of dimensions (line_length_in, line_count). 87 // Otherwise the copy is performed as if we were copying a 1D buffer of length line_length_in.
88 auto& accelerate = rasterizer->AccessAccelerateDMA(); 88 const bool remap_enabled = regs.launch_dma.remap_enable != 0;
89 if (!regs.launch_dma.multi_line_enable) { 89 if (regs.launch_dma.multi_line_enable) {
90 const bool is_buffer_clear = regs.launch_dma.remap_enable != 0 && 90 UNIMPLEMENTED_IF(remap_enabled);
91 regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A; 91
92 // TODO: allow multisized components. 92 // Perform a line-by-line copy.
93 if (is_buffer_clear) { 93 // We're going to take a subrect of size (line_length_in, line_count) from the source
94 ASSERT(regs.remap_const.component_size_minus_one == 3); 94 // rectangle. There is no need to manually flush/invalidate the regions because CopyBlock
95 accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value); 95 // does that for us.
96 std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value); 96 for (u32 line = 0; line < regs.line_count; ++line) {
97 memory_manager.WriteBlockUnsafe(regs.offset_out, 97 const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in;
98 reinterpret_cast<u8*>(tmp_buffer.data()), 98 const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out;
99 regs.line_length_in * sizeof(u32)); 99 memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in);
100 return;
101 }
102 UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0);
103 if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
104 std::vector<u8> tmp_buffer(regs.line_length_in);
105 memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in);
106 memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in);
107 } 100 }
108 return; 101 return;
109 } 102 }
110 103 // TODO: allow multisized components.
111 UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0); 104 auto& accelerate = rasterizer->AccessAccelerateDMA();
112 105 const bool is_const_a_dst = regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A;
113 // Perform a line-by-line copy. 106 const bool is_buffer_clear = remap_enabled && is_const_a_dst;
114 // We're going to take a subrect of size (line_length_in, line_count) from the source rectangle. 107 if (is_buffer_clear) {
115 // There is no need to manually flush/invalidate the regions because CopyBlock does that for us. 108 ASSERT(regs.remap_const.component_size_minus_one == 3);
116 for (u32 line = 0; line < regs.line_count; ++line) { 109 accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value);
117 const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in; 110 std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value);
118 const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out; 111 memory_manager.WriteBlockUnsafe(regs.offset_out, reinterpret_cast<u8*>(tmp_buffer.data()),
119 memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in); 112 regs.line_length_in * sizeof(u32));
113 return;
114 }
115 UNIMPLEMENTED_IF(remap_enabled);
116 if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
117 std::vector<u8> tmp_buffer(regs.line_length_in);
118 memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in);
119 memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in);
120 } 120 }
121} 121}
122 122
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:
175 static_assert(sizeof(LaunchDMA) == 4); 175 static_assert(sizeof(LaunchDMA) == 4);
176 176
177 struct RemapConst { 177 struct RemapConst {
178 enum Swizzle : u32 { 178 enum class Swizzle : u32 {
179 SRC_X = 0, 179 SRC_X = 0,
180 SRC_Y = 1, 180 SRC_Y = 1,
181 SRC_Z = 2, 181 SRC_Z = 2,