From dbd37e2667331ca1bc42bd0a23b39cecf7127f80 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut@gmail.com" Date: Sun, 17 Oct 2010 16:10:01 +0000 Subject: [PATCH] GregMiscellaneous: zzogl-pg: * minor clean git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3932 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/targets.cpp | 38 ++++++++++++----------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/plugins/zzogl-pg/opengl/targets.cpp b/plugins/zzogl-pg/opengl/targets.cpp index da06c8137b..10d8a435a3 100644 --- a/plugins/zzogl-pg/opengl/targets.cpp +++ b/plugins/zzogl-pg/opengl/targets.cpp @@ -1939,21 +1939,6 @@ CMemoryTarget* CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forc 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*)&targ->clut[0], (u32*)(g_pbyGSClut + nClutOffset), clutsize); - else - ClutBuffer_to_Array((u16*)&targ->clut[0], (u16*)(g_pbyGSClut + nClutOffset), clutsize); - } - if (targ->ptex != NULL) { 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)) { + 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); has_data = true; u8* psrc = (u8*)(MemoryAddress(targ->realy)); + // Fill a local clut then build the real texture if (PSMT_IS32BIT(tex0.cpsm)) { u32* pclut = (u32*) & targ->clut[0]; - u32* pdst = (u32*)ptexdata; - - Build_Clut_Texture(tex0.psm, targ->height, pclut, psrc, pdst); + ClutBuffer_to_Array(pclut, (u32*)(g_pbyGSClut + nClutOffset), clutsize); + Build_Clut_Texture(tex0.psm, targ->height, pclut, psrc, (u32*)ptexdata); } else { u16* pclut = (u16*) & targ->clut[0]; - u16* pdst = (u16*)ptexdata; - - Build_Clut_Texture(tex0.psm, targ->height, pclut, psrc, pdst); + ClutBuffer_to_Array(pclut, (u16*)(g_pbyGSClut + nClutOffset), clutsize); + Build_Clut_Texture(tex0.psm, targ->height, pclut, psrc, (u16*)ptexdata); } + + assert(targ->clut.size() > 0); } else { @@ -2150,8 +2144,6 @@ CMemoryTarget* CMemoryTargetMngr::GetMemoryTarget(const tex0Info& tex0, int forc assert(tex0.psm != 0xd); - if (PSMT_ISCLUT(tex0.psm)) assert(targ->clut.size() > 0); - return targ; }