zzogl: align_16 array before sse2 instruction + minor stuff

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4263 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2011-01-25 19:29:08 +00:00
parent 1b209e265b
commit 2d38e89194
2 changed files with 14 additions and 11 deletions

View File

@ -502,8 +502,8 @@ template <>
u16* clut = (u16*)GetClutBufferAddress<u32>(csa); // Keep aligned version for sse2
// which side to copy
u32 clutsize_right;
u32 clutsize_left;
s32 clutsize_right;
s32 clutsize_left;
if (csa < 16) {
clutsize_right = min(clutsize, (16-csa)*64);
clutsize_left = clutsize - clutsize_right;
@ -582,7 +582,7 @@ template <>
#else
// Note +1 because we change higher 16 bits
for(int i = 0; i < 16; ++i)
dst[i] = clut[2*i];
dst[i] = clut[2*i+1];
#endif
dst += 16;

View File

@ -722,27 +722,30 @@ inline void FlushDecodeClut(VB& curvb, GLuint& ptexclut)
{
glGenTextures(1, &ptexclut);
glBindTexture(GL_TEXTURE_2D, ptexclut);
vector<char> data(PSMT_ISHALF_STORAGE(curvb.tex0) ? 512 : 1024);
if (ptexclut != 0)
{
int clutsize;
int entries = PSMT_IS8CLUT(curvb.tex0.psm) ? 256 : 16;
if (curvb.tex0.csm && curvb.tex0.csa)
ZZLog::Debug_Log("ERROR, csm1.");
if (curvb.tex0.csm && curvb.tex0.csa) ZZLog::Debug_Log("ERROR, csm1.");
if (PSMT_IS32BIT(curvb.tex0.cpsm)) {
__aligned16 u32 data[256];
clutsize = min(entries, 256 - curvb.tex0.csa * 16) * 4;
ClutBuffer_to_Array<u32>((u32*)&data[0], curvb.tex0.csa, clutsize);
ClutBuffer_to_Array<u32>((u32*)data, curvb.tex0.csa, clutsize);
Texture2D(4, 256, 1, GL_RGBA, GL_UNSIGNED_BYTE, data);
} else {
__aligned16 u16 data[256];
clutsize = min(entries, 512 - curvb.tex0.csa * 16) * 2;
ClutBuffer_to_Array<u16>((u16*)&data[0], curvb.tex0.csa, clutsize);
ClutBuffer_to_Array<u16>((u16*)data, curvb.tex0.csa, clutsize);
Texture2D(4, 256, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, data);
}
GLenum tempType = PSMT_ISHALF_STORAGE(curvb.tex0) ? GL_UNSIGNED_SHORT_5_5_5_1 : GL_UNSIGNED_BYTE;
Texture2D(4, 256, 1, GL_RGBA, tempType, &data[0]);
s_vecTempTextures.push_back(ptexclut);
if (g_bSaveTex) SaveTexture("clut.tga", GL_TEXTURE_2D, ptexclut, 256, 1);