From 86871184c96948415abbd8c29d7df0f5951b1173 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 8 Dec 2009 22:56:20 +0000 Subject: [PATCH] added gl_max_lightmapsize minor cleanup to TEXF_PICMIP handling git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9570 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gl_textures.c b/gl_textures.c index d4373650..95e1fbf1 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -4,7 +4,8 @@ #include "jpeg.h" #include "image_png.h" -cvar_t gl_max_size = {CVAR_SAVE, "gl_max_size", "2048", "maximum allowed texture size, can be used to reduce video memory usage, note: this is automatically reduced to match video card capabilities (such as 256 on 3Dfx cards before Voodoo4/5)"}; +cvar_t gl_max_size = {CVAR_SAVE, "gl_max_size", "2048", "maximum allowed texture size, can be used to reduce video memory usage, limited by hardware capabilities (typically 2048, 4096, or 8192)"}; +cvar_t gl_max_lightmapsize = {CVAR_SAVE, "gl_max_lightmapsize", "1024", "maximum allowed texture size for lightmap textures, use larger values to improve rendering speed, as long as there is enough video memory available (setting it too high for the hardware will cause very bad performance)"}; cvar_t gl_picmip = {CVAR_SAVE, "gl_picmip", "0", "reduces resolution of textures by powers of 2, for example 1 will halve width/height, reducing texture memory usage by 75%"}; cvar_t r_lerpimages = {CVAR_SAVE, "r_lerpimages", "1", "bilinear filters images when scaling them up to power of 2 size (mode 1), looks better than glquake (mode 0)"}; cvar_t r_precachetextures = {CVAR_SAVE, "r_precachetextures", "1", "0 = never upload textures until used, 1 = upload most textures before use (exceptions: rarely used skin colormap layers), 2 = upload all textures before use (can increase texture memory usage significantly)"}; @@ -413,14 +414,16 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int inwidth, in { int picmip = 0, maxsize = 0, width2 = 1, height2 = 1, depth2 = 1; - if (gl_max_size.integer > (int)vid.maxtexturesize_2d) - Cvar_SetValue("gl_max_size", vid.maxtexturesize_2d); - switch (texturetype) { default: case GLTEXTURETYPE_2D: maxsize = vid.maxtexturesize_2d; + if (flags & TEXF_PICMIP) + { + maxsize = bound(1, gl_max_size.integer, maxsize); + picmip = gl_picmip.integer; + } break; case GLTEXTURETYPE_3D: maxsize = vid.maxtexturesize_3d; @@ -430,12 +433,6 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int inwidth, in break; } - if (flags & TEXF_PICMIP) - { - maxsize = min(maxsize, gl_max_size.integer); - picmip = gl_picmip.integer; - } - if (outwidth) { if (vid.support.arb_texture_non_power_of_two) -- 2.39.2