Texture Handler: Use the new TextureStore::Load() method instead of calling TextureStore::Unpack() directly.

This commit is contained in:
rogerman 2016-11-26 19:55:52 -08:00
parent 41e9b1680e
commit 0a4635eb5b
6 changed files with 19 additions and 5 deletions

View File

@ -2981,7 +2981,7 @@ Render3DError OpenGLRenderer_1_2::SetupTexture(const POLY &thePoly, bool enableT
if (theTexture->IsLoadNeeded())
{
theTexture->Unpack<TexFormat_32bpp>((u32 *)this->_workingTextureUnpackBuffer);
theTexture->Load(this->_workingTextureUnpackBuffer);
const u32 *textureSrc = (u32 *)this->_workingTextureUnpackBuffer;
size_t texWidth = theTexture->GetWidth();
@ -4647,7 +4647,7 @@ Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, bool enableT
if (theTexture->IsLoadNeeded())
{
theTexture->Unpack<TexFormat_32bpp>((u32 *)this->_workingTextureUnpackBuffer);
theTexture->Load(this->_workingTextureUnpackBuffer);
const u32 *textureSrc = (u32 *)this->_workingTextureUnpackBuffer;
size_t texWidth = theTexture->GetWidth();

View File

@ -1708,7 +1708,7 @@ Render3DError OpenGLRenderer_3_2::SetupTexture(const POLY &thePoly, bool enableT
if (theTexture->IsLoadNeeded())
{
theTexture->Unpack<TexFormat_32bpp>((u32 *)this->_workingTextureUnpackBuffer);
theTexture->Load(this->_workingTextureUnpackBuffer);
const u32 *textureSrc = (u32 *)this->_workingTextureUnpackBuffer;
const NDSTextureFormat packFormat = theTexture->GetPackFormat();

View File

@ -1170,6 +1170,11 @@ SoftRasterizerTexture::~SoftRasterizerTexture()
free_aligned(this->_unpackData);
}
void SoftRasterizerTexture::Load(void *targetBuffer)
{
this->Unpack<TexFormat_15bpp>((u32 *)targetBuffer);
}
u32* SoftRasterizerTexture::GetUnpackData()
{
return this->_unpackData;
@ -1436,7 +1441,7 @@ void SoftRasterizerRenderer::setupTextures()
if (lastTexItem->IsLoadNeeded())
{
lastTexItem->Unpack<TexFormat_15bpp>(lastTexItem->GetUnpackData());
lastTexItem->Load(lastTexItem->GetUnpackData());
}
for (size_t i = 0; i < this->_clippedPolyCount; i++)
@ -1459,7 +1464,7 @@ void SoftRasterizerRenderer::setupTextures()
if (lastTexItem->IsLoadNeeded())
{
lastTexItem->Unpack<TexFormat_15bpp>(lastTexItem->GetUnpackData());
lastTexItem->Load(lastTexItem->GetUnpackData());
}
lastTexParams = thePoly.texParam;

View File

@ -54,6 +54,8 @@ public:
SoftRasterizerTexture(u32 texAttributes, u32 palAttributes);
virtual ~SoftRasterizerTexture();
virtual void Load(void *targetBuffer);
u32* GetUnpackData();
u32 GetRenderWidth() const;
u32 GetRenderHeight() const;

View File

@ -655,6 +655,11 @@ void TextureStore::Unpack(u32 *unpackBuffer)
this->_isLoadNeeded = false;
}
void TextureStore::Load(void *targetBuffer)
{
this->Unpack<TexFormat_32bpp>((u32 *)targetBuffer);
}
bool TextureStore::IsSuspectedInvalid() const
{
return this->_suspectedInvalid;

View File

@ -149,6 +149,8 @@ public:
size_t GetUnpackSizeUsingFormat(const TextureStoreUnpackFormat texCacheFormat) const;
template<TextureStoreUnpackFormat TEXCACHEFORMAT> void Unpack(u32 *unpackBuffer);
virtual void Load(void *targetBuffer);
bool IsSuspectedInvalid() const;
void SetSuspectedInvalid();