summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorRodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com>2009-12-07 18:48:31 +0000
committerRodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com>2009-12-07 18:48:31 +0000
commitd02426a8e9c6a0815e033aa48a9506151aaf5c86 (patch)
treef65d4098b99366ccd2cdcc974b052fc36acc72ee /Source/Core/VideoCommon
parent85a9b3dc2c51a08911c48ff9741b378336081a93 (diff)
mixed commit:
in D3D and Opengl: fixed one nasty bug in texture loading where if a dynamic texture keeps his format but the tlut format is changed, the try or reloading the texture in the same texture could cause a hang if the size of the resulting texture is different than the original (size in bytes) Applied a ugly temporal hack to the texture conversor to solve efb to ram misalignments and effect distortions. in D3D: Pseudo implementation of logic ops using basic blending: the first 8 operations are "good approximations", the remaining 8 are bullshit :) if someone have a better approximation to emulate this logic please let me know. please test if i don't break anything in the process and test Mario kart wee you will get a nice surprise.:) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4656 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp31
-rw-r--r--Source/Core/VideoCommon/Src/TextureConversionShader.cpp25
-rw-r--r--Source/Core/VideoCommon/Src/TextureDecoder.cpp292
-rw-r--r--Source/Core/VideoCommon/Src/TextureDecoder.h4
4 files changed, 324 insertions, 28 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 439400e347..1249011538 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -545,7 +545,7 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, u32 HLSL)
// alpha test will always fail, so restart the shader and just make it an empty function
p = pmainstart;
WRITE(p, "ocol0 = 0;\n");
- WRITE(p, HLSL ? "clip(-1);" : "discard;\n");
+ WRITE(p, "discard;return;\n");
}
else
{
@@ -582,9 +582,9 @@ static const char *TEVCMPColorOPTable[16] =
"float3(0.0f,0.0f,0.0f)",//7
" %s + ((%s.r > %s.r + (1.0f/510.0f)) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_R8_GT 8
" %s + ((abs(%s.r - %s.r) < (1.0f/255.0f)) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_R8_EQ 9
- " %s + (( dot(%s.rgb, comp16) >= (dot(%s.rgb, comp16) + (1.0f/510.0f))) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_GR16_GT 10
+ " %s + (( dot(%s.rgb, comp16) > (dot(%s.rgb, comp16) + (1.0f/510.0f))) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_GR16_GT 10
" %s + (abs(dot(%s.rgb, comp16) - dot(%s.rgb, comp16)) < (1.0f/255.0f) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_GR16_EQ 11
- " %s + (( dot(%s.rgb, comp24) >= (dot(%s.rgb, comp24) + (1.0f/510.0f))) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_BGR24_GT 12
+ " %s + (( dot(%s.rgb, comp24) > (dot(%s.rgb, comp24) + (1.0f/510.0f))) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_BGR24_GT 12
" %s + (abs(dot(%s.rgb, comp24) - dot(%s.rgb, comp24)) < (1.0f/255.0f) ? %s : float3(0.0f,0.0f,0.0f))",//#define TEVCMP_BGR24_EQ 13
" %s + (max(sign(%s.rgb - %s.rgb - (1.0f/510.0f)),float3(0.0f,0.0f,0.0f)) * %s)",//#define TEVCMP_RGB8_GT 14
" %s + ((float3(1.0f,1.0f,1.0f) - max(sign(abs(%s.rgb - %s.rgb) - (1.0f/255.0f)),float3(0.0f,0.0f,0.0f))) * %s)"//#define TEVCMP_RGB8_EQ 15
@@ -601,13 +601,13 @@ static const char *TEVCMPAlphaOPTable[16] =
"0.0f",//5
"0.0f",//6
"0.0f",//7
- " %s + ((%s.r >= (%s.r + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_R8_GT 8
+ " %s + ((%s.r > (%s.r + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_R8_GT 8
" %s + (abs(%s.r - %s.r) < (1.0f/255.0f) ? %s : 0.0f)",//#define TEVCMP_R8_EQ 9
- " %s + ((dot(%s.rgb, comp16) >= (dot(%s.rgb, comp16) + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_GR16_GT 10
+ " %s + ((dot(%s.rgb, comp16) > (dot(%s.rgb, comp16) + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_GR16_GT 10
" %s + (abs(dot(%s.rgb, comp16) - dot(%s.rgb, comp16)) < (1.0f/255.0f) ? %s : 0.0f)",//#define TEVCMP_GR16_EQ 11
- " %s + ((dot(%s.rgb, comp24) >= (dot(%s.rgb, comp24) + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_BGR24_GT 12
+ " %s + ((dot(%s.rgb, comp24) > (dot(%s.rgb, comp24) + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_BGR24_GT 12
" %s + (abs(dot(%s.rgb, comp24) - dot(%s.rgb, comp24)) < (1.0f/255.0f) ? %s : 0.0f)",//#define TEVCMP_BGR24_EQ 13
- " %s + ((%s.a >= (%s.a + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_A8_GT 14
+ " %s + ((%s.a > (%s.a + (1.0f/510.0f))) ? %s : 0.0f)",//#define TEVCMP_A8_GT 14
" %s + (abs(%s.a - %s.a) < (1.0f/255.0f) ? %s : 0.0f)"//#define TEVCMP_A8_EQ 15
};
@@ -862,6 +862,8 @@ static const char *tevAlphaFuncsTable[] =
"(true)" //ALPHACMP_ALWAYS 7
};
+
+
static const char *tevAlphaFunclogicTable[] =
{
" && ", // and
@@ -903,10 +905,7 @@ static bool WriteAlphaTest(char *&p, u32 HLSL)
// Seems we need discard for Cg and clip for d3d. sigh.
- if (HLSL)
- WRITE(p, "clip( (");
- else
- WRITE(p, "discard(!( ");
+ WRITE(p, "if(!( ");
int compindex = bpmem.alphaFunc.comp0 % 8;
WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[0]);//lookup the first component from the alpha function table
@@ -916,12 +915,8 @@ static bool WriteAlphaTest(char *&p, u32 HLSL)
compindex = bpmem.alphaFunc.comp1 % 8;
WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table
- if (HLSL) {
- // clip works differently than discard - discard takes a bool, clip takes a value that kills the pixel on negative
- WRITE(p, ") ? 1 : -1);\n");
- } else {
- WRITE(p, "));\n");
- }
+ WRITE(p, ")){ocol0 = 0;discard;return;}\n");
+
return true;
}
@@ -967,6 +962,6 @@ static void WriteFog(char *&p)
WARN_LOG(VIDEO, "Unknown Fog Type! %08x", bpmem.fog.c_proj_fsel.fsel);
}
- WRITE(p, " prev.rgb = (1.0f - fog) * prev.rgb + (fog * "I_FOG"[0].rgb);\n");
+ WRITE(p, " prev.rgb = lerp(prev.rgb,"I_FOG"[0].rgb,fog);\n");
}
diff --git a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
index 4db14bdeaa..eb6b83e234 100644
--- a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
+++ b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp
@@ -107,12 +107,16 @@ void WriteSwizzler(char*& p, u32 format,bool HLSL)
if(!HLSL)
WRITE(p," sampleUv.y = textureDims.y - sampleUv.y;\n");
- WRITE(p, " sampleUv.x = sampleUv.x + textureDims.z;\n"
- " sampleUv.y = sampleUv.y + textureDims.w;\n");
+ WRITE(p, " sampleUv = sampleUv + textureDims.zw;\n");
+
if(HLSL)
{
- WRITE(p, " sampleUv.x = sampleUv.x / blkDims.z;\n"
- " sampleUv.y = sampleUv.y / blkDims.w;\n");
+ WRITE(p, " sampleUv = sampleUv + float2(1.0f,1.0f);\n"
+ " sampleUv = sampleUv / blkDims.zw;\n");
+ }
+ else
+ {
+ WRITE(p, " sampleUv = sampleUv + float2(1.0f,-1.0f);\n");
}
}
@@ -158,15 +162,18 @@ void Write32BitSwizzler(char*& p, u32 format, bool HLSL)
WRITE(p, " sampleUv = sampleUv * blkDims.xy;\n");
if(!HLSL)
- WRITE(p, " sampleUv.y = textureDims.y - sampleUv.y;\n");
+ WRITE(p," sampleUv.y = textureDims.y - sampleUv.y;\n");
- WRITE(p, " sampleUv.x = sampleUv.x + textureDims.z;\n");
- WRITE(p, " sampleUv.y = sampleUv.y + textureDims.w;\n");
+ WRITE(p, " sampleUv = sampleUv + textureDims.zw;\n");
if(HLSL)
{
- WRITE(p, " sampleUv.x = sampleUv.x / blkDims.z;\n"
- " sampleUv.y = sampleUv.y / blkDims.w;\n");
+ WRITE(p, " sampleUv = sampleUv + float2(1.0f,1.0f);\n"
+ " sampleUv = sampleUv / blkDims.zw;\n");
+ }
+ else
+ {
+ WRITE(p, " sampleUv = sampleUv + float2(1.0f,-1.0f);\n");
}
}
diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp
index bbed1cc3cf..01d1c50d4c 100644
--- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp
+++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp
@@ -418,6 +418,219 @@ static PC_TexFormat GetPCFormatFromTLUTFormat(int tlutfmt)
return PC_TEX_FMT_NONE; // Error
}
+PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt)
+{
+ switch (texformat)
+ {
+ case GX_TF_C4:
+ return GetPCFormatFromTLUTFormat(tlutfmt);
+ case GX_TF_I4:
+ return PC_TEX_FMT_I4_AS_I8;
+ case GX_TF_I8: // speed critical
+ return PC_TEX_FMT_I8;
+ case GX_TF_C8:
+ return GetPCFormatFromTLUTFormat(tlutfmt);
+ case GX_TF_IA4:
+ return PC_TEX_FMT_IA4_AS_IA8;
+ case GX_TF_IA8:
+ return PC_TEX_FMT_IA8;
+ case GX_TF_C14X2:
+ return GetPCFormatFromTLUTFormat(tlutfmt);
+ case GX_TF_RGB565:
+ return PC_TEX_FMT_RGB565;
+ case GX_TF_RGB5A3:
+ return PC_TEX_FMT_BGRA32;
+ case GX_TF_RGBA8: // speed critical
+ return PC_TEX_FMT_BGRA32;
+ case GX_TF_CMPR: // speed critical
+ // The metroid games use this format almost exclusively.
+ {
+ return PC_TEX_FMT_BGRA32;
+ }
+ }
+
+ // The "copy" texture formats, too?
+ return PC_TEX_FMT_NONE;
+}
+
+
+PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int height,int Pitch, int texformat, int tlutaddr, int tlutfmt)
+{
+ switch (texformat)
+ {
+ case GX_TF_C4:
+ if (tlutfmt == 2)
+ {
+ // Special decoding is required for TLUT format 5A3
+ for (int y = 0; y < height; y += 8)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 8; iy++, src += 4)
+ decodebytesC4_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src, tlutaddr);
+ }
+ else
+ {
+ for (int y = 0; y < height; y += 8)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 8; iy++, src += 4)
+ decodebytesC4_To_Raw16((u16*)dst + (y + iy) * width + x, src, tlutaddr);
+ }
+ return GetPCFormatFromTLUTFormat(tlutfmt);
+ case GX_TF_I4:
+ {
+ for (int y = 0; y < height; y += 8)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 8; iy++, src += 4)
+ for (int ix = 0; ix < 4; ix++)
+ {
+ int val = src[ix];
+ dst[(y + iy) * width + x + ix * 2] = Convert4To8(val >> 4);
+ dst[(y + iy) * width + x + ix * 2 + 1] = Convert4To8(val & 0xF);
+ }
+ }
+ return PC_TEX_FMT_I4_AS_I8;
+ case GX_TF_I8: // speed critical
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ memcpy(dst + (y + iy)*width+x, src, 8);
+ }
+ return PC_TEX_FMT_I8;
+ case GX_TF_C8:
+ if (tlutfmt == 2)
+ {
+ // Special decoding is required for TLUT format 5A3
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ decodebytesC8_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src, tlutaddr);
+ }
+ else
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ decodebytesC8_To_Raw16((u16*)dst + (y + iy) * width + x, src, tlutaddr);
+ }
+ return GetPCFormatFromTLUTFormat(tlutfmt);
+ case GX_TF_IA4:
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 8)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ decodebytesIA4((u16*)dst + (y + iy) * width + x, src);
+ }
+ return PC_TEX_FMT_IA4_AS_IA8;
+ case GX_TF_IA8:
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 4)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ {
+ u16 *ptr = (u16 *)dst + (y + iy) * width + x;
+ u16 *s = (u16 *)src;
+ for(int j = 0; j < 4; j++)
+ *ptr++ = Common::swap16(*s++);
+ }
+
+ }
+ return PC_TEX_FMT_IA8;
+ case GX_TF_C14X2:
+ if (tlutfmt == 2)
+ {
+ // Special decoding is required for TLUT format 5A3
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 4)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ decodebytesC14X2_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, (u16*)src, tlutaddr);
+ }
+ else
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 4)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ decodebytesC14X2_To_Raw16((u16*)dst + (y + iy) * width + x, (u16*)src, tlutaddr);
+ }
+ return GetPCFormatFromTLUTFormat(tlutfmt);
+ case GX_TF_RGB565:
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 4)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ {
+ u16 *ptr = (u16 *)dst + (y + iy) * width + x;
+ u16 *s = (u16 *)src;
+ for(int j = 0; j < 4; j++)
+ *ptr++ = Common::swap16(*s++);
+ }
+ }
+ return PC_TEX_FMT_RGB565;
+ case GX_TF_RGB5A3:
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 4)
+ for (int iy = 0; iy < 4; iy++, src += 8)
+ //decodebytesRGB5A3((u32*)dst+(y+iy)*width+x, (u16*)src, 4);
+ decodebytesRGB5A3((u32*)dst+(y+iy)*width+x, (u16*)src);
+ }
+ return PC_TEX_FMT_BGRA32;
+ case GX_TF_RGBA8: // speed critical
+ {
+ for (int y = 0; y < height; y += 4)
+ for (int x = 0; x < width; x += 4)
+ {
+ for (int iy = 0; iy < 4; iy++)
+ decodebytesARGB8_4((u32*)dst + (y+iy)*width + x, (u16*)src + 4 * iy, (u16*)src + 4 * iy + 16);
+ src += 64;
+ }
+ }
+ return PC_TEX_FMT_BGRA32;
+ case GX_TF_CMPR: // speed critical
+ // The metroid games use this format almost exclusively.
+ {
+#if 0 // TODO - currently does not handle transparency correctly and causes problems when texture dimensions are not multiples of 8
+ // 11111111 22222222 55555555 66666666
+ // 33333333 44444444 77777777 88888888
+ for (int y = 0; y < height; y += 8)
+ {
+ for (int x = 0; x < width; x += 8)
+ {
+ copyDXTBlock(dst+(y/2)*width+x*2, src);
+ src += 8;
+ copyDXTBlock(dst+(y/2)*width+x*2+8, src);
+ src += 8;
+ copyDXTBlock(dst+(y/2+2)*width+x*2, src);
+ src += 8;
+ copyDXTBlock(dst+(y/2+2)*width+x*2+8, src);
+ src += 8;
+ }
+ }
+ return PC_TEX_FMT_DXT1;
+#else
+ for (int y = 0; y < height; y += 8)
+ {
+ for (int x = 0; x < width; x += 8)
+ {
+ decodeDXTBlock((u32*)dst + y * width + x, (DXTBlock*)src, width);
+ src += sizeof(DXTBlock);
+ decodeDXTBlock((u32*)dst + y * width + x + 4, (DXTBlock*)src, width);
+ src += sizeof(DXTBlock);
+ decodeDXTBlock((u32*)dst + (y + 4) * width + x, (DXTBlock*)src, width);
+ src += sizeof(DXTBlock);
+ decodeDXTBlock((u32*)dst + (y + 4) * width + x + 4, (DXTBlock*)src, width);
+ src += sizeof(DXTBlock);
+ }
+ }
+#endif
+ return PC_TEX_FMT_BGRA32;
+ }
+ }
+
+ // The "copy" texture formats, too?
+ return PC_TEX_FMT_NONE;
+}
+
+
//switch endianness, unswizzle
//TODO: to save memory, don't blindly convert everything to argb8888
@@ -599,12 +812,91 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
return PC_TEX_FMT_NONE;
}
+
void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center)
{
TexFmt_Overlay_Enable = enable;
TexFmt_Overlay_Center = center;
}
+void TexDecoder_DirectDecode(u8 *dst, const u8 *src, int width, int height,int Pitch, int texformat, int tlutaddr, int tlutfmt)
+{
+ PC_TexFormat retval = TexDecoder_DirectDecode_real(dst,src,width,height,Pitch,texformat,tlutaddr,tlutfmt);
+
+ if ((!TexFmt_Overlay_Enable)|| (retval == PC_TEX_FMT_NONE))
+ return;
+
+ int w = min(width, 40);
+ int h = min(height, 10);
+
+ int xoff = (width - w) >> 1;
+ int yoff = (height - h) >> 1;
+
+ if (!TexFmt_Overlay_Center)
+ {
+ xoff=0;
+ yoff=0;
+ }
+
+ const char* fmt = texfmt[texformat&15];
+ while (*fmt)
+ {
+ int xcnt = 0;
+ int nchar = sfont_map[(int)*fmt];
+
+ const unsigned char *ptr = sfont_raw[nchar]; // each char is up to 9x10
+
+ for (int x = 0; x < 9;x++)
+ {
+ if (ptr[x] == 0x78)
+ break;
+ xcnt++;
+ }
+
+ for (int y=0; y < 10; y++)
+ {
+ for (int x=0; x < xcnt; x++)
+ {
+ switch(retval)
+ {
+ case PC_TEX_FMT_I8:
+ {
+ // TODO: Is this an acceptable way to draw in I8?
+ u8 *dtp = (u8*)dst;
+ dtp[(y + yoff) * width + x + xoff] = ptr[x] ? 0xFF : 0x88;
+ break;
+ }
+ case PC_TEX_FMT_IA8:
+ case PC_TEX_FMT_IA4_AS_IA8:
+ {
+ u16 *dtp = (u16*)dst;
+ dtp[(y + yoff) * width + x + xoff] = ptr[x] ? 0xFFFF : 0xFF00;
+ break;
+ }
+ case PC_TEX_FMT_RGB565:
+ {
+ u16 *dtp = (u16*)dst;
+ dtp[(y + yoff)*width + x + xoff] = ptr[x] ? 0xFFFF : 0x0000;
+ break;
+ }
+ default:
+ case PC_TEX_FMT_BGRA32:
+ {
+ int *dtp = (int*)dst;
+ dtp[(y + yoff) * width + x + xoff] = ptr[x] ? 0xFFFFFFFF : 0xFF000000;
+ break;
+ }
+ }
+ }
+ ptr += 9;
+ }
+ xoff += xcnt;
+ fmt++;
+ }
+}
+
+
+
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
{
#if defined(HAVE_OPENCL) && HAVE_OPENCL
diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.h b/Source/Core/VideoCommon/Src/TextureDecoder.h
index 33ba57ee2f..068be12118 100644
--- a/Source/Core/VideoCommon/Src/TextureDecoder.h
+++ b/Source/Core/VideoCommon/Src/TextureDecoder.h
@@ -84,9 +84,11 @@ enum PC_TexFormat
};
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt);
-
+void TexDecoder_DirectDecode(u8 *dst, const u8 *src, int width, int height,int Pitch, int texformat, int tlutaddr, int tlutfmt);
+PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt);
void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt);
+
u32 TexDecoder_GetSafeTextureHash(const u8 *src, int width, int height, int texformat, u32 seed=0);
u32 TexDecoder_GetTlutHash(const u8* src, int len);