summaryrefslogtreecommitdiffstats
path: root/src/video_core/engines/fermi_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/engines/fermi_2d.cpp')
-rw-r--r--src/video_core/engines/fermi_2d.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index 912e785b9..74e44c7fe 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -47,9 +47,12 @@ void Fermi2D::HandleSurfaceCopy() {
u32 dst_bytes_per_pixel = RenderTargetBytesPerPixel(regs.dst.format);
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.
+ rasterizer.FlushRegion(source_cpu, src_bytes_per_pixel * regs.src.width * regs.src.height);
+ // We have to invalidate the destination region to evict any outdated surfaces from the
+ // cache. We do this before actually writing the new data because the destination address
+ // might contain a dirty surface that will have to be written back to memory.
+ rasterizer.InvalidateRegion(dest_cpu,
+ dst_bytes_per_pixel * regs.dst.width * regs.dst.height);
if (regs.src.linear == regs.dst.linear) {
// If the input layout and the output layout are the same, just perform a raw copy.
@@ -62,14 +65,16 @@ void Fermi2D::HandleSurfaceCopy() {
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());
+ Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth,
+ src_bytes_per_pixel, dst_bytes_per_pixel, src_buffer,
+ dst_buffer, true, regs.src.BlockHeight(),
+ regs.src.BlockDepth());
} 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());
+ Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth,
+ src_bytes_per_pixel, dst_bytes_per_pixel, dst_buffer,
+ src_buffer, false, regs.dst.BlockHeight(),
+ regs.dst.BlockDepth());
}
}
}