summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/EfbInterface.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2017-10-24 00:44:14 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2017-11-17 22:11:33 -0600
commitbf7db3f88835d3b69800c9ed5596e31c7ba96346 (patch)
tree2d548b0b8326d0daa1d57a7a9760514db44b40a8 /Source/Core/VideoBackends/Software/EfbInterface.cpp
parent332af8aa491a320d00b4989e9e4f1a25b59588c3 (diff)
Software Backend: Remove reinterpret_cast which violates the strict aliasing rule
Diffstat (limited to 'Source/Core/VideoBackends/Software/EfbInterface.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/EfbInterface.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp
index 55462ce33f..a94ac467b8 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.cpp
+++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp
@@ -497,8 +497,7 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth)
return &efb[GetColorOffset(x, y)];
}
-void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect,
- float y_scale)
+void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale)
{
if (!xfb_in_ram)
{
@@ -555,10 +554,16 @@ void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle&
src_ptr += memory_stride;
}
- // Apply y scaling and copy to the xfb memory location
- SW::CopyRegion(source.data(), source_rect, xfb_in_ram,
- EFBRectangle{source_rect.left, source_rect.top, source_rect.right,
- static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale)});
+ auto dest_rect = EFBRectangle{source_rect.left, source_rect.top, source_rect.right,
+ static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale)};
+
+ const std::size_t destination_size = dest_rect.GetWidth() * dest_rect.GetHeight() * 2;
+ static std::vector<yuv422_packed> destination;
+ destination.resize(dest_rect.GetWidth() * dest_rect.GetHeight());
+
+ SW::CopyRegion(source.data(), source_rect, destination.data(), dest_rect);
+
+ memcpy(xfb_in_ram, destination.data(), destination_size);
}
bool ZCompare(u16 x, u16 y, u32 z)