]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
removed r_precachetextures cvar
[xonotic/darkplaces.git] / gl_textures.c
index 1b3858fd6fb4d1e4a8175b43633605d7ee8895c8..25074722fc49283cd7acde7dccd37b5021cd0dbc 100644 (file)
@@ -8,7 +8,6 @@ cvar_t gl_max_size = {CVAR_SAVE, "gl_max_size", "2048", "maximum allowed texture
 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)"};
 cvar_t gl_texture_anisotropy = {CVAR_SAVE, "gl_texture_anisotropy", "1", "anisotropic filtering quality (if supported by hardware), 1 sample (no anisotropy) and 8 sample (8 tap anisotropy) are recommended values"};
 cvar_t gl_texturecompression = {CVAR_SAVE, "gl_texturecompression", "0", "whether to compress textures, a value of 0 disables compression (even if the individual cvars are 1), 1 enables fast (low quality) compression at startup, 2 enables slow (high quality) compression at startup"};
 cvar_t gl_texturecompression_color = {CVAR_SAVE, "gl_texturecompression_color", "1", "whether to compress colormap (diffuse) textures"};
@@ -600,7 +599,6 @@ void R_Textures_Init (void)
        Cvar_RegisterVariable (&gl_picmip);
        Cvar_RegisterVariable (&gl_max_lightmapsize);
        Cvar_RegisterVariable (&r_lerpimages);
-       Cvar_RegisterVariable (&r_precachetextures);
        Cvar_RegisterVariable (&gl_texture_anisotropy);
        Cvar_RegisterVariable (&gl_texturecompression);
        Cvar_RegisterVariable (&gl_texturecompression_color);
@@ -963,7 +961,6 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
        gltexture_t *glt;
        gltexturepool_t *pool = (gltexturepool_t *)rtexturepool;
        textypeinfo_t *texinfo;
-       int precache;
 
        if (cls.state == ca_dedicated)
                return NULL;
@@ -1063,45 +1060,13 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
 
        GL_Texture_CalcImageSize(glt->texturetype, glt->flags, glt->inputwidth, glt->inputheight, glt->inputdepth, &glt->tilewidth, &glt->tileheight, &glt->tiledepth);
 
-       precache = false;
-       if (glt->flags & TEXF_ALWAYSPRECACHE)
-               precache = true;
-       else if (r_precachetextures.integer >= 2)
-               precache = true;
-       else if (r_precachetextures.integer >= 1)
-               if (glt->flags & TEXF_PRECACHE)
-                       precache = true;
-
-       if (precache)
-       {
-               // immediate upload (most common case)
-               // data may be NULL (blank texture for dynamic rendering)
-               CHECKGLERROR
-               qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR
-               R_Upload(glt, data, 0, 0, 0, glt->inputwidth, glt->inputheight, glt->inputdepth);
-               if ((glt->flags & TEXF_ALLOWUPDATES) && gl_nopartialtextureupdates.integer)
-                       glt->bufferpixels = Mem_Alloc(texturemempool, glt->tilewidth*glt->tileheight*glt->tiledepth*glt->sides*glt->bytesperpixel);
-       }
-       else if (data)
-       {
-               // deferred texture upload (menu graphics)
-               // optimize first if possible
-               if ((textype == TEXTYPE_BGRA || textype == TEXTYPE_RGBA) && glt->inputwidth * glt->inputheight * glt->inputdepth > glt->tilewidth * glt->tileheight * glt->tiledepth)
-               {
-                       glt->inputtexels = (unsigned char *)Mem_Alloc(texturemempool, glt->tilewidth*glt->tileheight*glt->tiledepth*glt->sides*glt->bytesperpixel);
-                       Image_Resample32(data, glt->inputwidth, glt->inputheight, glt->inputdepth, glt->inputtexels, glt->tilewidth, glt->tileheight, glt->tiledepth, r_lerpimages.integer);
-                       // change texture size accordingly
-                       glt->inputwidth = glt->tilewidth;
-                       glt->inputheight = glt->tileheight;
-                       glt->inputdepth = glt->tiledepth;
-                       GL_Texture_CalcImageSize(glt->texturetype, glt->flags, glt->inputwidth, glt->inputheight, glt->inputdepth, &glt->tilewidth, &glt->tileheight, &glt->tiledepth);
-               }
-               else
-               {
-                       glt->inputtexels = (unsigned char *)Mem_Alloc(texturemempool, size);
-                       memcpy(glt->inputtexels, data, size);
-               }
-       }
+       // upload the texture
+       // data may be NULL (blank texture for dynamic rendering)
+       CHECKGLERROR
+       qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR
+       R_Upload(glt, data, 0, 0, 0, glt->inputwidth, glt->inputheight, glt->inputdepth);
+       if ((glt->flags & TEXF_ALLOWUPDATES) && gl_nopartialtextureupdates.integer)
+               glt->bufferpixels = Mem_Alloc(texturemempool, glt->tilewidth*glt->tileheight*glt->tiledepth*glt->sides*glt->bytesperpixel);
 
        // texture converting and uploading can take a while, so make sure we're sending keepalives
        CL_KeepaliveMessage(false);
@@ -1131,7 +1096,7 @@ rtexture_t *R_LoadTextureRectangle(rtexturepool_t *rtexturepool, const char *ide
 
 static int R_ShadowMapTextureFlags(int precision, qboolean filter)
 {
-       int flags = TEXF_ALWAYSPRECACHE | TEXF_CLAMP;
+       int flags = TEXF_CLAMP;
        if (filter)
                flags |= TEXF_FORCELINEAR | TEXF_COMPARE;
        else