TextureCache: Split efb2ram from efb2tex
This commit is contained in:
parent
d7d8704353
commit
dcdf8fd3ce
|
@ -236,11 +236,13 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, unsigned int dstFormat
|
||||||
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
|
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
|
||||||
|
|
||||||
g_renderer->RestoreAPIState();
|
g_renderer->RestoreAPIState();
|
||||||
|
}
|
||||||
|
|
||||||
if (g_ActiveConfig.bSkipEFBCopyToRam)
|
void TextureCache::CopyEFB(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
|
||||||
this->Zero(dst);
|
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||||
else
|
bool isIntensity, bool scaleByHalf)
|
||||||
g_encoder->Encode(dst, format, native_width, BytesPerRow(), NumBlocksY(), memory_stride, srcFormat, srcRect, isIntensity, scaleByHalf);
|
{
|
||||||
|
g_encoder->Encode(dst, format, native_width, bytes_per_row, num_blocks_y, memory_stride, srcFormat, srcRect, isIntensity, scaleByHalf);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char palette_shader[] =
|
const char palette_shader[] =
|
||||||
|
|
|
@ -49,6 +49,10 @@ private:
|
||||||
|
|
||||||
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette, TlutFormat format) override;
|
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette, TlutFormat format) override;
|
||||||
|
|
||||||
|
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) override;
|
||||||
|
|
||||||
void CompileShaders() override { }
|
void CompileShaders() override { }
|
||||||
void DeleteShaders() override { }
|
void DeleteShaders() override { }
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual void Shutdown() = 0;
|
virtual void Shutdown() = 0;
|
||||||
// Returns size in bytes of encoded block of memory
|
// Returns size in bytes of encoded block of memory
|
||||||
virtual void Encode(u8* dst, const TextureCacheBase::TCacheEntryBase* texture_entry,
|
virtual void Encode(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
|
||||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||||
bool isIntensity, bool scaleByHalf) = 0;
|
bool isIntensity, bool scaleByHalf) = 0;
|
||||||
|
|
||||||
|
|
|
@ -266,26 +266,24 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, unsigned int ds
|
||||||
|
|
||||||
FramebufferManager::SetFramebuffer(0);
|
FramebufferManager::SetFramebuffer(0);
|
||||||
g_renderer->RestoreAPIState();
|
g_renderer->RestoreAPIState();
|
||||||
|
|
||||||
if (g_ActiveConfig.bSkipEFBCopyToRam)
|
|
||||||
{
|
|
||||||
this->Zero(dstPointer);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
void TextureCache::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)
|
||||||
{
|
{
|
||||||
TextureConverter::EncodeToRamFromTexture(
|
TextureConverter::EncodeToRamFromTexture(
|
||||||
dstPointer,
|
dst,
|
||||||
format,
|
format,
|
||||||
native_width,
|
native_width,
|
||||||
BytesPerRow(),
|
bytes_per_row,
|
||||||
NumBlocksY(),
|
num_blocks_y,
|
||||||
memory_stride,
|
memory_stride,
|
||||||
srcFormat,
|
srcFormat,
|
||||||
isIntensity,
|
isIntensity,
|
||||||
scaleByHalf,
|
scaleByHalf,
|
||||||
srcRect);
|
srcRect);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TextureCache::TextureCache()
|
TextureCache::TextureCache()
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,10 @@ private:
|
||||||
TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) override;
|
TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) override;
|
||||||
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette, TlutFormat format) override;
|
void ConvertTexture(TCacheEntryBase* entry, TCacheEntryBase* unconverted, void* palette, TlutFormat format) override;
|
||||||
|
|
||||||
|
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) override;
|
||||||
|
|
||||||
void CompileShaders() override;
|
void CompileShaders() override;
|
||||||
void DeleteShaders() override;
|
void DeleteShaders() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1050,6 +1050,25 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
|
|
||||||
entry->FromRenderTarget(dst, dstFormat, dstStride, srcFormat, srcRect, isIntensity, scaleByHalf, cbufid, colmat);
|
entry->FromRenderTarget(dst, dstFormat, dstStride, srcFormat, srcRect, isIntensity, scaleByHalf, cbufid, colmat);
|
||||||
|
|
||||||
|
if (g_ActiveConfig.bSkipEFBCopyToRam)
|
||||||
|
{
|
||||||
|
entry->Zero(dst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_texture_cache->CopyEFB(
|
||||||
|
dst,
|
||||||
|
entry->format,
|
||||||
|
entry->native_width,
|
||||||
|
entry->BytesPerRow(),
|
||||||
|
entry->NumBlocksY(),
|
||||||
|
entry->memory_stride,
|
||||||
|
srcFormat,
|
||||||
|
srcRect,
|
||||||
|
isIntensity,
|
||||||
|
scaleByHalf);
|
||||||
|
}
|
||||||
|
|
||||||
u64 hash = entry->CalculateHash();
|
u64 hash = entry->CalculateHash();
|
||||||
entry->SetHashes(hash, hash);
|
entry->SetHashes(hash, hash);
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,10 @@ public:
|
||||||
|
|
||||||
virtual TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) = 0;
|
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;
|
||||||
|
|
||||||
virtual void CompileShaders() = 0; // currently only implemented by OGL
|
virtual void CompileShaders() = 0; // currently only implemented by OGL
|
||||||
virtual void DeleteShaders() = 0; // currently only implemented by OGL
|
virtual void DeleteShaders() = 0; // currently only implemented by OGL
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue