diff --git a/Source/Project64-video/Combine.cpp b/Source/Project64-video/Combine.cpp index 6537a018e..d53e1f084 100644 --- a/Source/Project64-video/Combine.cpp +++ b/Source/Project64-video/Combine.cpp @@ -15674,7 +15674,7 @@ void Combine() else grChromakeyMode(GR_CHROMAKEY_DISABLE); - if (aTBuff[0] && aTBuff[0]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88) + if (aTBuff[0] && aTBuff[0]->info.format == GFX_TEXFMT_ALPHA_INTENSITY_88) { if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR) { @@ -15689,7 +15689,7 @@ void Combine() cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA; } - if (aTBuff[1] && aTBuff[1]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88) + if (aTBuff[1] && aTBuff[1]->info.format == GFX_TEXFMT_ALPHA_INTENSITY_88) { if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR) { diff --git a/Source/Project64-video/Ext_TxFilter.h b/Source/Project64-video/Ext_TxFilter.h index 7b93030ce..1317a27c9 100644 --- a/Source/Project64-video/Ext_TxFilter.h +++ b/Source/Project64-video/Ext_TxFilter.h @@ -94,28 +94,6 @@ typedef unsigned char boolean; #define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */ #define DUMP_TEX 0x80000000 -#ifndef __GLIDE_H__ /* GLIDE3 */ -/* from 3Dfx Interactive Inc. glide.h */ -#define GR_TEXFMT_ALPHA_8 0x2 -#define GR_TEXFMT_INTENSITY_8 0x3 - -#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4 -#define GR_TEXFMT_P_8 0x5 - -#define GR_TEXFMT_RGB_565 0xa -#define GR_TEXFMT_ARGB_1555 0xb -#define GR_TEXFMT_ARGB_4444 0xc -#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd - -/* from 3Dfx Interactive Inc. g3ext.h */ -#define GR_TEXFMT_ARGB_CMP_FXT1 0x11 - -#define GR_TEXFMT_ARGB_8888 0x12 - -#define GR_TEXFMT_ARGB_CMP_DXT1 0x16 -#define GR_TEXFMT_ARGB_CMP_DXT3 0x18 -#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A -#endif /* GLIDE3 */ struct GHQTexInfo { unsigned char *data; diff --git a/Source/Project64-video/FBtoScreen.cpp b/Source/Project64-video/FBtoScreen.cpp index 0221e5297..6a3f0ed13 100644 --- a/Source/Project64-video/FBtoScreen.cpp +++ b/Source/Project64-video/FBtoScreen.cpp @@ -145,7 +145,7 @@ static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info) } src += (fb_info.width - 256); } - t_info.format = GR_TEXFMT_RGB_565; + t_info.format = GFX_TEXFMT_RGB_565; t_info.data = tex; int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque); grTexDownloadMipMap(tmu, @@ -175,7 +175,7 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info) uint32_t height256 = ((height - 1) >> 8) + 1; t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; - t_info.format = GR_TEXFMT_ARGB_1555; + t_info.format = GFX_TEXFMT_ARGB_1555; uint16_t * tex = (uint16_t*)texture_buffer; t_info.data = tex; uint32_t tex_size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info); @@ -336,7 +336,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info) } if (empty) return false; - t_info.format = GR_TEXFMT_ARGB_1555; + t_info.format = GFX_TEXFMT_ARGB_1555; t_info.data = tex; } else @@ -360,7 +360,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info) } dst += texwidth - width; } - t_info.format = GR_TEXFMT_ARGB_8888; + t_info.format = GFX_TEXFMT_ARGB_8888; t_info.data = tex; } @@ -409,7 +409,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info) uint32_t height256 = ((height - 1) >> 8) + 1; t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; - t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88; + t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; uint16_t * tex = (uint16_t*)texture_buffer; t_info.data = tex; uint32_t tex_size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info); @@ -481,7 +481,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info) scale = 0.125f; LOD = GR_LOD_LOG2_2048; } - t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88; + t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; t_info.smallLodLog2 = t_info.largeLodLog2 = LOD; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; grConstantColorValue(rdp.fog_color); @@ -592,7 +592,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info) } dst += texwidth - width; } - t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88; + t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; t_info.data = tex; int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque); diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index abd6593e0..62d4ad948 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -231,16 +231,16 @@ void guLoadTextures() if (voodoo.max_tex_size <= 256) { grTextureBufferExt(GR_TMU1, voodoo.tex_min_addr[GR_TMU1], GR_LOD_LOG2_256, GR_LOD_LOG2_256, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); tbuf_size = 8 * grTexCalcMemRequired(GR_LOD_LOG2_256, GR_LOD_LOG2_256, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); } else if (g_scr_res_x <= 1024) { grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GR_LOD_LOG2_1024, GR_LOD_LOG2_1024, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); tbuf_size = grTexCalcMemRequired(GR_LOD_LOG2_1024, GR_LOD_LOG2_1024, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grBufferClear(0, 0, 0xFFFF); grRenderBuffer(GR_BUFFER_BACKBUFFER); @@ -248,9 +248,9 @@ void guLoadTextures() else { grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GR_LOD_LOG2_2048, GR_LOD_LOG2_2048, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); tbuf_size = grTexCalcMemRequired(GR_LOD_LOG2_2048, GR_LOD_LOG2_2048, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grBufferClear(0, 0, 0xFFFF); grRenderBuffer(GR_BUFFER_BACKBUFFER); @@ -284,7 +284,7 @@ void guLoadTextures() fontTex.smallLodLog2 = fontTex.largeLodLog2 = GR_LOD_LOG2_256; fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1; - fontTex.format = GR_TEXFMT_ALPHA_8; + fontTex.format = GFX_TEXFMT_ALPHA_8; fontTex.data = tex8; // Decompression: [1-bit inverse alpha --> 8-bit alpha] @@ -324,7 +324,7 @@ void guLoadTextures() cursorTex.smallLodLog2 = cursorTex.largeLodLog2 = GR_LOD_LOG2_32; cursorTex.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; - cursorTex.format = GR_TEXFMT_ARGB_1555; + cursorTex.format = GFX_TEXFMT_ARGB_1555; cursorTex.data = tex16; // Conversion: [16-bit 1555 (swapped) --> 16-bit 1555] @@ -1065,7 +1065,7 @@ void CALL RomClosed(void) if (evoodoo) { ReleaseGfx(); -} + } } static void CheckDRAMSize() diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 44208c62a..0efb634ea 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -910,7 +910,7 @@ int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info else invtex[tmu] = 0; - if (info->format == GR_TEXFMT_ALPHA_INTENSITY_88) { + if (info->format == GFX_TEXFMT_ALPHA_INTENSITY_88) { if (!found) { return 0; } diff --git a/Source/Project64-video/Renderer/OGLEStextures.cpp b/Source/Project64-video/Renderer/OGLEStextures.cpp index e922db4bb..39be86600 100644 --- a/Source/Project64-video/Renderer/OGLEStextures.cpp +++ b/Source/Project64-video/Renderer/OGLEStextures.cpp @@ -21,18 +21,6 @@ #include #include -/* Napalm extensions to GrTextureFormat_t */ -#define GR_TEXFMT_ARGB_CMP_FXT1 0x11 -#define GR_TEXFMT_ARGB_8888 0x12 -#define GR_TEXFMT_YUYV_422 0x13 -#define GR_TEXFMT_UYVY_422 0x14 -#define GR_TEXFMT_AYUV_444 0x15 -#define GR_TEXFMT_ARGB_CMP_DXT1 0x16 -#define GR_TEXFMT_ARGB_CMP_DXT2 0x17 -#define GR_TEXFMT_ARGB_CMP_DXT3 0x18 -#define GR_TEXFMT_ARGB_CMP_DXT4 0x19 -#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A -#define GR_TEXTFMT_RGB_888 0xFF int TMU_SIZE = 8 * 2048 * 2048; static unsigned char* texture = NULL; @@ -191,27 +179,27 @@ grTexTextureMemRequired(FxU32 evenOdd, switch (info->format) { - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_ALPHA_INTENSITY_44: return width*height; break; - case GR_TEXFMT_ARGB_1555: - case GR_TEXFMT_ARGB_4444: - case GR_TEXFMT_ALPHA_INTENSITY_88: - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_RGB_565: return (width*height) << 1; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: return (width*height) << 2; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii return ((((width + 0x3)&~0x3)*((height + 0x3)&~0x3)) >> 1); - case GR_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT3: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1); default: WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", info->format); @@ -241,27 +229,27 @@ grTexCalcMemRequired( switch (fmt) { - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_ALPHA_INTENSITY_44: return width*height; break; - case GR_TEXFMT_ARGB_1555: - case GR_TEXFMT_ARGB_4444: - case GR_TEXFMT_ALPHA_INTENSITY_88: - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_RGB_565: return (width*height) << 1; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: return (width*height) << 2; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii return ((((width + 0x3)&~0x3)*((height + 0x3)&~0x3)) >> 1); - case GR_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT3: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1); default: WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", fmt); @@ -273,38 +261,38 @@ int grTexFormatSize(int fmt) { int factor = -1; switch (fmt) { - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii factor = 1; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: factor = 1; break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: factor = 2; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: factor = 2; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: factor = 2; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: factor = 2; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: factor = 4; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii factor = 8; // HACKALERT: factor holds block bytes break; - case GR_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii factor = 16; // HACKALERT: factor holds block bytes break; - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: factor = 16; break; - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: factor = 8; break; default: @@ -322,72 +310,72 @@ int grTexFormat2GLPackedFmt(int fmt, int * gltexfmt, int * glpixfmt, int * glpac /* int factor = -1; switch(fmt) { - case GR_TEXFMT_ALPHA_8: + case GFX_TEXFMT_ALPHA_8: factor = 1; *gltexfmt = GL_INTENSITY8; *glpixfmt = GL_LUMINANCE; *glpackfmt = GL_UNSIGNED_BYTE; break; - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii factor = 1; *gltexfmt = GL_LUMINANCE8; *glpixfmt = GL_LUMINANCE; *glpackfmt = GL_UNSIGNED_BYTE; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: factor = 2; *gltexfmt = GL_RGB; *glpixfmt = GL_RGB; *glpackfmt = GL_UNSIGNED_SHORT_5_6_5; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: if (ati_sucks > 0) return -1; // ATI sucks as usual (fixes slowdown on ATI) factor = 2; *gltexfmt = GL_RGB5_A1; *glpixfmt = GL_BGRA; *glpackfmt = GL_UNSIGNED_SHORT_1_5_5_5_REV; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: factor = 2; *gltexfmt = GL_LUMINANCE8_ALPHA8; *glpixfmt = GL_LUMINANCE_ALPHA; *glpackfmt = GL_UNSIGNED_BYTE; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: factor = 2; *gltexfmt = GL_RGBA4; *glpixfmt = GL_BGRA; *glpackfmt = GL_UNSIGNED_SHORT_4_4_4_4_REV; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: factor = 4; *gltexfmt = GL_RGBA8; *glpixfmt = GL_BGRA; *glpackfmt = GL_UNSIGNED_INT_8_8_8_8_REV; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii - // HACKALERT: 3Dfx Glide uses GR_TEXFMT_ARGB_CMP_DXT1 for both opaque DXT1 and DXT1 with 1bit alpha. + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + // HACKALERT: 3Dfx Glide uses GFX_TEXFMT_ARGB_CMP_DXT1 for both opaque DXT1 and DXT1 with 1bit alpha. // GlideHQ compiled with GLIDE64_DXTN option enabled, uses opaqe DXT1 only. factor = 8; // HACKALERT: factor holds block bytes *gltexfmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; // these variables aren't used *glpixfmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; *glpackfmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT3: factor = 16; *gltexfmt = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; *glpixfmt = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; *glpackfmt = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: factor = 16; *gltexfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; *glpixfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; *glpackfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: factor = 8; *gltexfmt = GL_COMPRESSED_RGBA_FXT1_3DFX; *glpixfmt = GL_COMPRESSED_RGBA_FXT1_3DFX; @@ -435,7 +423,7 @@ grTexDownloadMipMap(GrChipID_t tmu, register int n = 0, m = 0; switch (info->format) { - case GR_TEXFMT_ALPHA_8: + case GFX_TEXFMT_ALPHA_8: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -451,7 +439,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 1; glformat = GL_RGBA; break; - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -466,7 +454,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 1; glformat = GL_ALPHA; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: #if 1 for (i = 0; i < height; i++) { @@ -493,7 +481,7 @@ grTexDownloadMipMap(GrChipID_t tmu, glformat = GL_LUMINANCE_ALPHA; #endif break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -515,7 +503,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_RGB; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -538,7 +526,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_RGBA; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -553,7 +541,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_LUMINANCE_ALPHA; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: for (i = 0; i < height; i++) { @@ -577,7 +565,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_RGBA; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -596,19 +584,19 @@ grTexDownloadMipMap(GrChipID_t tmu, glformat = GL_RGBA; break; /* - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii factor = 8; // HACKALERT: factor holds block bytes glformat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii factor = 16; // HACKALERT: factor holds block bytes glformat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: factor = 16; glformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: factor = 8; glformat = GL_COMPRESSED_RGBA_FXT1_3DFX; break; @@ -623,10 +611,10 @@ grTexDownloadMipMap(GrChipID_t tmu, switch (info->format) { - case GR_TEXFMT_ARGB_CMP_DXT1: - case GR_TEXFMT_ARGB_CMP_DXT3: - case GR_TEXFMT_ARGB_CMP_DXT5: - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_DXT1: + case GFX_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_FXT1: remove_tex(startAddress + 1, startAddress + 1 + ((width*height*factor) >> 4)); break; default: @@ -643,10 +631,10 @@ grTexDownloadMipMap(GrChipID_t tmu, /* switch(info->format) { - case GR_TEXFMT_ARGB_CMP_DXT1: - case GR_TEXFMT_ARGB_CMP_DXT3: - case GR_TEXFMT_ARGB_CMP_DXT5: - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_DXT1: + case GFX_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_FXT1: glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, (glformat ? glformat : gltexfmt), width, height, 0, (width*height*factor)>>4, info->data); break; default: diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index 4ec199696..62c02240d 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -1203,7 +1203,7 @@ int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info else invtex[tmu] = 0; - if (info->format == GR_TEXFMT_ALPHA_INTENSITY_88) { + if (info->format == GFX_TEXFMT_ALPHA_INTENSITY_88) { if (!found) { return 0; } diff --git a/Source/Project64-video/Renderer/OGLtextures.cpp b/Source/Project64-video/Renderer/OGLtextures.cpp index 56f1bbe93..5a6d0f610 100644 --- a/Source/Project64-video/Renderer/OGLtextures.cpp +++ b/Source/Project64-video/Renderer/OGLtextures.cpp @@ -23,19 +23,6 @@ #include #include -/* Napalm extensions to GrTextureFormat_t */ -#define GR_TEXFMT_ARGB_CMP_FXT1 0x11 -#define GR_TEXFMT_ARGB_8888 0x12 -#define GR_TEXFMT_YUYV_422 0x13 -#define GR_TEXFMT_UYVY_422 0x14 -#define GR_TEXFMT_AYUV_444 0x15 -#define GR_TEXFMT_ARGB_CMP_DXT1 0x16 -#define GR_TEXFMT_ARGB_CMP_DXT2 0x17 -#define GR_TEXFMT_ARGB_CMP_DXT3 0x18 -#define GR_TEXFMT_ARGB_CMP_DXT4 0x19 -#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A -#define GR_TEXTFMT_RGB_888 0xFF - int TMU_SIZE = 8 * 2048 * 2048; static unsigned char* texture = NULL; @@ -193,27 +180,27 @@ grTexTextureMemRequired(FxU32 evenOdd, switch (info->format) { - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_ALPHA_INTENSITY_44: return width*height; break; - case GR_TEXFMT_ARGB_1555: - case GR_TEXFMT_ARGB_4444: - case GR_TEXFMT_ALPHA_INTENSITY_88: - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_RGB_565: return (width*height) << 1; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: return (width*height) << 2; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii return ((((width + 0x3)&~0x3)*((height + 0x3)&~0x3)) >> 1); - case GR_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT3: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1); default: WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", info->format); @@ -243,27 +230,27 @@ grTexCalcMemRequired( switch (fmt) { - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_ALPHA_INTENSITY_44: return width*height; break; - case GR_TEXFMT_ARGB_1555: - case GR_TEXFMT_ARGB_4444: - case GR_TEXFMT_ALPHA_INTENSITY_88: - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_RGB_565: return (width*height) << 1; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: return (width*height) << 2; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii return ((((width + 0x3)&~0x3)*((height + 0x3)&~0x3)) >> 1); - case GR_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT3: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3); - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1); default: WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", fmt); @@ -275,38 +262,38 @@ int grTexFormatSize(int fmt) { int factor = -1; switch (fmt) { - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii factor = 1; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: factor = 1; break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: factor = 2; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: factor = 2; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: factor = 2; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: factor = 2; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: factor = 4; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii factor = 8; // HACKALERT: factor holds block bytes break; - case GR_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii factor = 16; // HACKALERT: factor holds block bytes break; - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: factor = 16; break; - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: factor = 8; break; default: @@ -319,72 +306,72 @@ int grTexFormat2GLPackedFmt(int fmt, int * gltexfmt, int * glpixfmt, int * glpac { int factor = -1; switch (fmt) { - case GR_TEXFMT_ALPHA_8: + case GFX_TEXFMT_ALPHA_8: factor = 1; *gltexfmt = GL_INTENSITY8; *glpixfmt = GL_LUMINANCE; *glpackfmt = GL_UNSIGNED_BYTE; break; - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii factor = 1; *gltexfmt = GL_LUMINANCE8; *glpixfmt = GL_LUMINANCE; *glpackfmt = GL_UNSIGNED_BYTE; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: factor = 2; *gltexfmt = GL_RGB; *glpixfmt = GL_RGB; *glpackfmt = GL_UNSIGNED_SHORT_5_6_5; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: if (ati_sucks > 0) return -1; // ATI sucks as usual (fixes slowdown on ATI) factor = 2; *gltexfmt = GL_RGB5_A1; *glpixfmt = GL_BGRA; *glpackfmt = GL_UNSIGNED_SHORT_1_5_5_5_REV; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: factor = 2; *gltexfmt = GL_LUMINANCE8_ALPHA8; *glpixfmt = GL_LUMINANCE_ALPHA; *glpackfmt = GL_UNSIGNED_BYTE; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: factor = 2; *gltexfmt = GL_RGBA4; *glpixfmt = GL_BGRA; *glpackfmt = GL_UNSIGNED_SHORT_4_4_4_4_REV; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: factor = 4; *gltexfmt = GL_RGBA8; *glpixfmt = GL_BGRA; *glpackfmt = GL_UNSIGNED_INT_8_8_8_8_REV; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii - // HACKALERT: 3Dfx Glide uses GR_TEXFMT_ARGB_CMP_DXT1 for both opaque DXT1 and DXT1 with 1bit alpha. + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + // HACKALERT: 3Dfx Glide uses GFX_TEXFMT_ARGB_CMP_DXT1 for both opaque DXT1 and DXT1 with 1bit alpha. // GlideHQ compiled with GLIDE64_DXTN option enabled, uses opaqe DXT1 only. factor = 8; // HACKALERT: factor holds block bytes *gltexfmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; // these variables aren't used *glpixfmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; *glpackfmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT3: factor = 16; *gltexfmt = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; *glpixfmt = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; *glpackfmt = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: factor = 16; *gltexfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; *glpixfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; *glpackfmt = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: factor = 8; *gltexfmt = GL_COMPRESSED_RGBA_FXT1_3DFX; *glpixfmt = GL_COMPRESSED_RGBA_FXT1_3DFX; @@ -432,7 +419,7 @@ grTexDownloadMipMap(GrChipID_t tmu, register int n = 0, m = 0; switch (info->format) { - case GR_TEXFMT_ALPHA_8: + case GFX_TEXFMT_ALPHA_8: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -448,7 +435,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 1; glformat = GL_INTENSITY8; break; - case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii + case GFX_TEXFMT_INTENSITY_8: // I8 support - H.Morii for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -463,7 +450,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 1; glformat = GL_LUMINANCE8; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: #if 1 for (i = 0; i < height; i++) { @@ -490,7 +477,7 @@ grTexDownloadMipMap(GrChipID_t tmu, glformat = GL_LUMINANCE4_ALPHA4; #endif break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -512,7 +499,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_RGB; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -535,7 +522,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_RGB5_A1; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -550,7 +537,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_LUMINANCE8_ALPHA8; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: for (i = 0; i < height; i++) { @@ -574,7 +561,7 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 2; glformat = GL_RGBA4; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: for (i = 0; i < height; i++) { for (j = 0; j < width; j++) @@ -592,19 +579,19 @@ grTexDownloadMipMap(GrChipID_t tmu, factor = 4; glformat = GL_RGBA8; break; - case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii factor = 8; // HACKALERT: factor holds block bytes glformat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii + case GFX_TEXFMT_ARGB_CMP_DXT3: // FXT1,DXT1,5 support - H.Morii factor = 16; // HACKALERT: factor holds block bytes glformat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT5: factor = 16; glformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: factor = 8; glformat = GL_COMPRESSED_RGBA_FXT1_3DFX; break; @@ -621,10 +608,10 @@ grTexDownloadMipMap(GrChipID_t tmu, switch (info->format) { - case GR_TEXFMT_ARGB_CMP_DXT1: - case GR_TEXFMT_ARGB_CMP_DXT3: - case GR_TEXFMT_ARGB_CMP_DXT5: - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_DXT1: + case GFX_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_FXT1: remove_tex(startAddress + 1, startAddress + 1 + ((width*height*factor) >> 4)); break; default: @@ -639,10 +626,10 @@ grTexDownloadMipMap(GrChipID_t tmu, switch (info->format) { - case GR_TEXFMT_ARGB_CMP_DXT1: - case GR_TEXFMT_ARGB_CMP_DXT3: - case GR_TEXFMT_ARGB_CMP_DXT5: - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_DXT1: + case GFX_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_FXT1: glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, (glformat ? glformat : gltexfmt), width, height, 0, (width*height*factor) >> 4, info->data); break; default: diff --git a/Source/Project64-video/Renderer/types.h b/Source/Project64-video/Renderer/types.h index d1b103d9c..8d77d6a92 100644 --- a/Source/Project64-video/Renderer/types.h +++ b/Source/Project64-video/Renderer/types.h @@ -16,3 +16,40 @@ #include typedef uint8_t gfxAlpha_t; +enum gfxTextureFormat_t +{ + GFX_TEXFMT_8BIT = 0x0, + GFX_TEXFMT_RGB_332 = GFX_TEXFMT_8BIT, + GFX_TEXFMT_YIQ_422 = 0x1, + GFX_TEXFMT_ALPHA_8 = 0x2, /* (0..0xFF) alpha */ + GFX_TEXFMT_INTENSITY_8 = 0x3, /* (0..0xFF) intensity */ + GFX_TEXFMT_ALPHA_INTENSITY_44 = 0x4, + GFX_TEXFMT_P_8 = 0x5, /* 8-bit palette */ + GFX_TEXFMT_RSVD0 = 0x6, /* GFX_TEXFMT_P_8_RGBA */ + GFX_TEXFMT_P_8_6666 = GFX_TEXFMT_RSVD0, + GFX_TEXFMT_P_8_6666_EXT = GFX_TEXFMT_RSVD0, + GFX_TEXFMT_RSVD1 = 0x7, + GFX_TEXFMT_16BIT = 0x8, + GFX_TEXFMT_ARGB_8332 = GFX_TEXFMT_16BIT, + GFX_TEXFMT_AYIQ_8422 = 0x9, + GFX_TEXFMT_RGB_565 = 0xa, + GFX_TEXFMT_ARGB_1555 = 0xb, + GFX_TEXFMT_ARGB_4444 = 0xc, + GFX_TEXFMT_ALPHA_INTENSITY_88 = 0xd, + GFX_TEXFMT_AP_88 = 0xe, /* 8-bit alpha 8-bit palette */ + GFX_TEXFMT_RSVD2 = 0xf, + GFX_TEXFMT_RSVD4 = GFX_TEXFMT_RSVD2, + GFX_TEXFMT_ARGB_CMP_FXT1 = 0x11, + GFX_TEXFMT_ARGB_8888 = 0x12, + GFX_TEXFMT_YUYV_422 = 0x13, + GFX_TEXFMT_UYVY_422 = 0x14, + GFX_TEXFMT_AYUV_444 = 0x15, + GFX_TEXFMT_ARGB_CMP_DXT1 = 0x16, + GFX_TEXFMT_ARGB_CMP_DXT2 = 0x17, + GFX_TEXFMT_ARGB_CMP_DXT3 = 0x18, + GFX_TEXFMT_ARGB_CMP_DXT4 = 0x19, + GFX_TEXFMT_ARGB_CMP_DXT5 = 0x1A, + GFX_TEXFMT_RGB_888 = 0xFF, + GFX_TEXFMT_GZ = 0x8000, +}; + diff --git a/Source/Project64-video/TexBuffer.cpp b/Source/Project64-video/TexBuffer.cpp index 9e444620b..4c2a66998 100644 --- a/Source/Project64-video/TexBuffer.cpp +++ b/Source/Project64-video/TexBuffer.cpp @@ -106,9 +106,9 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage) } } if ((cimage.format != 0))// && (cimage.width <= 64)) - texbuf.info.format = GR_TEXFMT_ALPHA_INTENSITY_88; + texbuf.info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; else - texbuf.info.format = GR_TEXFMT_RGB_565; + texbuf.info.format = GFX_TEXFMT_RGB_565; texbuf.lr_u = 256.0f * texbuf.scr_width / (float)tex_size;// + 1.0f; texbuf.lr_v = 256.0f * texbuf.scr_height / (float)tex_size;// + 1.0f; @@ -241,9 +241,9 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage) texbuf->drawn = FALSE; texbuf->format = (uint16_t)cimage.format; if ((cimage.format != 0)) - texbuf->info.format = GR_TEXFMT_ALPHA_INTENSITY_88; + texbuf->info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; else - texbuf->info.format = GR_TEXFMT_RGB_565; + texbuf->info.format = GFX_TEXFMT_RGB_565; texbuf->crc = 0; texbuf->t_mem = 0; texbuf->tile = 0; @@ -344,12 +344,12 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE) grDepthMask(FXFALSE); grCullMode(GR_CULL_DISABLE); grFogMode(GR_FOG_DISABLE); - GrTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GR_TEXFMT_RGB_565; + GrTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GFX_TEXFMT_RGB_565; GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL; if (!force_rgb && rdp.black_ci_index > 0 && rdp.black_ci_index <= rdp.copy_ci_index) { color_source = GR_COMBINE_FUNCTION_LOCAL_ALPHA; - buf_format = GR_TEXFMT_ALPHA_INTENSITY_88; + buf_format = GFX_TEXFMT_ALPHA_INTENSITY_88; } if (rdp.tbuff_tex->tmu == GR_TMU0) { @@ -462,7 +462,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to) } rdp.tbuff_tex->crc = 0; GrTextureFormat_t buf_format = rdp.tbuff_tex->info.format; - rdp.tbuff_tex->info.format = GR_TEXFMT_RGB_565; + rdp.tbuff_tex->info.format = GFX_TEXFMT_RGB_565; TexBufSetupCombiner(TRUE); float ul_x = 0.0f; float ul_y = 0.0f; @@ -516,7 +516,7 @@ int CopyDepthBuffer() } rdp.tbuff_tex = &(rdp.texbufs[0].images[0]); rdp.tbuff_tex->tmu = rdp.texbufs[0].tmu; - rdp.tbuff_tex->info.format = GR_TEXFMT_RGB_565; + rdp.tbuff_tex->info.format = GFX_TEXFMT_RGB_565; rdp.tbuff_tex->info.smallLodLog2 = rdp.tbuff_tex->info.largeLodLog2 = LOD; rdp.tbuff_tex->info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; TexBufSetupCombiner(TRUE); @@ -541,12 +541,12 @@ int CopyDepthBuffer() grTexSource(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info)); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grTextureBufferExt(rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); grDrawTriangle(&v[0], &v[2], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]); grRenderBuffer(GR_BUFFER_BACKBUFFER); grTextureAuxBufferExt(rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; diff --git a/Source/Project64-video/TexCache.cpp b/Source/Project64-video/TexCache.cpp index bdfb534e6..0dc2e55d1 100644 --- a/Source/Project64-video/TexCache.cpp +++ b/Source/Project64-video/TexCache.cpp @@ -1010,7 +1010,7 @@ void LoadTex(int id, int tmu) AddToList(&cachelut[cache->crc >> 16], cache->crc, uintptr_t(cache), tmu, rdp.n_cached[tmu]); // temporary - cache->t_info.format = GR_TEXFMT_ARGB_1555; + cache->t_info.format = GFX_TEXFMT_ARGB_1555; // Calculate lod and aspect uint32_t size_x = rdp.tiles[td].width; @@ -1439,34 +1439,34 @@ void LoadTex(int id, int tmu) if (mod && !modifyPalette && !ghqTexInfo.data) { // Convert the texture to ARGB 4444 - if (LOWORD(result) == GR_TEXFMT_ARGB_1555) + if (LOWORD(result) == GFX_TEXFMT_ARGB_1555) { TexConv_ARGB1555_ARGB4444((texture), (tex2), real_x, real_y); texture = tex2; } - else if (LOWORD(result) == GR_TEXFMT_ALPHA_INTENSITY_88) + else if (LOWORD(result) == GFX_TEXFMT_ALPHA_INTENSITY_88) { TexConv_AI88_ARGB4444((texture), (tex2), real_x, real_y); texture = tex2; } - else if (LOWORD(result) == GR_TEXFMT_ALPHA_INTENSITY_44) + else if (LOWORD(result) == GFX_TEXFMT_ALPHA_INTENSITY_44) { TexConv_AI44_ARGB4444((texture), (tex2), real_x, real_y); texture = tex2; } - else if (LOWORD(result) == GR_TEXFMT_ALPHA_8) + else if (LOWORD(result) == GFX_TEXFMT_ALPHA_8) { TexConv_A8_ARGB4444((texture), (tex2), real_x, real_y); texture = tex2; } - /*else if (LOWORD(result) == GR_TEXFMT_ARGB_4444) + /*else if (LOWORD(result) == GFX_TEXFMT_ARGB_4444) { memcpy (tex2, texture, (real_x*real_y) << 1); texture = tex2; }*/ // we can skip memcpy since "texture" won't be swapped between "tex1" and "tex2" after this. // Hiroshi Morii - result = (1 << 16) | GR_TEXFMT_ARGB_4444; + result = (1 << 16) | GFX_TEXFMT_ARGB_4444; // Now convert the color to the same modcolor = ((modcolor & 0xF0000000) >> 16) | ((modcolor & 0x00F00000) >> 12) | diff --git a/Source/Project64-video/TexLoad.h b/Source/Project64-video/TexLoad.h index b54a9551c..49c1ff3f8 100644 --- a/Source/Project64-video/TexLoad.h +++ b/Source/Project64-video/TexLoad.h @@ -22,7 +22,7 @@ uint32_t LoadNone(uintptr_t /*dst*/, uintptr_t /*src*/, int /*wid_64*/, int /*height*/, int /*line*/, int /*real_width*/, int /*tile*/) { memset(texture, 0, 4096 * 4); - return (1 << 16) | GR_TEXFMT_ARGB_1555; + return (1 << 16) | GFX_TEXFMT_ARGB_1555; } typedef uint32_t(*texfunc)(uintptr_t, uintptr_t, int, int, int, int, int); diff --git a/Source/Project64-video/TexLoad16b.h b/Source/Project64-video/TexLoad16b.h index df5ef5379..3945d41d6 100644 --- a/Source/Project64-video/TexLoad16b.h +++ b/Source/Project64-video/TexLoad16b.h @@ -142,7 +142,7 @@ uint32_t Load16bRGBA(uintptr_t dst, uintptr_t src, int wid_64, int height, int l load16bRGBA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return (1 << 16) | GR_TEXFMT_ARGB_1555; + return (1 << 16) | GFX_TEXFMT_ARGB_1555; } //**************************************************************** @@ -157,7 +157,7 @@ uint32_t Load16bIA(uintptr_t dst, uintptr_t src, int wid_64, int height, int lin load16bIA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88; + return (1 << 16) | GFX_TEXFMT_ALPHA_INTENSITY_88; } //**************************************************************** @@ -221,5 +221,5 @@ uint32_t Load16bYUV(uintptr_t dst, uintptr_t /*src*/, int /*wid_64*/, int /*heig c = yuv_to_rgb565(y1, u, v); *(tex++) = c; } - return (1 << 16) | GR_TEXFMT_RGB_565; + return (1 << 16) | GFX_TEXFMT_RGB_565; } diff --git a/Source/Project64-video/TexLoad32b.h b/Source/Project64-video/TexLoad32b.h index 199c66ad4..78470f753 100644 --- a/Source/Project64-video/TexLoad32b.h +++ b/Source/Project64-video/TexLoad32b.h @@ -60,9 +60,9 @@ uint32_t Load32bRGBA(uintptr_t dst, uintptr_t src, int wid_64, int height, int l b = (c >> 4) & 0xF; tex16[i] = (a << 12) | (r << 8) | (g << 4) | b; } - return (1 << 16) | GR_TEXFMT_ARGB_4444; + return (1 << 16) | GFX_TEXFMT_ARGB_4444; } - return (2 << 16) | GR_TEXFMT_ARGB_8888; + return (2 << 16) | GFX_TEXFMT_ARGB_8888; } //**************************************************************** diff --git a/Source/Project64-video/TexLoad4b.h b/Source/Project64-video/TexLoad4b.h index 013d17c05..02d37b0f0 100644 --- a/Source/Project64-video/TexLoad4b.h +++ b/Source/Project64-video/TexLoad4b.h @@ -564,7 +564,7 @@ uint32_t Load4bCI(uintptr_t dst, uintptr_t src, int wid_64, int height, int line //in tlut DISABLE mode load CI texture as plain intensity texture instead of palette dereference. //Thanks to angrylion for the advice load4bI((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44; + return /*(0 << 16) | */GFX_TEXFMT_ALPHA_INTENSITY_44; } uintptr_t pal = uintptr_t(rdp.pal_8 + (rdp.tiles[tile].palette << 4)); @@ -572,12 +572,12 @@ uint32_t Load4bCI(uintptr_t dst, uintptr_t src, int wid_64, int height, int line { ext <<= 1; load4bCI((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext, (uint16_t *)pal); - return (1 << 16) | GR_TEXFMT_ARGB_1555; + return (1 << 16) | GFX_TEXFMT_ARGB_1555; } ext <<= 1; load4bIAPal((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext, (uint16_t *)pal); - return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88; + return (1 << 16) | GFX_TEXFMT_ALPHA_INTENSITY_88; } //**************************************************************** @@ -594,7 +594,7 @@ uint32_t Load4bIA(uintptr_t dst, uintptr_t src, int wid_64, int height, int line if (height < 1) height = 1; int ext = (real_width - (wid_64 << 4)); load4bIA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44; + return /*(0 << 16) | */GFX_TEXFMT_ALPHA_INTENSITY_44; } //**************************************************************** @@ -610,7 +610,7 @@ uint32_t Load4bI(uintptr_t dst, uintptr_t src, int wid_64, int height, int line, int ext = (real_width - (wid_64 << 4)); load4bI((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44; + return /*(0 << 16) | */GFX_TEXFMT_ALPHA_INTENSITY_44; } //**************************************************************** diff --git a/Source/Project64-video/TexLoad8b.h b/Source/Project64-video/TexLoad8b.h index 82e1e9cca..8024e2005 100644 --- a/Source/Project64-video/TexLoad8b.h +++ b/Source/Project64-video/TexLoad8b.h @@ -348,15 +348,15 @@ uint32_t Load8bCI(uintptr_t dst, uintptr_t src, int wid_64, int height, int line //in tlut DISABLE mode load CI texture as plain intensity texture instead of palette dereference. //Thanks to angrylion for the advice load8bI((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return /*(0 << 16) | */GR_TEXFMT_ALPHA_8; + return /*(0 << 16) | */GFX_TEXFMT_ALPHA_8; case 2: //color palette ext <<= 1; load8bCI((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext, pal); - return (1 << 16) | GR_TEXFMT_ARGB_1555; + return (1 << 16) | GFX_TEXFMT_ARGB_1555; default: //IA palette ext <<= 1; load8bIA8((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext, pal); - return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88; + return (1 << 16) | GFX_TEXFMT_ALPHA_INTENSITY_88; } } @@ -373,7 +373,7 @@ uint32_t Load8bIA(uintptr_t dst, uintptr_t src, int wid_64, int height, int line if (height < 1) height = 1; int ext = (real_width - (wid_64 << 3)); load8bIA4((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44; + return /*(0 << 16) | */GFX_TEXFMT_ALPHA_INTENSITY_44; } //**************************************************************** @@ -389,5 +389,5 @@ uint32_t Load8bI(uintptr_t dst, uintptr_t src, int wid_64, int height, int line, if (height < 1) height = 1; int ext = (real_width - (wid_64 << 3)); load8bI((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); - return /*(0 << 16) | */GR_TEXFMT_ALPHA_8; + return /*(0 << 16) | */GFX_TEXFMT_ALPHA_8; } diff --git a/Source/Project64-video/TextureEnhancer/Ext_TxFilter.h b/Source/Project64-video/TextureEnhancer/Ext_TxFilter.h index e9c52591a..32cd18b7a 100644 --- a/Source/Project64-video/TextureEnhancer/Ext_TxFilter.h +++ b/Source/Project64-video/TextureEnhancer/Ext_TxFilter.h @@ -64,29 +64,6 @@ #define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */ #define DUMP_TEX 0x80000000 -#ifndef __GLIDE_H__ /* GLIDE3 */ -/* from 3Dfx Interactive Inc. glide.h */ -#define GR_TEXFMT_ALPHA_8 0x2 -#define GR_TEXFMT_INTENSITY_8 0x3 - -#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4 -#define GR_TEXFMT_P_8 0x5 - -#define GR_TEXFMT_RGB_565 0xa -#define GR_TEXFMT_ARGB_1555 0xb -#define GR_TEXFMT_ARGB_4444 0xc -#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd - -/* from 3Dfx Interactive Inc. g3ext.h */ -#define GR_TEXFMT_ARGB_CMP_FXT1 0x11 - -#define GR_TEXFMT_ARGB_8888 0x12 - -#define GR_TEXFMT_ARGB_CMP_DXT1 0x16 -#define GR_TEXFMT_ARGB_CMP_DXT3 0x18 -#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A -#endif /* GLIDE3 */ - struct GHQTexInfo { unsigned char *data; int width; diff --git a/Source/Project64-video/TextureEnhancer/TxCache.cpp b/Source/Project64-video/TextureEnhancer/TxCache.cpp index 6b418f178..e03c3370e 100644 --- a/Source/Project64-video/TextureEnhancer/TxCache.cpp +++ b/Source/Project64-video/TextureEnhancer/TxCache.cpp @@ -24,6 +24,7 @@ #include #include #include +#include TxCache::~TxCache() { @@ -103,7 +104,7 @@ TxCache::add(uint64_t checksum, GHQTexInfo *info, int dataSize) { DBG_INFO(80, "zlib compressed: %.02fkb->%.02fkb\n", (float)dataSize / 1000, (float)destLen / 1000); dataSize = destLen; - format |= GR_TEXFMT_GZ; + format |= GFX_TEXFMT_GZ; } } } @@ -225,7 +226,7 @@ TxCache::get(uint64_t checksum, GHQTexInfo *info) } /* zlib decompress it */ - if (info->format & GR_TEXFMT_GZ) + if (info->format & GFX_TEXFMT_GZ) { uLongf destLen = _gzdestLen; uint8 *dest = (_gzdest0 == info->data) ? _gzdest1 : _gzdest0; @@ -235,7 +236,7 @@ TxCache::get(uint64_t checksum, GHQTexInfo *info) return 0; } info->data = dest; - info->format &= ~GR_TEXFMT_GZ; + info->format &= ~GFX_TEXFMT_GZ; DBG_INFO(80, "zlib decompressed: %.02fkb->%.02fkb\n", (float)(((*itMap).second)->size) / 1000, (float)destLen / 1000); } return 1; @@ -268,7 +269,7 @@ bool TxCache::save(const char *path, const char *filename, int config) * texture data in a zlib compressed state. if the GZ_TEXCACHE or GZ_HIRESTEXCACHE * option is toggled, the cache will need to be rebuilt. */ - /*if (format & GR_TEXFMT_GZ) { + /*if (format & GFX_TEXFMT_GZ) { dest = _gzdest0; destLen = _gzdestLen; if (dest && destLen) { @@ -276,7 +277,7 @@ bool TxCache::save(const char *path, const char *filename, int config) dest = NULL; destLen = 0; } - format &= ~GR_TEXFMT_GZ; + format &= ~GFX_TEXFMT_GZ; } }*/ @@ -363,7 +364,7 @@ bool TxCache::load(const char *path, const char *filename, int config) gzread(gzfp, tmpInfo.data, dataSize); /* add to memory cache */ - add(checksum, &tmpInfo, (tmpInfo.format & GR_TEXFMT_GZ) ? dataSize : 0); + add(checksum, &tmpInfo, (tmpInfo.format & GFX_TEXFMT_GZ) ? dataSize : 0); free(tmpInfo.data); } diff --git a/Source/Project64-video/TextureEnhancer/TxFilter.cpp b/Source/Project64-video/TextureEnhancer/TxFilter.cpp index a89b49318..dc594f094 100644 --- a/Source/Project64-video/TextureEnhancer/TxFilter.cpp +++ b/Source/Project64-video/TextureEnhancer/TxFilter.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "TxFilter.h" #include "TextureFilters.h" #include "TxDbg.h" @@ -198,25 +199,25 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint */ if ((srcwidth >= 4 && srcheight >= 4) && ((_options & (FILTER_MASK | ENHANCEMENT_MASK | COMPRESSION_MASK)) || - (srcformat == GR_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)))) { + (srcformat == GFX_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)))) { #if !_16BPP_HACK /* convert textures to a format that the compressor accepts (ARGB8888) */ if (_options & COMPRESSION_MASK) { #endif - if (srcformat != GR_TEXFMT_ARGB_8888) { - if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, srcformat, GR_TEXFMT_ARGB_8888)) { + if (srcformat != GFX_TEXFMT_ARGB_8888) { + if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, srcformat, GFX_TEXFMT_ARGB_8888)) { DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", srcformat); return 0; } texture = tmptex; - destformat = GR_TEXFMT_ARGB_8888; + destformat = GFX_TEXFMT_ARGB_8888; } #if !_16BPP_HACK } #endif switch (destformat) { - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: /* * prepare texture enhancements (x2, x4 scalers) @@ -301,9 +302,9 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint /* XXX: textures that use 8bit alpha channel look bad with the current * fxt1 library, so we substitute it with dxtn for now. afaik all gfx * cards that support fxt1 also support dxtn. (3dfx and Intel) */ - if ((destformat == GR_TEXFMT_ALPHA_INTENSITY_88) || - (destformat == GR_TEXFMT_ARGB_8888) || - (destformat == GR_TEXFMT_ALPHA_8)) { + if ((destformat == GFX_TEXFMT_ALPHA_INTENSITY_88) || + (destformat == GFX_TEXFMT_ARGB_8888) || + (destformat == GFX_TEXFMT_ALPHA_8)) { compressionType = S3TC_COMPRESSION; } tmptex = (texture == _tex1) ? _tex2 : _tex1; @@ -321,11 +322,11 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint /* * texture (re)conversions */ - if (destformat == GR_TEXFMT_ARGB_8888) { - if (srcformat == GR_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)) srcformat = GR_TEXFMT_ARGB_4444; - if (srcformat != GR_TEXFMT_ARGB_8888) { + if (destformat == GFX_TEXFMT_ARGB_8888) { + if (srcformat == GFX_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)) srcformat = GFX_TEXFMT_ARGB_4444; + if (srcformat != GFX_TEXFMT_ARGB_8888) { tmptex = (texture == _tex1) ? _tex2 : _tex1; - if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, GR_TEXFMT_ARGB_8888, srcformat)) { + if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, GFX_TEXFMT_ARGB_8888, srcformat)) { DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", srcformat); return 0; } @@ -336,7 +337,7 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint break; #if !_16BPP_HACK - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: int scale_shift = 0; tmptex = (texture == _tex1) ? _tex2 : _tex1; @@ -405,11 +406,11 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint } break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: break; - case GR_TEXFMT_ALPHA_8: + case GFX_TEXFMT_ALPHA_8: break; #endif /* _16BPP_HACK */ } @@ -492,8 +493,8 @@ TxFilter::hirestex(uint64_t g64crc, uint64_t r_crc64, uint16 *palette, GHQTexInf * NOTE: the pre-converted palette from Glide64 is in RGBA5551 format. * A comp comes before RGB comp. */ - if (palette && info->format == GR_TEXFMT_P_8) { - DBG_INFO(80, "found GR_TEXFMT_P_8 format. Need conversion!!\n"); + if (palette && info->format == GFX_TEXFMT_P_8) { + DBG_INFO(80, "found GFX_TEXFMT_P_8 format. Need conversion!!\n"); int width = info->width; int height = info->height; @@ -505,31 +506,31 @@ TxFilter::hirestex(uint64_t g64crc, uint64_t r_crc64, uint16 *palette, GHQTexInf /* use palette and convert to 16bit format */ _txQuantize->P8_16BPP((uint32*)texture, (uint32*)tmptex, info->width, info->height, (uint32*)palette); texture = tmptex; - format = GR_TEXFMT_ARGB_1555; + format = GFX_TEXFMT_ARGB_1555; #if 1 /* XXX: compressed if memory cache compression is ON */ if (_options & COMPRESSION_MASK) { tmptex = (texture == _tex1) ? _tex2 : _tex1; - if (_txQuantize->quantize(texture, tmptex, info->width, info->height, format, GR_TEXFMT_ARGB_8888)) { + if (_txQuantize->quantize(texture, tmptex, info->width, info->height, format, GFX_TEXFMT_ARGB_8888)) { texture = tmptex; - format = GR_TEXFMT_ARGB_8888; + format = GFX_TEXFMT_ARGB_8888; } - if (format == GR_TEXFMT_ARGB_8888) { + if (format == GFX_TEXFMT_ARGB_8888) { tmptex = (texture == _tex1) ? _tex2 : _tex1; if (_txQuantize->compress(texture, tmptex, - info->width, info->height, GR_TEXFMT_ARGB_1555, + info->width, info->height, GFX_TEXFMT_ARGB_1555, &width, &height, &format, _options & COMPRESSION_MASK)) { texture = tmptex; } else { - /*if (!_txQuantize->quantize(texture, tmptex, info->width, info->height, GR_TEXFMT_ARGB_8888, GR_TEXFMT_ARGB_1555)) { + /*if (!_txQuantize->quantize(texture, tmptex, info->width, info->height, GFX_TEXFMT_ARGB_8888, GFX_TEXFMT_ARGB_1555)) { DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", format); return 0; }*/ texture = tmptex; - format = GR_TEXFMT_ARGB_1555; + format = GFX_TEXFMT_ARGB_1555; } } } @@ -548,7 +549,7 @@ TxFilter::hirestex(uint64_t g64crc, uint64_t r_crc64, uint16 *palette, GHQTexInf /* XXX: add to hires texture cache!!! */ _txHiResCache->add(r_crc64, info); - DBG_INFO(80, "GR_TEXFMT_P_8 loaded as gfmt:%x!\n", format); + DBG_INFO(80, "GFX_TEXFMT_P_8 loaded as gfmt:%x!\n", format); } return 1; @@ -596,7 +597,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf DBG_INFO(80, "hirestex: r_crc64:%08X %08X\n", (uint32)(r_crc64 >> 32), (uint32)(r_crc64 & 0xffffffff)); - if (!_txQuantize->quantize(src, _tex1, rowStridePixel, height, (gfmt & 0x00ff), GR_TEXFMT_ARGB_8888)) + if (!_txQuantize->quantize(src, _tex1, rowStridePixel, height, (gfmt & 0x00ff), GFX_TEXFMT_ARGB_8888)) { return 0; } diff --git a/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp b/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp index 5b1d26f3c..df3ad5a46 100644 --- a/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp +++ b/Source/Project64-video/TextureEnhancer/TxHiResCache.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #ifdef _WIN32 #include #endif @@ -365,7 +366,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) if (tmptex) { /* check if _rgb.* and _a.* have matching size and format. */ if (!tex || width != tmpwidth || height != tmpheight || - format != GR_TEXFMT_ARGB_8888 || tmpformat != GR_TEXFMT_ARGB_8888) { + format != GFX_TEXFMT_ARGB_8888 || tmpformat != GFX_TEXFMT_ARGB_8888) { #if !DEBUG INFO(80, "-----\n"); INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str()); @@ -377,7 +378,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) else if (width != tmpwidth || height != tmpheight) { INFO(80, "Error: _rgb.* and _a.* have mismatched width or height!\n"); } - else if (format != GR_TEXFMT_ARGB_8888 || tmpformat != GR_TEXFMT_ARGB_8888) { + else if (format != GFX_TEXFMT_ARGB_8888 || tmpformat != GFX_TEXFMT_ARGB_8888) { INFO(80, "Error: _rgb.* or _a.* not in 32bit color!\n"); } if (tex) free(tex); @@ -506,11 +507,11 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) DBG_INFO(80, "read in as %d x %d gfmt:%x\n", tmpwidth, tmpheight, tmpformat); /* check if size and format are OK */ - if (!(format == GR_TEXFMT_ARGB_8888 || - format == GR_TEXFMT_P_8 || - format == GR_TEXFMT_ARGB_CMP_DXT1 || - format == GR_TEXFMT_ARGB_CMP_DXT3 || - format == GR_TEXFMT_ARGB_CMP_DXT5) || + if (!(format == GFX_TEXFMT_ARGB_8888 || + format == GFX_TEXFMT_P_8 || + format == GFX_TEXFMT_ARGB_CMP_DXT1 || + format == GFX_TEXFMT_ARGB_CMP_DXT3 || + format == GFX_TEXFMT_ARGB_CMP_DXT5) || (width * height) < 4) { /* TxQuantize requirement: width * height must be 4 or larger. */ free(tex); tex = NULL; @@ -524,7 +525,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) } /* analyze and determine best format to quantize */ - if (format == GR_TEXFMT_ARGB_8888) { + if (format == GFX_TEXFMT_ARGB_8888) { int i; int alphabits = 0; int fullalpha = 0; @@ -632,17 +633,17 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) #if !REDUCE_TEXTURE_FOOTPRINT if (_maxbpp < 32 || _options & (FORCE16BPP_HIRESTEX | COMPRESSION_MASK)) { #endif - if (alphabits == 0) destformat = GR_TEXFMT_RGB_565; - else if (alphabits == 1) destformat = GR_TEXFMT_ARGB_1555; - else destformat = GR_TEXFMT_ARGB_8888; + if (alphabits == 0) destformat = GFX_TEXFMT_RGB_565; + else if (alphabits == 1) destformat = GFX_TEXFMT_ARGB_1555; + else destformat = GFX_TEXFMT_ARGB_8888; #if !REDUCE_TEXTURE_FOOTPRINT } else { - destformat = GR_TEXFMT_ARGB_8888; + destformat = GFX_TEXFMT_ARGB_8888; } #endif if (fmt == 4 && alphabits == 0) { - destformat = GR_TEXFMT_ARGB_8888; + destformat = GFX_TEXFMT_ARGB_8888; /* Rice I format; I = (R + G + B) / 3 */ for (i = 0; i < height * width; i++) { uint32 texel = ((uint32*)tex)[i]; @@ -654,11 +655,11 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) } if (intensity) { if (alphabits == 0) { - if (fmt == 4) destformat = GR_TEXFMT_ALPHA_8; - else destformat = GR_TEXFMT_INTENSITY_8; + if (fmt == 4) destformat = GFX_TEXFMT_ALPHA_8; + else destformat = GFX_TEXFMT_INTENSITY_8; } else { - destformat = GR_TEXFMT_ALPHA_INTENSITY_88; + destformat = GFX_TEXFMT_ALPHA_INTENSITY_88; } } @@ -668,7 +669,7 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) * Rice hi-res textures: end */ /* XXX: only ARGB8888 for now. comeback to this later... */ - if (format == GR_TEXFMT_ARGB_8888) { + if (format == GFX_TEXFMT_ARGB_8888) { #if TEXTURE_TILING /* Glide64 style texture tiling */ @@ -864,40 +865,40 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) switch (_options & COMPRESSION_MASK) { case S3TC_COMPRESSION: switch (destformat) { - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: #if GLIDE64_DXTN - case GR_TEXFMT_ARGB_1555: /* for ARGB1555 use DXT5 instead of DXT1 */ + case GFX_TEXFMT_ARGB_1555: /* for ARGB1555 use DXT5 instead of DXT1 */ #endif - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: dataSize = width * height; break; #if !GLIDE64_DXTN - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: #endif - case GR_TEXFMT_RGB_565: - case GR_TEXFMT_INTENSITY_8: + case GFX_TEXFMT_RGB_565: + case GFX_TEXFMT_INTENSITY_8: dataSize = (width * height) >> 1; break; - case GR_TEXFMT_ALPHA_8: /* no size benefit with dxtn */ + case GFX_TEXFMT_ALPHA_8: /* no size benefit with dxtn */ ; } break; case FXT1_COMPRESSION: switch (destformat) { - case GR_TEXFMT_ARGB_1555: - case GR_TEXFMT_RGB_565: - case GR_TEXFMT_INTENSITY_8: + case GFX_TEXFMT_ARGB_1555: + case GFX_TEXFMT_RGB_565: + case GFX_TEXFMT_INTENSITY_8: dataSize = (width * height) >> 1; break; /* XXX: textures that use 8bit alpha channel look bad with the current * fxt1 library, so we substitute it with dxtn for now. afaik all gfx * cards that support fxt1 also support dxtn. (3dfx and Intel) */ - case GR_TEXFMT_ALPHA_INTENSITY_88: - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ARGB_8888: compressionType = S3TC_COMPRESSION; dataSize = width * height; break; - case GR_TEXFMT_ALPHA_8: /* no size benefit with dxtn */ + case GFX_TEXFMT_ALPHA_8: /* no size benefit with dxtn */ ; } } @@ -906,8 +907,8 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) #if 0 /* TEST: dither before compression for better results with gradients */ tmptex = (uint8 *)malloc(_txUtil->sizeofTx(width, height, destformat)); if (tmptex) { - if (_txQuantize->quantize(tex, tmptex, width, height, GR_TEXFMT_ARGB_8888, destformat, 0)) - _txQuantize->quantize(tmptex, tex, width, height, destformat, GR_TEXFMT_ARGB_8888, 0); + if (_txQuantize->quantize(tex, tmptex, width, height, GFX_TEXFMT_ARGB_8888, destformat, 0)) + _txQuantize->quantize(tmptex, tex, width, height, destformat, GFX_TEXFMT_ARGB_8888, 0); free(tmptex); } #endif @@ -951,40 +952,40 @@ bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace) tmptex = (uint8 *)malloc(_txUtil->sizeofTx(width, height, destformat)); if (tmptex) { switch (destformat) { - case GR_TEXFMT_ARGB_8888: - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_4444: #if !REDUCE_TEXTURE_FOOTPRINT if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX) #endif - destformat = GR_TEXFMT_ARGB_4444; + destformat = GFX_TEXFMT_ARGB_4444; break; - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: #if !REDUCE_TEXTURE_FOOTPRINT if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX) #endif - destformat = GR_TEXFMT_ARGB_1555; + destformat = GFX_TEXFMT_ARGB_1555; break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: #if !REDUCE_TEXTURE_FOOTPRINT if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX) #endif - destformat = GR_TEXFMT_RGB_565; + destformat = GFX_TEXFMT_RGB_565; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_44: #if !REDUCE_TEXTURE_FOOTPRINT - destformat = GR_TEXFMT_ALPHA_INTENSITY_88; + destformat = GFX_TEXFMT_ALPHA_INTENSITY_88; #else - destformat = GR_TEXFMT_ALPHA_INTENSITY_44; + destformat = GFX_TEXFMT_ALPHA_INTENSITY_44; #endif break; - case GR_TEXFMT_ALPHA_8: - destformat = GR_TEXFMT_ALPHA_8; /* yes, this is correct. ALPHA_8 instead of INTENSITY_8 */ + case GFX_TEXFMT_ALPHA_8: + destformat = GFX_TEXFMT_ALPHA_8; /* yes, this is correct. ALPHA_8 instead of INTENSITY_8 */ break; - case GR_TEXFMT_INTENSITY_8: - destformat = GR_TEXFMT_INTENSITY_8; + case GFX_TEXFMT_INTENSITY_8: + destformat = GFX_TEXFMT_INTENSITY_8; } - if (_txQuantize->quantize(tex, tmptex, width, height, GR_TEXFMT_ARGB_8888, destformat, 0)) { + if (_txQuantize->quantize(tex, tmptex, width, height, GFX_TEXFMT_ARGB_8888, destformat, 0)) { format = destformat; free(tex); tex = tmptex; diff --git a/Source/Project64-video/TextureEnhancer/TxImage.cpp b/Source/Project64-video/TextureEnhancer/TxImage.cpp index e075dc9df..77af762fc 100644 --- a/Source/Project64-video/TextureEnhancer/TxImage.cpp +++ b/Source/Project64-video/TextureEnhancer/TxImage.cpp @@ -23,6 +23,7 @@ #include "TxReSample.h" #include "TxDbg.h" #include +#include bool TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr) { @@ -66,7 +67,7 @@ bool TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr) uint8* TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) { - /* NOTE: returned image format is GR_TEXFMT_ARGB_8888 */ + /* NOTE: returned image format is GFX_TEXFMT_ARGB_8888 */ png_structp png_ptr; png_infop info_ptr; @@ -193,7 +194,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format) *width = (row_bytes >> 2); *height = o_height; - *format = GR_TEXFMT_ARGB_8888; + *format = GFX_TEXFMT_ARGB_8888; #if POW2_TEXTURES /* next power of 2 size conversions */ @@ -480,8 +481,8 @@ uint8* TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) { /* NOTE: returned image format; - * 4, 8bit palette bmp -> GR_TEXFMT_P_8 - * 24, 32bit bmp -> GR_TEXFMT_ARGB_8888 + * 4, 8bit palette bmp -> GFX_TEXFMT_P_8 + * 24, 32bit bmp -> GFX_TEXFMT_ARGB_8888 */ uint8 *image = NULL; @@ -604,11 +605,11 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format) switch (bmp_ihdr.biBitCount) { case 8: case 4: - *format = GR_TEXFMT_P_8; + *format = GFX_TEXFMT_P_8; break; case 32: case 24: - *format = GR_TEXFMT_ARGB_8888; + *format = GFX_TEXFMT_ARGB_8888; } #if POW2_TEXTURES @@ -764,17 +765,17 @@ TxImage::readDDS(FILE* fp, int* width, int* height, uint16* format) DBG_INFO(80, "DXT1 format\n"); /* compensate for missing LinearSize */ dds_fhdr.dwLinearSize = (dds_fhdr.dwWidth * dds_fhdr.dwHeight) >> 1; - tmpformat = GR_TEXFMT_ARGB_CMP_DXT1; + tmpformat = GFX_TEXFMT_ARGB_CMP_DXT1; } else if (memcmp(&dds_fhdr.ddpf.dwFourCC, "DXT3", 4) == 0) { DBG_INFO(80, "DXT3 format\n"); dds_fhdr.dwLinearSize = dds_fhdr.dwWidth * dds_fhdr.dwHeight; - tmpformat = GR_TEXFMT_ARGB_CMP_DXT3; + tmpformat = GFX_TEXFMT_ARGB_CMP_DXT3; } else if (memcmp(&dds_fhdr.ddpf.dwFourCC, "DXT5", 4) == 0) { DBG_INFO(80, "DXT5 format\n"); dds_fhdr.dwLinearSize = dds_fhdr.dwWidth * dds_fhdr.dwHeight; - tmpformat = GR_TEXFMT_ARGB_CMP_DXT5; + tmpformat = GFX_TEXFMT_ARGB_CMP_DXT5; } else { DBG_INFO(80, "Error: not DXT1 or DXT3 or DXT5 format!\n"); diff --git a/Source/Project64-video/TextureEnhancer/TxQuantize.cpp b/Source/Project64-video/TextureEnhancer/TxQuantize.cpp index de18620fa..1f3e75a92 100644 --- a/Source/Project64-video/TextureEnhancer/TxQuantize.cpp +++ b/Source/Project64-video/TextureEnhancer/TxQuantize.cpp @@ -19,6 +19,7 @@ /* NOTE: The codes are not optimized. They can be made faster. */ #include "TxQuantize.h" +#include TxQuantize::TxQuantize() { @@ -1729,29 +1730,29 @@ TxQuantize::quantize(uint8* src, uint8* dest, int width, int height, uint16 srcf quantizerFunc quantizer; int bpp_shift = 0; - if (destformat == GR_TEXFMT_ARGB_8888) { + if (destformat == GFX_TEXFMT_ARGB_8888) { switch (srcformat) { - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: quantizer = &TxQuantize::ARGB1555_ARGB8888; bpp_shift = 1; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: quantizer = &TxQuantize::ARGB4444_ARGB8888; bpp_shift = 1; break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: quantizer = &TxQuantize::RGB565_ARGB8888; bpp_shift = 1; break; - case GR_TEXFMT_ALPHA_8: + case GFX_TEXFMT_ALPHA_8: quantizer = &TxQuantize::A8_ARGB8888; bpp_shift = 2; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: quantizer = &TxQuantize::AI44_ARGB8888; bpp_shift = 2; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: quantizer = &TxQuantize::AI88_ARGB8888; bpp_shift = 1; break; @@ -1767,30 +1768,30 @@ TxQuantize::quantize(uint8* src, uint8* dest, int width, int height, uint16 srcf } (*this.*quantizer)((uint32*)src, (uint32*)dest, width, height); } - else if (srcformat == GR_TEXFMT_ARGB_8888) { + else if (srcformat == GFX_TEXFMT_ARGB_8888) { switch (destformat) { - case GR_TEXFMT_ARGB_1555: + case GFX_TEXFMT_ARGB_1555: quantizer = fastQuantizer ? &TxQuantize::ARGB8888_ARGB1555 : &TxQuantize::ARGB8888_ARGB1555_ErrD; bpp_shift = 1; break; - case GR_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_4444: quantizer = fastQuantizer ? &TxQuantize::ARGB8888_ARGB4444 : &TxQuantize::ARGB8888_ARGB4444_ErrD; bpp_shift = 1; break; - case GR_TEXFMT_RGB_565: + case GFX_TEXFMT_RGB_565: quantizer = fastQuantizer ? &TxQuantize::ARGB8888_RGB565 : &TxQuantize::ARGB8888_RGB565_ErrD; bpp_shift = 1; break; - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: quantizer = fastQuantizer ? &TxQuantize::ARGB8888_A8 : &TxQuantize::ARGB8888_I8_Slow; bpp_shift = 2; break; - case GR_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_INTENSITY_44: quantizer = fastQuantizer ? &TxQuantize::ARGB8888_AI44 : &TxQuantize::ARGB8888_AI44_ErrD; bpp_shift = 2; break; - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ALPHA_INTENSITY_88: quantizer = fastQuantizer ? &TxQuantize::ARGB8888_AI88 : &TxQuantize::ARGB8888_AI88_Slow; bpp_shift = 1; break; @@ -1846,7 +1847,7 @@ TxQuantize::FXT1(uint8 *src, uint8 *dest, /* dxtn adjusts width and height to M8 and M4 respectively by replication */ *destwidth = (srcwidth + 7) & ~7; *destheight = (srcheight + 3) & ~3; - *destformat = GR_TEXFMT_ARGB_CMP_FXT1; + *destformat = GFX_TEXFMT_ARGB_CMP_FXT1; bRet = 1; } @@ -1876,33 +1877,33 @@ TxQuantize::DXTn(uint8 *src, uint8 *dest, */ /* skip formats that DXTn won't help in size. */ - if (srcformat == GR_TEXFMT_ALPHA_8 || - srcformat == GR_TEXFMT_ALPHA_INTENSITY_44) { + if (srcformat == GFX_TEXFMT_ALPHA_8 || + srcformat == GFX_TEXFMT_ALPHA_INTENSITY_44) { ; /* shutup compiler */ } else { int dstRowStride = ((srcwidth + 3) & ~3) << 2; int compression = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - *destformat = GR_TEXFMT_ARGB_CMP_DXT5; + *destformat = GFX_TEXFMT_ARGB_CMP_DXT5; #if !GLIDE64_DXTN /* okay... we are going to disable DXT1 with 1bit alpha * for Glide64. some textures have all 0 alpha values. * see "N64 Kobe Bryant in NBA Courtside" */ - if (srcformat == GR_TEXFMT_ARGB_1555) { + if (srcformat == GFX_TEXFMT_ARGB_1555) { dstRowStride >>= 1; compression = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - *destformat = GR_TEXFMT_ARGB_CMP_DXT1; + *destformat = GFX_TEXFMT_ARGB_CMP_DXT1; } else #endif - if (srcformat == GR_TEXFMT_RGB_565 || - srcformat == GR_TEXFMT_INTENSITY_8) { + if (srcformat == GFX_TEXFMT_RGB_565 || + srcformat == GFX_TEXFMT_INTENSITY_8) { dstRowStride >>= 1; compression = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - *destformat = GR_TEXFMT_ARGB_CMP_DXT1; + *destformat = GFX_TEXFMT_ARGB_CMP_DXT1; } unsigned int numcore = _numcore; diff --git a/Source/Project64-video/TextureEnhancer/TxUtil.cpp b/Source/Project64-video/TextureEnhancer/TxUtil.cpp index fc00b8af1..8436583c2 100644 --- a/Source/Project64-video/TextureEnhancer/TxUtil.cpp +++ b/Source/Project64-video/TextureEnhancer/TxUtil.cpp @@ -17,6 +17,8 @@ #include #include #include +#include + #ifdef _WIN32 #include #endif @@ -66,29 +68,29 @@ int TxUtil::sizeofTx(int width, int height, uint16 format) /* a lookup table for the shifts would be better */ switch (format) { - case GR_TEXFMT_ARGB_CMP_FXT1: + case GFX_TEXFMT_ARGB_CMP_FXT1: dataSize = (((width + 0x7) & ~0x7) * ((height + 0x3) & ~0x3)) >> 1; break; - case GR_TEXFMT_ARGB_CMP_DXT1: + case GFX_TEXFMT_ARGB_CMP_DXT1: dataSize = (((width + 0x3) & ~0x3) * ((height + 0x3) & ~0x3)) >> 1; break; - case GR_TEXFMT_ARGB_CMP_DXT3: - case GR_TEXFMT_ARGB_CMP_DXT5: + case GFX_TEXFMT_ARGB_CMP_DXT3: + case GFX_TEXFMT_ARGB_CMP_DXT5: dataSize = ((width + 0x3) & ~0x3) * ((height + 0x3) & ~0x3); break; - case GR_TEXFMT_ALPHA_INTENSITY_44: - case GR_TEXFMT_ALPHA_8: - case GR_TEXFMT_INTENSITY_8: - case GR_TEXFMT_P_8: + case GFX_TEXFMT_ALPHA_INTENSITY_44: + case GFX_TEXFMT_ALPHA_8: + case GFX_TEXFMT_INTENSITY_8: + case GFX_TEXFMT_P_8: dataSize = width * height; break; - case GR_TEXFMT_ARGB_4444: - case GR_TEXFMT_ARGB_1555: - case GR_TEXFMT_RGB_565: - case GR_TEXFMT_ALPHA_INTENSITY_88: + case GFX_TEXFMT_ARGB_4444: + case GFX_TEXFMT_ARGB_1555: + case GFX_TEXFMT_RGB_565: + case GFX_TEXFMT_ALPHA_INTENSITY_88: dataSize = (width * height) << 1; break; - case GR_TEXFMT_ARGB_8888: + case GFX_TEXFMT_ARGB_8888: dataSize = (width * height) << 2; break; default: diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index faee81f3d..f58322ff5 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -642,7 +642,7 @@ EXPORT void CALL ProcessDList(void) } while (!rdp.halt); } #ifdef CATCH_EXCEPTIONS -} + } catch (...) { if (g_fullscreen) { @@ -686,7 +686,7 @@ EXPORT void CALL ProcessDList(void) CI_SET = FALSE; } WriteTrace(TraceRDP, TraceDebug, "ProcessDList end"); - } +} // undef - undefined instruction, always ignore void undef() @@ -2098,7 +2098,7 @@ void rdp_settile() if (rdp.aTBuffTex[i]->size == tile->size) { rdp.aTBuffTex[i]->tile = rdp.last_tile; - rdp.aTBuffTex[i]->info.format = tile->format == 0 ? GR_TEXFMT_RGB_565 : GR_TEXFMT_ALPHA_INTENSITY_88; + rdp.aTBuffTex[i]->info.format = tile->format == 0 ? GFX_TEXFMT_RGB_565 : GFX_TEXFMT_ALPHA_INTENSITY_88; WriteTrace(TraceRDP, TraceDebug, "rdp.aTBuffTex[%d] tile=%d, format=%s", i, rdp.last_tile, tile->format == 0 ? "RGB565" : "Alpha88"); } else @@ -2646,7 +2646,7 @@ void rdp_setcolorimage() { GrLOD_t LOD = g_scr_res_x > 1024 ? GR_LOD_LOG2_1024 : GR_LOD_LOG2_2048; grTextureAuxBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0"); } diff --git a/Source/Project64-video/ucode06.cpp b/Source/Project64-video/ucode06.cpp index eecf45d1c..d3f5dbfcb 100644 --- a/Source/Project64-video/ucode06.cpp +++ b/Source/Project64-video/ucode06.cpp @@ -32,7 +32,7 @@ float set_sprite_combine_mode() rdp.allow_combine = 0; // Now actually combine ! GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL; - if (rdp.tbuff_tex && rdp.tbuff_tex->info.format == GR_TEXFMT_ALPHA_INTENSITY_88) + if (rdp.tbuff_tex && rdp.tbuff_tex->info.format == GFX_TEXFMT_ALPHA_INTENSITY_88) color_source = GR_COMBINE_FUNCTION_LOCAL_ALPHA; cmb.tmu1_func = cmb.tmu0_func = color_source; cmb.tmu1_fac = cmb.tmu0_fac = GR_COMBINE_FACTOR_NONE; @@ -130,7 +130,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d) dst += (512 - d.imageW); } GrTexInfo t_info; - t_info.format = GR_TEXFMT_RGB_565; + t_info.format = GFX_TEXFMT_RGB_565; t_info.data = image; t_info.smallLodLog2 = GR_LOD_LOG2_512; t_info.largeLodLog2 = GR_LOD_LOG2_512; @@ -194,7 +194,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d) v[i].vc(0) = v[i].vc(1) = v[i].v0; } grTextureBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grAuxBufferExt(GR_BUFFER_AUXBUFFER); grBufferClear(0, 0, 0xFFFF); @@ -202,7 +202,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d) grDrawTriangle(&v[2], &v[3], &v[1]); grRenderBuffer(GR_BUFFER_BACKBUFFER); grTextureAuxBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD, - GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); + GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); grDepthMask(FXTRUE); }