zzogl-pg: use the red channel instead of the alpha channel for the block data. Alpha channel isn't supported (normally) in OGL3 and later.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5578 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2013-02-28 18:24:27 +00:00
parent d438ac3d0c
commit 2157fb4907
5 changed files with 22 additions and 20 deletions

View File

@ -417,7 +417,7 @@ void LoadglFunctions()
inline bool TryBlockFormat(GLint fmt, const GLvoid* vBlockData) {
g_internalFloatFmt = fmt;
glTexImage2D(GL_TEXTURE_2D, 0, g_internalFloatFmt, BLOCK_TEXWIDTH, BLOCK_TEXHEIGHT, 0, GL_ALPHA, GL_FLOAT, vBlockData);
glTexImage2D(GL_TEXTURE_2D, 0, g_internalFloatFmt, BLOCK_TEXWIDTH, BLOCK_TEXHEIGHT, 0, GL_RED, GL_FLOAT, vBlockData);
return (glGetError() == GL_NO_ERROR);
}
@ -611,8 +611,10 @@ bool ZZCreate(int _width, int _height)
// We store block data on u16 rather float numbers. It's not so preciese, but ALPHA16 is OpenGL 2.0 standart
// and use only 16 bit. Old zerogs use red channel, but it does not work.
// Note: GL_ALPHA was dropped in GL3.0 in favor of GL_RED ... Time to upgrade -- gregory
glTexImage2D(GL_TEXTURE_2D, 0, g_internalFloatFmt, BLOCK_TEXWIDTH, BLOCK_TEXHEIGHT, 0, GL_ALPHA, GL_UNSIGNED_SHORT, &vBlockData[0]);
glTexImage2D(GL_TEXTURE_2D, 0, g_internalFloatFmt, BLOCK_TEXWIDTH, BLOCK_TEXHEIGHT, 0, GL_RED, GL_UNSIGNED_SHORT, &vBlockData[0]);
if( glGetError() != GL_NO_ERROR ) {
ZZLog::Error_Log("ZZogl ERROR: could not fill blocks");
return false;

Binary file not shown.

View File

@ -96,7 +96,7 @@ float2 ps2memcoord(float2 realtex)
off.xy = realtex.xy-fblock.xy;
#ifdef ACCURATE_DECOMPRESSION
off.zw = tex2D(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).ar;
off.z = tex2D(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).r;
off.x = dot(off.xy, g_fTexOffset.xy);
float r = g_fTexOffset.w;
float f = frac(off.x);
@ -105,7 +105,7 @@ float2 ps2memcoord(float2 realtex)
off.x = frac(f + fadd + r);
off.w -= off.x ;
#else
off.z = tex2D(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).a;
off.z = tex2D(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).r;
// combine the two
off.x = dot(off.xyz, g_fTexOffset.xyz)+g_fTexOffset.w;
@ -135,10 +135,10 @@ void ps2memcoord4(float4 orgtex, out float4 off0, out float4 off1)
float4 colors;// = tex2D(g_sBilinearBlocks, ftransblock.xy);
// this is faster on ffx ingame
colors.x = tex2D(g_sBlocks, ftransblock.xy).a;
colors.y = tex2D(g_sBlocks, ftransblock.zy).a;
colors.z = tex2D(g_sBlocks, ftransblock.xw).a;
colors.w = tex2D(g_sBlocks, ftransblock.zw).a;
colors.x = tex2D(g_sBlocks, ftransblock.xy).r;
colors.y = tex2D(g_sBlocks, ftransblock.zy).r;
colors.z = tex2D(g_sBlocks, ftransblock.xw).r;
colors.w = tex2D(g_sBlocks, ftransblock.zw).r;
float4 fr, rem;

View File

@ -141,7 +141,7 @@ float2 ps2memcoord(float2 realtex)
off.xy = realtex.xy-fblock.xy;
#ifdef ACCURATE_DECOMPRESSION
off.zw = texture(g_sBlocks, g_fTexBlock[CTX].xy*fblock + g_fTexBlock[CTX].zw).ar;
off.z = texture(g_sBlocks, g_fTexBlock[CTX].xy*fblock + g_fTexBlock[CTX].zw).r;
off.x = dot(off.xy, g_fTexOffset[CTX].xy);
float r = g_fTexOffset[CTX].w;
float f = fract(off.x);
@ -150,7 +150,7 @@ float2 ps2memcoord(float2 realtex)
off.x = fract(f + fadd + r);
off.w -= off.x ;
#else
off.z = texture(g_sBlocks, g_fTexBlock[CTX].xy*fblock + g_fTexBlock[CTX].zw).a;
off.z = texture(g_sBlocks, g_fTexBlock[CTX].xy*fblock + g_fTexBlock[CTX].zw).r;
// combine the two
off.x = dot(off.xyz, g_fTexOffset[CTX].xyz)+g_fTexOffset[CTX].w;
@ -180,10 +180,10 @@ void ps2memcoord4(float4 orgtex, out float4 off0, out float4 off1)
float4 colors;// = texture(g_sBilinearBlocks, ftransblock.xy);
// this is faster on ffx ingame
colors.x = texture(g_sBlocks, ftransblock.xy).a;
colors.y = texture(g_sBlocks, ftransblock.zy).a;
colors.z = texture(g_sBlocks, ftransblock.xw).a;
colors.w = texture(g_sBlocks, ftransblock.zw).a;
colors.x = texture(g_sBlocks, ftransblock.xy).r;
colors.y = texture(g_sBlocks, ftransblock.zy).r;
colors.z = texture(g_sBlocks, ftransblock.xw).r;
colors.w = texture(g_sBlocks, ftransblock.zw).r;
float4 fr, rem;

View File

@ -193,7 +193,7 @@ float2 ps2memcoord(float2 realtex)
off.xy = realtex.xy-fblock.xy;
#ifdef ACCURATE_DECOMPRESSION
off.zw = texture(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).ar;
off.z = texture(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).r;
off.x = dot(off.xy, g_fTexOffset.xy);
float r = g_fTexOffset.w;
float f = fract(off.x);
@ -202,7 +202,7 @@ float2 ps2memcoord(float2 realtex)
off.x = fract(f + fadd + r);
off.w -= off.x ;
#else
off.z = texture(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).a;
off.z = texture(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).r;
// combine the two
off.x = dot(off.xyz, g_fTexOffset.xyz)+g_fTexOffset.w;
@ -232,10 +232,10 @@ void ps2memcoord4(float4 orgtex, out float4 off0, out float4 off1)
float4 colors;// = texture(g_sBilinearBlocks, ftransblock.xy);
// this is faster on ffx ingame
colors.x = texture(g_sBlocks, ftransblock.xy).a;
colors.y = texture(g_sBlocks, ftransblock.zy).a;
colors.z = texture(g_sBlocks, ftransblock.xw).a;
colors.w = texture(g_sBlocks, ftransblock.zw).a;
colors.x = texture(g_sBlocks, ftransblock.xy).r;
colors.y = texture(g_sBlocks, ftransblock.zy).r;
colors.z = texture(g_sBlocks, ftransblock.xw).r;
colors.w = texture(g_sBlocks, ftransblock.zw).r;
float4 fr, rem;