TextureCache: Extract BP enum check to VideoCommon.

We have TOO many video backends.
This commit is contained in:
degasus
2016-12-26 20:54:37 +01:00
parent d07d9ba499
commit 04f319066d
23 changed files with 112 additions and 135 deletions

View File

@ -227,9 +227,10 @@ static void BPWritten(const BPCmd& bp)
{
// bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer
// (Zbuffer uses 24-bit Format)
bool is_depth_copy = bpmem.zcontrol.pixel_format == PEControl::Z24;
g_texture_cache->CopyRenderTargetToTexture(destAddr, PE_copy.tp_realFormat(), destStride,
bpmem.zcontrol.pixel_format, srcRect,
!!PE_copy.intensity_fmt, !!PE_copy.half_scale);
is_depth_copy, srcRect, !!PE_copy.intensity_fmt,
!!PE_copy.half_scale);
}
else
{

View File

@ -862,9 +862,8 @@ TextureCacheBase::TCacheEntryBase* TextureCacheBase::Load(const u32 stage)
}
void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity,
bool scaleByHalf)
bool is_depth_copy, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf)
{
// Emulation methods:
//
@ -936,7 +935,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
unsigned int cbufid = -1;
bool efbHasAlpha = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
if (srcFormat == PEControl::Z24)
if (is_depth_copy)
{
switch (dstFormat)
{
@ -1240,7 +1239,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
if (copy_to_ram)
{
CopyEFB(dst, dstFormat, tex_w, bytes_per_row, num_blocks_y, dstStride, srcFormat, srcRect,
CopyEFB(dst, dstFormat, tex_w, bytes_per_row, num_blocks_y, dstStride, is_depth_copy, srcRect,
isIntensity, scaleByHalf);
}
else
@ -1321,7 +1320,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
entry->SetEfbCopy(dstStride);
entry->is_custom_tex = false;
entry->FromRenderTarget(dst, srcFormat, srcRect, scaleByHalf, cbufid, colmat);
entry->FromRenderTarget(dst, is_depth_copy, srcRect, scaleByHalf, cbufid, colmat);
u64 hash = entry->CalculateHash();
entry->SetHashes(hash, hash);

View File

@ -128,9 +128,8 @@ public:
const MathUtil::Rectangle<int>& dstrect) = 0;
virtual void Load(const u8* buffer, u32 width, u32 height, u32 expanded_width, u32 level) = 0;
virtual void FromRenderTarget(u8* dst, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool scaleByHalf,
unsigned int cbufid, const float* colmat) = 0;
virtual void FromRenderTarget(u8* dst, bool is_depth_copy, const EFBRectangle& srcRect,
bool scaleByHalf, unsigned int cbufid, const float* colmat) = 0;
bool OverlapsMemoryRange(u32 range_address, u32 range_size) const;
@ -154,8 +153,8 @@ public:
virtual TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) = 0;
virtual void CopyEFB(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y,
u32 memory_stride, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf) = 0;
u32 memory_stride, bool is_depth_copy, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf) = 0;
virtual bool CompileShaders() = 0;
virtual void DeleteShaders() = 0;
@ -164,8 +163,8 @@ public:
void UnbindTextures();
virtual void BindTextures();
void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf);
bool is_depth_copy, const EFBRectangle& srcRect, bool isIntensity,
bool scaleByHalf);
virtual void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette,
TlutFormat format) = 0;