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"};
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);
gltexture_t *glt;
gltexturepool_t *pool = (gltexturepool_t *)rtexturepool;
textypeinfo_t *texinfo;
- int precache;
if (cls.state == ca_dedicated)
return NULL;
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);
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