summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-09-27 16:10:45 -0400
committerGravatar FernandoS272019-10-17 10:38:44 -0400
commit57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47 (patch)
treef18e40e15f11c164ee136ac0574700c2257d6ada /src
parentMerge pull request #2978 from lioncash/doxygen (diff)
downloadyuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.gz
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.xz
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.zip
Fermi2D: limit blit area to only available area
Normaly OpenGL does not care if the areas exceed the texture regions but other backends such as Vulkan do care about the limits of this areas. This PR crops the areas of the blit in order that they don't surpass the limits of the textures. This should help Vulkan and faulty OpenGL drivers
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/fermi_2d.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index 7ff44f06d..c2d4dcc09 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -47,10 +47,20 @@ void Fermi2D::HandleSurfaceCopy() {
47 src_blit_x2 = static_cast<u32>((regs.blit_src_x >> 32) + regs.blit_dst_width); 47 src_blit_x2 = static_cast<u32>((regs.blit_src_x >> 32) + regs.blit_dst_width);
48 src_blit_y2 = static_cast<u32>((regs.blit_src_y >> 32) + regs.blit_dst_height); 48 src_blit_y2 = static_cast<u32>((regs.blit_src_y >> 32) + regs.blit_dst_height);
49 } 49 }
50 const Common::Rectangle<u32> src_rect{src_blit_x1, src_blit_y1, src_blit_x2, src_blit_y2}; 50 const u32 dst_blit_x2 = regs.blit_dst_x + regs.blit_dst_width;
51 const Common::Rectangle<u32> dst_rect{regs.blit_dst_x, regs.blit_dst_y, 51 const u32 dst_blit_y2 = regs.blit_dst_x + regs.blit_dst_height;
52 regs.blit_dst_x + regs.blit_dst_width, 52 const u32 excess_src_x2 = std::max<s32>(0, dst_blit_x2 - regs.dst.width);
53 regs.blit_dst_y + regs.blit_dst_height}; 53 const u32 excess_src_y2 = std::max<s32>(0, dst_blit_y2 - regs.dst.height);
54 const u32 excess_dst_x2 = std::max<s32>(0, src_blit_x2 - regs.src.width);
55 const u32 excess_dst_y2 = std::max<s32>(0, src_blit_y2 - regs.src.height);
56
57 const Common::Rectangle<u32> src_rect{
58 src_blit_x1, src_blit_y1, std::min<u32>(regs.src.width, src_blit_x2) - excess_src_x2,
59 std::min<u32>(regs.src.height, src_blit_y2) - excess_src_y2};
60 const Common::Rectangle<u32> dst_rect{
61 regs.blit_dst_x, regs.blit_dst_y,
62 std::min<u32>(regs.dst.width, dst_blit_x2) - excess_dst_x2,
63 std::min<u32>(regs.dst.height, dst_blit_y2) - excess_dst_y2};
54 Config copy_config; 64 Config copy_config;
55 copy_config.operation = regs.operation; 65 copy_config.operation = regs.operation;
56 copy_config.filter = regs.blit_control.filter; 66 copy_config.filter = regs.blit_control.filter;