diff options
| author | Stenzek <stenzek@gmail.com> | 2018-11-03 00:17:00 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2018-11-07 16:25:01 +1000 |
| commit | 8e2c063d6219b01037d1cb5bdb009000e52d8479 (patch) | |
| tree | f288e47b45fb22b61209dd57f657abd148fa40d9 /Source/Core/VideoBackends/Software/TextureEncoder.cpp | |
| parent | 710b893b914bcc1e812f1a63fdb9a143ff682561 (diff) | |
TextureCache: Implement deferred/batched EFB copies
Diffstat (limited to 'Source/Core/VideoBackends/Software/TextureEncoder.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/TextureEncoder.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp index a31888e544..07eba31530 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp +++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp @@ -5,12 +5,14 @@ #include "VideoBackends/Software/TextureEncoder.h" #include "Common/Align.h" +#include "Common/Assert.h" #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/MsgHandler.h" #include "Common/Swap.h" #include "VideoBackends/Software/EfbInterface.h" +#include "VideoBackends/Software/SWTexture.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/LookUpTables.h" @@ -1468,18 +1470,26 @@ void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 b } } -void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row, - u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half, - float y_scale, float gamma) +void Encode(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, + u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, + bool scale_by_half, float y_scale, float gamma) { + // HACK: Override the memory stride for this staging texture with new copy stride. + // This is required because the texture encoder assumes that we're writing directly to memory, + // and each row is tightly packed with no padding, whereas our encoding abstract texture has + // a width of 2560. When we copy the texture back later on, it'll use the tightly packed stride. + ASSERT(memory_stride <= (dst->GetConfig().width * dst->GetTexelSize())); + static_cast<SW::SWStagingTexture*>(dst)->SetMapStride(memory_stride); + if (params.copy_format == EFBCopyFormat::XFB) { - EfbInterface::EncodeXFB(dst, native_width, src_rect, y_scale, gamma); + EfbInterface::EncodeXFB(reinterpret_cast<u8*>(dst->GetMappedPointer()), native_width, src_rect, + y_scale, gamma); } else { - EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect, - scale_by_half); + EncodeEfbCopy(reinterpret_cast<u8*>(dst->GetMappedPointer()), params, native_width, + bytes_per_row, num_blocks_y, memory_stride, src_rect, scale_by_half); } } } |
