Try to tighten up when some compressed pixelformats are available a little.

This commit is contained in:
Shpoike 2021-11-12 02:32:31 +00:00
parent 4ec4cde5f4
commit 996621b3ec
3 changed files with 43 additions and 6 deletions

View file

@ -1871,7 +1871,7 @@ void Mod_LoadMD5MeshModel (qmodel_t *mod, const void *buffer)
{
q_snprintf(texname, sizeof(texname), "progs/%s_%02u_%02u", com_token, surf->numskins, f);
data = Image_LoadImage (texname, &fwidth, &fheight, &fmt, &malloced);
data = Image_LoadImage (texname, (int*)&fwidth, (int*)&fheight, &fmt, &malloced);
//now load whatever we found
if (data) //load external image
{

View file

@ -68,22 +68,58 @@ static struct
{"RGBA8", "RGBA", GL_RGBA,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8_REV, 4, 1, 1, NULL},
{"RGB8", "RGB", GL_RGB,GL_RGB,GL_UNSIGNED_BYTE, 3, 1, 1, NULL},
#ifdef GL_RGB565 //gles3
{"RGB565", "565", GL_RGB565,GL_RGB,GL_UNSIGNED_SHORT_5_6_5, 2, 1, 1, NULL},
#else //gles2-compat
{"RGB565", "565", GL_RGB,GL_RGB,GL_UNSIGNED_SHORT_5_6_5, 2, 1, 1, NULL},
#endif
{"RGBA4444", "4444", GL_RGBA4,GL_RGBA,GL_UNSIGNED_SHORT_4_4_4_4, 2, 1, 1, NULL},
{"RGBA5551", "5551", GL_RGB5_A1,GL_RGBA,GL_UNSIGNED_SHORT_5_5_5_1, 2, 1, 1, NULL},
{"L8", "LUM8", GL_LUMINANCE8,GL_LUMINANCE,GL_UNSIGNED_BYTE, 1, 1, 1, NULL},
{"E5BGR9", "EXP5", GL_RGB9_E5,GL_RGB,GL_UNSIGNED_INT_5_9_9_9_REV, 4, 1, 1, &gl_texture_astc},
{"E5BGR9", "EXP5", GL_RGB9_E5,GL_RGB,GL_UNSIGNED_INT_5_9_9_9_REV, 4, 1, 1, &gl_texture_rgtc/*gl3*/},
#if defined(GL_EXT_texture_compression_s3tc) || defined(GL_EXT_texture_compression_dxt1)
{"BC1_RGBA", "BC1", GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,0,0, 8, 4, 4, &gl_texture_s3tc},
#endif
#if defined(GL_EXT_texture_compression_s3tc)
{"BC2_RGBA", "BC2", GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,0,0, 16, 4, 4, &gl_texture_s3tc},
{"BC3_RGBA", "BC3", GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,0,0, 16, 4, 4, &gl_texture_s3tc},
#endif
#ifdef GL_VERSION_3_0
{"BC4_R", "BC4", GL_COMPRESSED_RED_RGTC1,0,0, 8, 4, 4, &gl_texture_rgtc},
{"BC5_RG", "BC5", GL_COMPRESSED_RG_RGTC2,0,0, 16, 4, 4, &gl_texture_rgtc},
#elif defined(GL_EXT_texture_compression_rgtc)
{"BC4_R", "BC4", GL_COMPRESSED_RED_RGTC1_EXT,0,0, 8, 4, 4, &gl_texture_rgtc},
{"BC5_RG", "BC5", GL_COMPRESSED_RED_GREEN_RGTC2_EXT,0,0, 16, 4, 4, &gl_texture_rgtc},
#endif
#ifdef GL_VERSION_4_2
{"BC6_RGB_UFLOAT","BC6",GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,0,0, 16, 4, 4, &gl_texture_bptc},
{"BC7_RGBA", "BC7", GL_COMPRESSED_RGBA_BPTC_UNORM,0,0, 16, 4, 4, &gl_texture_bptc},
#elif defined(GL_EXT_texture_compression_bptc)
{"BC6_RGB_UFLOAT","BC6",GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,0,0, 16, 4, 4, &gl_texture_bptc},
{"BC7_RGBA", "BC7", GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,0,0, 16, 4, 4, &gl_texture_bptc},
#endif
#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_4_3)
{"ETC1_RGB8", "ETC1", GL_COMPRESSED_RGB8_ETC2,0,0, 8, 4, 4, &gl_texture_etc2},
{"ETC2_RGB8", "ETC2", GL_COMPRESSED_RGB8_ETC2,0,0, 8, 4, 4, &gl_texture_etc2},
{"ETC2_RGB8A1", "ETCP", GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,0,0, 8, 4, 4, &gl_texture_etc2},
{"ETC2_RGB8A8", "ETCA", GL_COMPRESSED_RGBA8_ETC2_EAC,0,0, 16, 4, 4, &gl_texture_etc2},
#endif
#ifdef GL_ES_VERSION_3_2
{"ASTC_4X4", "AST4", GL_COMPRESSED_RGBA_ASTC_4x4,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_5X4", "AS54", GL_COMPRESSED_RGBA_ASTC_5x4,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_5X5", "AST5", GL_COMPRESSED_RGBA_ASTC_5x5,0,0, 16, 5, 5, &gl_texture_astc},
{"ASTC_6X5", "AS65", GL_COMPRESSED_RGBA_ASTC_6x5,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_6X6", "AST6", GL_COMPRESSED_RGBA_ASTC_6x6,0,0, 16, 6, 6, &gl_texture_astc},
{"ASTC_8X5", "AS85", GL_COMPRESSED_RGBA_ASTC_8x5,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_8X6", "AS86", GL_COMPRESSED_RGBA_ASTC_8x6,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_8X8", "AST8", GL_COMPRESSED_RGBA_ASTC_8x8,0,0, 16, 8, 8, &gl_texture_astc},
{"ASTC_10X5", "AS05", GL_COMPRESSED_RGBA_ASTC_10x5,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_10X6", "AS06", GL_COMPRESSED_RGBA_ASTC_10x6,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_10X8", "AS08", GL_COMPRESSED_RGBA_ASTC_10x8,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_10X10", "AST0", GL_COMPRESSED_RGBA_ASTC_10x10,0,0, 16, 8, 8, &gl_texture_astc},
{"ASTC_12X10", "AST0", GL_COMPRESSED_RGBA_ASTC_12x10,0,0, 16, 8, 8, &gl_texture_astc},
{"ASTC_12X12", "AST2", GL_COMPRESSED_RGBA_ASTC_12x12,0,0, 16, 8, 8, &gl_texture_astc},
#elif defined(GL_KHR_texture_compression_astc_ldr)
{"ASTC_4X4", "AST4", GL_COMPRESSED_RGBA_ASTC_4x4_KHR,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_5X4", "AS54", GL_COMPRESSED_RGBA_ASTC_5x4_KHR,0,0, 16, 4, 4, &gl_texture_astc},
{"ASTC_5X5", "AST5", GL_COMPRESSED_RGBA_ASTC_5x5_KHR,0,0, 16, 5, 5, &gl_texture_astc},
@ -98,6 +134,7 @@ static struct
{"ASTC_10X10", "AST0", GL_COMPRESSED_RGBA_ASTC_10x10_KHR,0,0, 16, 8, 8, &gl_texture_astc},
{"ASTC_12X10", "AST0", GL_COMPRESSED_RGBA_ASTC_12x10_KHR,0,0, 16, 8, 8, &gl_texture_astc},
{"ASTC_12X12", "AST2", GL_COMPRESSED_RGBA_ASTC_12x12_KHR,0,0, 16, 8, 8, &gl_texture_astc},
#endif
};
/*

View file

@ -1159,12 +1159,12 @@ static void GL_CheckExtensions (void)
Con_Warning ("texture_non_power_of_two not supported\n");
}
GL_CompressedTexImage2D = (gl_version_major>=2||(gl_version_major==1&&gl_version_major>=3))?(QS_PFNGLCOMPRESSEDTEXIMAGE2DPROC) SDL_GL_GetProcAddress("glCompressedTexImage2D"):NULL;
GL_CompressedTexImage2D = (gl_version_major>=2||(gl_version_major==1&&gl_version_minor>=3))?(QS_PFNGLCOMPRESSEDTEXIMAGE2DPROC) SDL_GL_GetProcAddress("glCompressedTexImage2D"):NULL;
gl_texture_s3tc = GL_CompressedTexImage2D && ( GL_ParseExtensionList(gl_extensions, "GL_EXT_texture_compression_s3tc"));
gl_texture_rgtc = GL_CompressedTexImage2D && (gl_version_major >= 3 || GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_compression_rgtc"));
gl_texture_bptc = GL_CompressedTexImage2D && (gl_version_major > 4 || (gl_version_major == 4 && gl_version_minor >= 2) || GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_compression_bptc"));
gl_texture_etc2 = GL_CompressedTexImage2D && (gl_version_major > 4 || (gl_version_major == 4 && gl_version_minor >= 3) || GL_ParseExtensionList(gl_extensions, "GL_ARB_ES3_compatibility"));
gl_texture_astc = GL_CompressedTexImage2D && (gl_version_major > 4 || (gl_version_major == 4 && gl_version_minor >= 3) || GL_ParseExtensionList(gl_extensions, "GL_ARB_ES3_2_compatibility") || GL_ParseExtensionList(gl_extensions, "GL_KHR_texture_compression_astc_ldr"));
gl_texture_astc = GL_CompressedTexImage2D && ( GL_ParseExtensionList(gl_extensions, "GL_ARB_ES3_2_compatibility") || GL_ParseExtensionList(gl_extensions, "GL_KHR_texture_compression_astc_ldr"));
// GLSL
//