1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Implement dump of background textures.

This commit is contained in:
Sergey Lipskiy 2019-02-19 12:49:05 +07:00
parent 15fa834ffa
commit 49465a094d
2 changed files with 15 additions and 5 deletions

View File

@ -730,7 +730,7 @@ void _updateCachedTexture(const GHQTexInfo & _info, CachedTexture *_pTexture, f3
_pTexture->bHDTexture = true;
}
bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture, u64 & _ricecrc)
{
if (!TFH.isInited())
return false;
@ -753,12 +753,12 @@ bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
// palette = (rdp.pal_8 + (gSP.textureTile[_t]->palette << 4));
}
u64 ricecrc = txfilter_checksum(addr, tile_width,
_ricecrc = txfilter_checksum(addr, tile_width,
tile_height, (unsigned short)(gSP.bgImage.format << 8 | gSP.bgImage.size),
bpl, paladdr);
GHQTexInfo ghqTexInfo;
// TODO: fix problem with zero texture dimensions on GLideNHQ side.
if (txfilter_hirestex(_pTexture->crc, ricecrc, palette, &ghqTexInfo) &&
if (txfilter_hirestex(_pTexture->crc, _ricecrc, palette, &ghqTexInfo) &&
ghqTexInfo.width != 0 && ghqTexInfo.height != 0) {
ghqTexInfo.format = gfxContext.convertInternalTextureFormat(ghqTexInfo.format);
Context::InitTextureParams params;
@ -782,7 +782,8 @@ bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
void TextureCache::_loadBackground(CachedTexture *pTexture)
{
if (_loadHiresBackground(pTexture))
u64 ricecrc = 0;
if (_loadHiresBackground(pTexture, ricecrc))
return;
u32 *pDest = nullptr;
@ -850,6 +851,15 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
return;
}
if (m_toggleDumpTex &&
config.textureFilter.txHiresEnable != 0 &&
config.textureFilter.txDump != 0) {
txfilter_dmptx((u8*)pDest, pTexture->realWidth, pTexture->realHeight,
pTexture->realWidth, (u16)u32(glInternalFormat),
(unsigned short)(pTexture->format << 8 | pTexture->size),
ricecrc);
}
bool bLoaded = false;
if ((config.textureFilter.txEnhancementMode | config.textureFilter.txFilterMode) != 0 &&
config.textureFilter.txFilterIgnoreBG == 0 &&

View File

@ -82,7 +82,7 @@ private:
void _load(u32 _tile, CachedTexture *_pTexture);
bool _loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 & _ricecrc);
void _loadBackground(CachedTexture *pTexture);
bool _loadHiresBackground(CachedTexture *_pTexture);
bool _loadHiresBackground(CachedTexture *_pTexture, u64 & _ricecrc);
void _loadDepthTexture(CachedTexture * _pTexture, u16* _pDest);
void _updateBackground();
void _clear();