|
|
@ -82,41 +82,41 @@ void MaxwellDMA::Launch() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MaxwellDMA::CopyPitchToPitch() {
|
|
|
|
void MaxwellDMA::CopyPitchToPitch() {
|
|
|
|
// When `multi_line_enable` bit is disabled the copy is performed as if we were copying a 1D
|
|
|
|
// When `multi_line_enable` bit is enabled we copy a 2D image of dimensions
|
|
|
|
// buffer of length `line_length_in`.
|
|
|
|
// (line_length_in, line_count).
|
|
|
|
// Otherwise 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.
|
|
|
|
auto& accelerate = rasterizer->AccessAccelerateDMA();
|
|
|
|
const bool remap_enabled = regs.launch_dma.remap_enable != 0;
|
|
|
|
if (!regs.launch_dma.multi_line_enable) {
|
|
|
|
if (regs.launch_dma.multi_line_enable) {
|
|
|
|
const bool is_buffer_clear = regs.launch_dma.remap_enable != 0 &&
|
|
|
|
UNIMPLEMENTED_IF(remap_enabled);
|
|
|
|
regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A;
|
|
|
|
|
|
|
|
// TODO: allow multisized components.
|
|
|
|
// Perform a line-by-line copy.
|
|
|
|
if (is_buffer_clear) {
|
|
|
|
// We're going to take a subrect of size (line_length_in, line_count) from the source
|
|
|
|
ASSERT(regs.remap_const.component_size_minus_one == 3);
|
|
|
|
// rectangle. There is no need to manually flush/invalidate the regions because CopyBlock
|
|
|
|
accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value);
|
|
|
|
// does that for us.
|
|
|
|
std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value);
|
|
|
|
for (u32 line = 0; line < regs.line_count; ++line) {
|
|
|
|
memory_manager.WriteBlockUnsafe(regs.offset_out,
|
|
|
|
const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in;
|
|
|
|
reinterpret_cast<u8*>(tmp_buffer.data()),
|
|
|
|
const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out;
|
|
|
|
regs.line_length_in * sizeof(u32));
|
|
|
|
memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: allow multisized components.
|
|
|
|
UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0);
|
|
|
|
auto& accelerate = rasterizer->AccessAccelerateDMA();
|
|
|
|
|
|
|
|
const bool is_const_a_dst = regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A;
|
|
|
|
// Perform a line-by-line copy.
|
|
|
|
const bool is_buffer_clear = remap_enabled && is_const_a_dst;
|
|
|
|
// We're going to take a subrect of size (line_length_in, line_count) from the source rectangle.
|
|
|
|
if (is_buffer_clear) {
|
|
|
|
// There is no need to manually flush/invalidate the regions because CopyBlock does that for us.
|
|
|
|
ASSERT(regs.remap_const.component_size_minus_one == 3);
|
|
|
|
for (u32 line = 0; line < regs.line_count; ++line) {
|
|
|
|
accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value);
|
|
|
|
const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in;
|
|
|
|
std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value);
|
|
|
|
const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out;
|
|
|
|
memory_manager.WriteBlockUnsafe(regs.offset_out, reinterpret_cast<u8*>(tmp_buffer.data()),
|
|
|
|
memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|