2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

fermi_2d: Add support for more accurate surface copies.

This commit is contained in:
bunnei 2018-10-17 20:32:29 -04:00
parent fdd82b754a
commit 6b333d862b
2 changed files with 12 additions and 3 deletions

View file

@ -47,9 +47,12 @@ void Fermi2D::HandleSurfaceCopy() {
u32 dst_bytes_per_pixel = RenderTargetBytesPerPixel(regs.dst.format); u32 dst_bytes_per_pixel = RenderTargetBytesPerPixel(regs.dst.format);
if (!rasterizer.AccelerateSurfaceCopy(regs.src, regs.dst)) { if (!rasterizer.AccelerateSurfaceCopy(regs.src, regs.dst)) {
// TODO(bunnei): The below implementation currently will not get hit, as rasterizer.FlushRegion(source_cpu, src_bytes_per_pixel * regs.src.width * regs.src.height);
// AccelerateSurfaceCopy tries to always copy and will always return success. This should be // We have to invalidate the destination region to evict any outdated surfaces from the
// changed once we properly support flushing. // 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 (regs.src.linear == regs.dst.linear) {
// If the input layout and the output layout are the same, just perform a raw copy. // If the input layout and the output layout are the same, just perform a raw copy.

View file

@ -659,6 +659,12 @@ void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size) {
bool RasterizerOpenGL::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, bool RasterizerOpenGL::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src,
const Tegra::Engines::Fermi2D::Regs::Surface& dst) { const Tegra::Engines::Fermi2D::Regs::Surface& dst) {
MICROPROFILE_SCOPE(OpenGL_Blits); MICROPROFILE_SCOPE(OpenGL_Blits);
if (Settings::values.use_accurate_gpu_emulation) {
// Skip the accelerated copy and perform a slow but more accurate copy
return false;
}
res_cache.FermiCopySurface(src, dst); res_cache.FermiCopySurface(src, dst);
return true; return true;
} }