Polymost: Avoid generation of mipmaps if filter mode isn't set to use them

git-svn-id: https://svn.eduke32.com/eduke32@6654 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2018-02-16 06:38:05 +00:00
parent a1c88b740f
commit 28f9fcebb4

View file

@ -966,6 +966,14 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t texfmt,
if (hi && !nodownsize && r_downsize > miplevel)
miplevel = r_downsize;
// don't use mipmaps if mipmapping is disabled
if (glfiltermodes[gltexfiltermode].min == GL_NEAREST ||
glfiltermodes[gltexfiltermode].min == GL_LINEAR)
{
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
}
if (!miplevel)
Polymost_SendTexToDriver(doalloc, siz, texfmt, pic,
intexfmt,
@ -975,6 +983,13 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t texfmt,
#endif
0);
// don't generate mipmaps if we're not going to use them
if (glfiltermodes[gltexfiltermode].min == GL_NEAREST ||
glfiltermodes[gltexfiltermode].min == GL_LINEAR)
{
return;
}
vec2_t siz2 = siz;
for (bssize_t j=1; (siz2.x > 1) || (siz2.y > 1); j++)
@ -6182,7 +6197,7 @@ void polymost_initosdfuncs(void)
{ "r_anisotropy", "changes the OpenGL texture anisotropy setting", (void *) &glanisotropy, CVAR_INT|CVAR_FUNCPTR, 0, 16 },
{ "r_texturemaxsize","changes the maximum OpenGL texture size limit",(void *) &gltexmaxsize, CVAR_INT | CVAR_NOSAVE, 0, 4096 },
{ "r_texturemiplevel","changes the highest OpenGL mipmap level used",(void *) &gltexmiplevel, CVAR_INT, 0, 6 },
{ "r_texfilter", "changes the texture filtering settings", (void *) &gltexfiltermode, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_texfilter", "changes the texture filtering settings (may require restart)", (void *) &gltexfiltermode, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_usenewshading",
"visibility/fog code: 0: orig. Polymost 1: 07/2011 2: linear 12/2012 3: no neg. start 03/2014 4: base constant on shade table 11/2017",