Cleanup and unify handling of efb copy stride.

This commit is contained in:
Scott Mansell
2015-09-01 02:41:16 +12:00
parent a47bbee02a
commit 52948bb3ef
12 changed files with 26 additions and 37 deletions

View File

@ -87,7 +87,7 @@ void PSTextureEncoder::Shutdown()
SAFE_RELEASE(m_out);
}
size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat, size_t dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf)
{
@ -189,13 +189,13 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
for (unsigned int y = 0; y < numBlocksY; ++y)
{
memcpy(dst, src, cacheLinesPerRow*32);
dst += bpmem.copyMipMapStrideChannels*32;
dst += dstStride;
src += map.RowPitch;
}
D3D::context->Unmap(m_outStage, 0);
encodeSize = bpmem.copyMipMapStrideChannels*32 * numBlocksY;
encodeSize = dstStride * numBlocksY;
}
// Restore API

View File

@ -29,7 +29,7 @@ public:
void Init();
void Shutdown();
size_t Encode(u8* dst, unsigned int dstFormat,
size_t Encode(u8* dst, unsigned int dstFormat, size_t dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf);

View File

@ -185,7 +185,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntryConf
}
}
void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat)
@ -238,7 +238,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
if (!g_ActiveConfig.bSkipEFBCopyToRam)
{
u8* dst = Memory::GetPointer(dstAddr);
size_t encoded_size = g_encoder->Encode(dst, dstFormat, srcFormat, srcRect, isIntensity, scaleByHalf);
size_t encoded_size = g_encoder->Encode(dst, dstFormat, dstStride, srcFormat, srcRect, isIntensity, scaleByHalf);
size_in_bytes = (u32)encoded_size;

View File

@ -34,7 +34,7 @@ private:
void Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int levels) override;
void FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) override;

View File

@ -111,7 +111,7 @@ public:
virtual void Init() = 0;
virtual void Shutdown() = 0;
// Returns size in bytes of encoded block of memory
virtual size_t Encode(u8* dst, unsigned int dstFormat,
virtual size_t Encode(u8* dst, unsigned int dstFormat, size_t dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf) = 0;

View File

@ -213,7 +213,7 @@ void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
TextureCache::SetStage();
}
void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat)
@ -272,7 +272,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
dstFormat,
scaleByHalf,
srcRect,
copyMipMapStrideChannels * 32);
dstStride);
u8* dst = Memory::GetPointer(dstAddr);
u64 const new_hash = GetHash64(dst,encoded_size,g_ActiveConfig.iSafeTextureCache_ColorSamples);

View File

@ -41,7 +41,7 @@ private:
void Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level) override;
void FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, u32 dstStride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) override;