From 1e0d75857ba64b60d6a68d6e78fd542a6f429cd1 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sun, 17 Oct 2021 11:11:05 +0300 Subject: [PATCH] Use separate r_scale8bittextures for image scale Rename {sw,gl}_retexturing variables to r_retexturing in code. --- doc/040_cvarlist.md | 3 ++- src/client/refresh/gl1/gl1_image.c | 6 +++--- src/client/refresh/gl1/gl1_main.c | 6 ++++-- src/client/refresh/gl1/header/local.h | 3 ++- src/client/refresh/gl3/gl3_image.c | 6 +++--- src/client/refresh/gl3/gl3_main.c | 8 +++++--- src/client/refresh/gl3/header/local.h | 3 ++- src/client/refresh/soft/header/local.h | 3 ++- src/client/refresh/soft/sw_draw.c | 4 ++-- src/client/refresh/soft/sw_image.c | 4 ++-- src/client/refresh/soft/sw_main.c | 6 ++++-- 11 files changed, 31 insertions(+), 21 deletions(-) diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index 5847ff9f..d4951091 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -281,7 +281,8 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` * **r_retexturing**: If set to `1` (the default) and a retexturing pack is installed, the high resolution textures are used. - If set to `2` and vulkan render is used, scale up all 8bit textures. + +* **r_scale8bittextures**: If set to `1`, scale up all 8bit textures. * **r_shadows**: Enables rendering of shadows. Quake IIs shadows are very simple and are prone to render errors. diff --git a/src/client/refresh/gl1/gl1_image.c b/src/client/refresh/gl1/gl1_image.c index 17bffcb5..d3240f5f 100644 --- a/src/client/refresh/gl1/gl1_image.c +++ b/src/client/refresh/gl1/gl1_image.c @@ -939,7 +939,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth, if (bits == 8) { // resize 8bit images only when we forced such logic - if (gl_retexturing->value >= 2) + if (r_scale8bittextures->value) { byte *image_converted = malloc(width * height * 4); scale2x(pic, image_converted, width, height); @@ -1173,7 +1173,7 @@ R_FindImage(char *name, imagetype_t type) if (strcmp(ext, "pcx") == 0) { - if (gl_retexturing->value) + if (r_retexturing->value) { GetPCXInfo(name, &realwidth, &realheight); if(realwidth == 0) @@ -1220,7 +1220,7 @@ R_FindImage(char *name, imagetype_t type) } else if (strcmp(ext, "wal") == 0 || strcmp(ext, "m8") == 0) { - if (gl_retexturing->value) + if (r_retexturing->value) { /* Get size of the original texture */ if (strcmp(ext, "m8") == 0) diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index f55579db..6417f15f 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -100,7 +100,8 @@ cvar_t *r_fixsurfsky; cvar_t *r_customwidth; cvar_t *r_customheight; -cvar_t *gl_retexturing; +cvar_t *r_retexturing; +cvar_t *r_scale8bittextures; cvar_t *gl_nolerp_list; @@ -1260,7 +1261,8 @@ R_Register(void) r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE); gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); - gl_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); /* don't bilerp characters and crosshairs */ gl_nolerp_list = ri.Cvar_Get("r_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0); diff --git a/src/client/refresh/gl1/header/local.h b/src/client/refresh/gl1/header/local.h index f0257eca..da7ed17a 100644 --- a/src/client/refresh/gl1/header/local.h +++ b/src/client/refresh/gl1/header/local.h @@ -191,7 +191,8 @@ extern cvar_t *r_mode; extern cvar_t *r_customwidth; extern cvar_t *r_customheight; -extern cvar_t *gl_retexturing; +extern cvar_t *r_retexturing; +extern cvar_t *r_scale8bittextures; extern cvar_t *gl_nolerp_list; diff --git a/src/client/refresh/gl3/gl3_image.c b/src/client/refresh/gl3/gl3_image.c index c9ff9364..f8e6d286 100644 --- a/src/client/refresh/gl3/gl3_image.c +++ b/src/client/refresh/gl3/gl3_image.c @@ -431,7 +431,7 @@ GL3_LoadPic(char *name, byte *pic, int width, int realwidth, if (bits == 8) { // resize 8bit images only when we forced such logic - if (gl_retexturing->value >= 2) + if (r_scale8bittextures->value) { byte *image_converted = malloc(width * height * 4); scale2x(pic, image_converted, width, height); @@ -746,7 +746,7 @@ GL3_FindImage(char *name, imagetype_t type) if (strcmp(ext, "pcx") == 0) { - if (gl_retexturing->value) + if (r_retexturing->value) { GetPCXInfo(name, &realwidth, &realheight); if(realwidth == 0) @@ -793,7 +793,7 @@ GL3_FindImage(char *name, imagetype_t type) } else if (strcmp(ext, "wal") == 0 || strcmp(ext, "m8") == 0) { - if (gl_retexturing->value) + if (r_retexturing->value) { /* Get size of the original texture */ if (strcmp(ext, "m8") == 0) diff --git a/src/client/refresh/gl3/gl3_main.c b/src/client/refresh/gl3/gl3_main.c index f6d10a67..7cef6bec 100644 --- a/src/client/refresh/gl3/gl3_main.c +++ b/src/client/refresh/gl3/gl3_main.c @@ -79,7 +79,8 @@ const hmm_mat4 gl3_identityMat4 = {{ cvar_t *gl_msaa_samples; cvar_t *r_vsync; -cvar_t *gl_retexturing; +cvar_t *r_retexturing; +cvar_t *r_scale8bittextures; cvar_t *vid_fullscreen; cvar_t *r_mode; cvar_t *r_customwidth; @@ -197,7 +198,8 @@ GL3_Register(void) gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); r_vsync = ri.Cvar_Get("r_vsync", "1", CVAR_ARCHIVE); gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); - gl_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); gl3_debugcontext = ri.Cvar_Get("gl3_debugcontext", "0", 0); r_mode = ri.Cvar_Get("r_mode", "4", CVAR_ARCHIVE); r_customwidth = ri.Cvar_Get("r_customwidth", "1024", CVAR_ARCHIVE); @@ -299,7 +301,7 @@ GL3_Register(void) //r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE); //gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); - //gl_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + //r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); gl1_stereo = ri.Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); diff --git a/src/client/refresh/gl3/header/local.h b/src/client/refresh/gl3/header/local.h index 2ba06dc9..be02fa62 100644 --- a/src/client/refresh/gl3/header/local.h +++ b/src/client/refresh/gl3/header/local.h @@ -480,7 +480,8 @@ extern void GL3_UpdateUBOLights(void); extern cvar_t *gl_msaa_samples; extern cvar_t *r_vsync; -extern cvar_t *gl_retexturing; +extern cvar_t *r_retexturing; +extern cvar_t *r_scale8bittextures; extern cvar_t *vid_fullscreen; extern cvar_t *r_mode; extern cvar_t *r_customwidth; diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index c092a9da..89aa59ab 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -424,7 +424,8 @@ extern cvar_t *sw_stipplealpha; extern cvar_t *sw_surfcacheoverride; extern cvar_t *sw_waterwarp; extern cvar_t *sw_gunzposition; -extern cvar_t *sw_retexturing; +extern cvar_t *r_retexturing; +extern cvar_t *r_scale8bittextures; extern cvar_t *r_fullbright; extern cvar_t *r_lefthand; diff --git a/src/client/refresh/soft/sw_draw.c b/src/client/refresh/soft/sw_draw.c index 08f55f23..d078236c 100644 --- a/src/client/refresh/soft/sw_draw.c +++ b/src/client/refresh/soft/sw_draw.c @@ -339,7 +339,7 @@ RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data) // we have only one image size pic.mip_levels = 1; - if (sw_retexturing->value) + if (r_retexturing->value) { if (cols < (w / 3) || rows < (h / 3)) { @@ -373,7 +373,7 @@ RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data) RE_Draw_StretchPicImplementation (x, y, w, h, &pic); - if (sw_retexturing->value) + if (r_retexturing->value) { free(image_scaled); } diff --git a/src/client/refresh/soft/sw_image.c b/src/client/refresh/soft/sw_image.c index 80fbf45e..5c15ee24 100644 --- a/src/client/refresh/soft/sw_image.c +++ b/src/client/refresh/soft/sw_image.c @@ -581,7 +581,7 @@ R_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type) image_t *image = NULL; // with retexturing and not skin - if (sw_retexturing->value) + if (r_retexturing->value) { image = R_LoadHiColorImage(name, namewe, ext, type); } @@ -598,7 +598,7 @@ R_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type) if (!pic) return NULL; - if (sw_retexturing->value == 2 && type == it_pic) + if (r_scale8bittextures->value && type == it_pic) { byte *scaled = NULL; int realwidth, realheight; diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 8c56ec1d..e5db71b5 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -146,7 +146,8 @@ static cvar_t *sw_overbrightbits; cvar_t *sw_custom_particles; static cvar_t *sw_anisotropic; cvar_t *sw_texture_filtering; -cvar_t *sw_retexturing; +cvar_t *r_retexturing; +cvar_t *r_scale8bittextures; cvar_t *sw_gunzposition; static cvar_t *sw_partialrefresh; @@ -375,7 +376,8 @@ R_RegisterVariables (void) sw_custom_particles = ri.Cvar_Get("sw_custom_particles", "0", CVAR_ARCHIVE); sw_texture_filtering = ri.Cvar_Get("sw_texture_filtering", "0", CVAR_ARCHIVE); sw_anisotropic = ri.Cvar_Get("r_anisotropic", "0", CVAR_ARCHIVE); - sw_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); sw_gunzposition = ri.Cvar_Get("sw_gunzposition", "8", CVAR_ARCHIVE); // On MacOS texture is cleaned up after render and code have to copy a whole