mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
TextureCache: Implement deferred/batched EFB copies
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user