summaryrefslogtreecommitdiffstats
path: root/src/video_core/engines/fermi_2d.cpp
diff options
context:
space:
mode:
authorFeng Chen <VonChenPlus@gmail.com>2021-07-08 20:06:09 +0200
committerGitHub <noreply@github.com>2021-07-08 20:06:09 +0200
commitc7ad195fd3eeea380465be48264f4e69165178c7 (patch)
tree77a348320c12feaca4248d090c6d686de7bde39a /src/video_core/engines/fermi_2d.cpp
parentMerge pull request #6564 from Kelebek1/Audio (diff)
downloadyuzu-c7ad195fd3eeea380465be48264f4e69165178c7.tar
yuzu-c7ad195fd3eeea380465be48264f4e69165178c7.tar.gz
yuzu-c7ad195fd3eeea380465be48264f4e69165178c7.tar.bz2
yuzu-c7ad195fd3eeea380465be48264f4e69165178c7.tar.lz
yuzu-c7ad195fd3eeea380465be48264f4e69165178c7.tar.xz
yuzu-c7ad195fd3eeea380465be48264f4e69165178c7.tar.zst
yuzu-c7ad195fd3eeea380465be48264f4e69165178c7.zip
Diffstat (limited to 'src/video_core/engines/fermi_2d.cpp')
-rw-r--r--src/video_core/engines/fermi_2d.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index 0f640fdae..f26530ede 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -7,6 +7,10 @@
#include "video_core/engines/fermi_2d.h"
#include "video_core/memory_manager.h"
#include "video_core/rasterizer_interface.h"
+#include "video_core/surface.h"
+
+using VideoCore::Surface::BytesPerBlock;
+using VideoCore::Surface::PixelFormatFromRenderTargetFormat;
namespace Tegra::Engines {
@@ -49,7 +53,7 @@ void Fermi2D::Blit() {
UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled");
const auto& args = regs.pixels_from_memory;
- const Config config{
+ Config config{
.operation = regs.operation,
.filter = args.sample_mode.filter,
.dst_x0 = args.dst_x0,
@@ -61,7 +65,21 @@ void Fermi2D::Blit() {
.src_x1 = static_cast<s32>((args.du_dx * args.dst_width + args.src_x0) >> 32),
.src_y1 = static_cast<s32>((args.dv_dy * args.dst_height + args.src_y0) >> 32),
};
- if (!rasterizer->AccelerateSurfaceCopy(regs.src, regs.dst, config)) {
+ Surface src = regs.src;
+ const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format));
+ const auto need_align_to_pitch =
+ src.linear == Tegra::Engines::Fermi2D::MemoryLayout::Pitch &&
+ static_cast<s32>(src.width) == config.src_x1 &&
+ config.src_x1 > static_cast<s32>(src.pitch / bytes_per_pixel) && config.src_x0 > 0;
+ if (need_align_to_pitch) {
+ auto address = src.Address() + config.src_x0 * bytes_per_pixel;
+ src.addr_upper = static_cast<u32>(address >> 32);
+ src.addr_lower = static_cast<u32>(address);
+ src.width -= config.src_x0;
+ config.src_x1 -= config.src_x0;
+ config.src_x0 = 0;
+ }
+ if (!rasterizer->AccelerateSurfaceCopy(src, regs.dst, config)) {
UNIMPLEMENTED();
}
}