Add r_2D_unfiltered CVar, improve r_nolerp_list handling

Setting r_2D_unfiltered to 1 (0 is default), 2D elements (GUI, menu,
console) are rendered without texture filtering in GL1 and GL3, while
everything else is still rendered with whatever is set in gl_texturemode

This setting (and now also gl_nolerp_list) is applied immediately,
so no vid_restart is needed.

3873c76e12
This commit is contained in:
Denis Pauk 2021-10-31 20:22:11 +02:00
parent 049f26a212
commit 0ee36fc801
3 changed files with 46 additions and 24 deletions

View file

@ -141,7 +141,8 @@ extern cvar_t *vk_sampleshading;
extern cvar_t *vk_device_idx;
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
extern cvar_t *vk_nolerp_list;
extern cvar_t *r_nolerp_list;
extern cvar_t *r_2D_unfiltered;
extern cvar_t *vk_pixel_size;
extern cvar_t *r_fixsurfsky;

View file

@ -670,9 +670,23 @@ void Vk_TextureMode( char *string )
vkDeviceWaitIdle(vk_device.logical);
for (j = 0, image = vktextures; j < numvktextures; j++, image++)
{
qboolean nolerp = false;
if (image->vk_texture.resource.image == VK_NULL_HANDLE)
continue;
if (r_2D_unfiltered->value && image->type == it_pic)
{
nolerp = true;
}
else if (r_nolerp_list != NULL && r_nolerp_list->string != NULL)
{
// skip console characters - we want them unfiltered at all times
if (image->vk_texture.resource.image != VK_NULL_HANDLE && Q_stricmp(image->name, "pics/conchars.pcx"))
nolerp = strstr(r_nolerp_list->string, image->name) != NULL;
}
if(!nolerp)
QVk_UpdateTextureSampler(&image->vk_texture, i, image->vk_texture.clampToEdge);
}
@ -1073,9 +1087,13 @@ Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
qboolean nolerp = false;
if (vk_nolerp_list != NULL && vk_nolerp_list->string != NULL)
if (r_2D_unfiltered->value && type == it_pic)
{
nolerp = strstr(vk_nolerp_list->string, name) != NULL;
nolerp = true;
}
else if (r_nolerp_list != NULL && r_nolerp_list->string != NULL)
{
nolerp = strstr(r_nolerp_list->string, name) != NULL;
}
{

View file

@ -127,7 +127,8 @@ cvar_t *vk_device_idx;
cvar_t *r_retexturing;
cvar_t *r_scale8bittextures;
static cvar_t *vk_underwater;
cvar_t *vk_nolerp_list;
cvar_t *r_nolerp_list;
cvar_t *r_2D_unfiltered;
cvar_t *r_fixsurfsky;
cvar_t *vid_fullscreen;
@ -1191,7 +1192,9 @@ R_Register( void )
r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE);
vk_underwater = ri.Cvar_Get("vk_underwater", "1", CVAR_ARCHIVE);
/* don't bilerp characters and crosshairs */
vk_nolerp_list = ri.Cvar_Get("r_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);
r_nolerp_list = ri.Cvar_Get("r_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);
/* don't bilerp any 2D elements */
r_2D_unfiltered = ri.Cvar_Get("r_2D_unfiltered", "0", CVAR_ARCHIVE);
r_fixsurfsky = ri.Cvar_Get("r_fixsurfsky", "0", CVAR_ARCHIVE);
// clamp vk_msaa to accepted range so that video menu doesn't crash on us
@ -1402,18 +1405,17 @@ RE_BeginFrame( float camera_separation )
/*
** change modes if necessary
*/
if (r_mode->modified || vk_msaa->modified || r_clear->modified || vk_picmip->modified ||
vk_validation->modified || vk_texturemode->modified || vk_lmaptexturemode->modified ||
vk_aniso->modified || vk_mip_nearfilter->modified || vk_sampleshading->modified ||
r_vsync->modified || vk_device_idx->modified || vk_overbrightbits->modified)
if (vk_texturemode->modified || vk_lmaptexturemode->modified ||
r_nolerp_list->modified || r_2D_unfiltered->modified ||
vk_aniso->modified)
{
if (vk_texturemode->modified || vk_lmaptexturemode->modified || vk_aniso->modified)
{
if (vk_texturemode->modified || vk_aniso->modified)
if (vk_texturemode->modified || vk_aniso->modified ||
r_nolerp_list->modified || r_2D_unfiltered->modified)
{
Vk_TextureMode(vk_texturemode->string);
vk_texturemode->modified = false;
}
if (vk_lmaptexturemode->modified || vk_aniso->modified)
{
Vk_LmapTextureMode(vk_lmaptexturemode->string);
@ -1421,7 +1423,8 @@ RE_BeginFrame( float camera_separation )
}
vk_aniso->modified = false;
}
r_nolerp_list->modified = false;
r_2D_unfiltered->modified = false;
}
if (QVk_BeginFrame(&vk_viewport, &vk_scissor) == VK_SUCCESS)