diff options
author | bunnei <bunneidev@gmail.com> | 2018-10-06 05:46:40 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-10-06 09:20:04 +0200 |
commit | 9aec85d39c0c95419bd086ccac158dbb77c20002 (patch) | |
tree | 3140c57d26f721f3a0fb8045e52b15cbb898db8d /src/video_core/engines/fermi_2d.cpp | |
parent | gl_rasterizer: Add rasterizer cache code to handle accerated fermi copies. (diff) | |
download | yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.tar yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.tar.gz yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.tar.bz2 yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.tar.lz yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.tar.xz yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.tar.zst yuzu-9aec85d39c0c95419bd086ccac158dbb77c20002.zip |
Diffstat (limited to 'src/video_core/engines/fermi_2d.cpp')
-rw-r--r-- | src/video_core/engines/fermi_2d.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index ea1555c5d..912e785b9 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp @@ -4,11 +4,13 @@ #include "core/memory.h" #include "video_core/engines/fermi_2d.h" +#include "video_core/rasterizer_interface.h" #include "video_core/textures/decoders.h" namespace Tegra::Engines { -Fermi2D::Fermi2D(MemoryManager& memory_manager) : memory_manager(memory_manager) {} +Fermi2D::Fermi2D(VideoCore::RasterizerInterface& rasterizer, MemoryManager& memory_manager) + : memory_manager(memory_manager), rasterizer{rasterizer} {} void Fermi2D::WriteReg(u32 method, u32 value) { ASSERT_MSG(method < Regs::NUM_REGS, @@ -44,27 +46,31 @@ void Fermi2D::HandleSurfaceCopy() { u32 src_bytes_per_pixel = RenderTargetBytesPerPixel(regs.src.format); u32 dst_bytes_per_pixel = RenderTargetBytesPerPixel(regs.dst.format); - if (regs.src.linear == regs.dst.linear) { - // If the input layout and the output layout are the same, just perform a raw copy. - ASSERT(regs.src.BlockHeight() == regs.dst.BlockHeight()); - Memory::CopyBlock(dest_cpu, source_cpu, - src_bytes_per_pixel * regs.dst.width * regs.dst.height); - return; - } - - u8* src_buffer = Memory::GetPointer(source_cpu); - u8* dst_buffer = Memory::GetPointer(dest_cpu); - - if (!regs.src.linear && regs.dst.linear) { - // If the input is tiled and the output is linear, deswizzle the input and copy it over. - Texture::CopySwizzledData(regs.src.width, regs.src.height, src_bytes_per_pixel, - dst_bytes_per_pixel, src_buffer, dst_buffer, true, - regs.src.BlockHeight()); - } else { - // If the input is linear and the output is tiled, swizzle the input and copy it over. - Texture::CopySwizzledData(regs.src.width, regs.src.height, src_bytes_per_pixel, - dst_bytes_per_pixel, dst_buffer, src_buffer, false, - regs.dst.BlockHeight()); + if (!rasterizer.AccelerateSurfaceCopy(regs.src, regs.dst)) { + // TODO(bunnei): The below implementation currently will not get hit, as + // AccelerateSurfaceCopy tries to always copy and will always return success. This should be + // changed once we properly support flushing. + + if (regs.src.linear == regs.dst.linear) { + // If the input layout and the output layout are the same, just perform a raw copy. + ASSERT(regs.src.BlockHeight() == regs.dst.BlockHeight()); + Memory::CopyBlock(dest_cpu, source_cpu, + src_bytes_per_pixel * regs.dst.width * regs.dst.height); + return; + } + u8* src_buffer = Memory::GetPointer(source_cpu); + u8* dst_buffer = Memory::GetPointer(dest_cpu); + if (!regs.src.linear && regs.dst.linear) { + // If the input is tiled and the output is linear, deswizzle the input and copy it over. + Texture::CopySwizzledData(regs.src.width, regs.src.height, src_bytes_per_pixel, + dst_bytes_per_pixel, src_buffer, dst_buffer, true, + regs.src.BlockHeight()); + } else { + // If the input is linear and the output is tiled, swizzle the input and copy it over. + Texture::CopySwizzledData(regs.src.width, regs.src.height, src_bytes_per_pixel, + dst_bytes_per_pixel, dst_buffer, src_buffer, false, + regs.dst.BlockHeight()); + } } } |