GregMiscellaneous: zzogl-pg:

* minor clean


git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3932 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2010-10-17 16:10:01 +00:00
parent 97cd280684
commit dbd37e2667
1 changed files with 15 additions and 23 deletions

View File

@ -1939,21 +1939,6 @@ CMemoryTarget* CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forc
targ = ClearedTargetsSearch(fmt, widthmult, channels, end - start); targ = ClearedTargetsSearch(fmt, widthmult, channels, end - start);
// fill local clut
if (PSMT_ISCLUT(tex0.psm))
{
assert(clutsize > 0);
targ->cpsm = tex0.cpsm;
targ->clut.reserve(256*4); // no matter what
targ->clut.resize(clutsize);
if (PSMT_IS32BIT(tex0.cpsm))
ClutBuffer_to_Array<u32>((u32*)&targ->clut[0], (u32*)(g_pbyGSClut + nClutOffset), clutsize);
else
ClutBuffer_to_Array<u16>((u16*)&targ->clut[0], (u16*)(g_pbyGSClut + nClutOffset), clutsize);
}
if (targ->ptex != NULL) if (targ->ptex != NULL)
{ {
assert(end - start <= targ->realheight && targ->fmt == fmt && targ->widthmult == widthmult); assert(end - start <= targ->realheight && targ->fmt == fmt && targ->widthmult == widthmult);
@ -2000,25 +1985,34 @@ CMemoryTarget* CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forc
if (PSMT_ISCLUT(tex0.psm)) if (PSMT_ISCLUT(tex0.psm))
{ {
assert(clutsize > 0);
// Local clut parameter
targ->cpsm = tex0.cpsm;
targ->clut.reserve(256*4); // no matter what
targ->clut.resize(clutsize);
// texture parameter
ptexdata = (u8*)_aligned_malloc(CLUT_PIXEL_SIZE(tex0.cpsm) * targ->texH * targ->texW, 16); ptexdata = (u8*)_aligned_malloc(CLUT_PIXEL_SIZE(tex0.cpsm) * targ->texH * targ->texW, 16);
has_data = true; has_data = true;
u8* psrc = (u8*)(MemoryAddress(targ->realy)); u8* psrc = (u8*)(MemoryAddress(targ->realy));
// Fill a local clut then build the real texture
if (PSMT_IS32BIT(tex0.cpsm)) if (PSMT_IS32BIT(tex0.cpsm))
{ {
u32* pclut = (u32*) & targ->clut[0]; u32* pclut = (u32*) & targ->clut[0];
u32* pdst = (u32*)ptexdata; ClutBuffer_to_Array<u32>(pclut, (u32*)(g_pbyGSClut + nClutOffset), clutsize);
Build_Clut_Texture<u32>(tex0.psm, targ->height, pclut, psrc, (u32*)ptexdata);
Build_Clut_Texture<u32>(tex0.psm, targ->height, pclut, psrc, pdst);
} }
else else
{ {
u16* pclut = (u16*) & targ->clut[0]; u16* pclut = (u16*) & targ->clut[0];
u16* pdst = (u16*)ptexdata; ClutBuffer_to_Array<u16>(pclut, (u16*)(g_pbyGSClut + nClutOffset), clutsize);
Build_Clut_Texture<u16>(tex0.psm, targ->height, pclut, psrc, (u16*)ptexdata);
Build_Clut_Texture<u16>(tex0.psm, targ->height, pclut, psrc, pdst);
} }
assert(targ->clut.size() > 0);
} }
else else
{ {
@ -2150,8 +2144,6 @@ CMemoryTarget* CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forc
assert(tex0.psm != 0xd); assert(tex0.psm != 0xd);
if (PSMT_ISCLUT(tex0.psm)) assert(targ->clut.size() > 0);
return targ; return targ;
} }