diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 5e40cd02d..026e96c33 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -68,6 +68,8 @@ cvar_t *cvar_pt_projection = NULL; cvar_t *cvar_pt_dof = NULL; cvar_t* cvar_pt_freecam = NULL; cvar_t *cvar_pt_nearest = NULL; +cvar_t *cvar_pt_bilerp_chars = NULL; +cvar_t *cvar_pt_bilerp_pics = NULL; cvar_t *cvar_drs_enable = NULL; cvar_t *cvar_drs_target = NULL; cvar_t *cvar_drs_minscale = NULL; @@ -3568,13 +3570,20 @@ R_Init_RTX(bool total) // freecam mode toggle cvar_pt_freecam = Cvar_Get("pt_freecam", "1", CVAR_ARCHIVE); - // texture filtering mode: + // texture filtering mode for non-UI elements: // 0 -> linear magnification, anisotropic minification // 1 -> nearest magnification, anisotropic minification // 2 -> nearest magnification and minification, no mipmaps (noisy) cvar_pt_nearest = Cvar_Get("pt_nearest", "0", CVAR_ARCHIVE); cvar_pt_nearest->changed = pt_nearest_changed; + // texture filtering mode for UI elements, follows + // the gl_bilerp_ cvars, except for `cvar_pt_bilerp_pics` which + // is only on/off, since vk has no scrap + cvar_pt_bilerp_chars = Cvar_Get("pt_bilerp_chars", "0", CVAR_ARCHIVE); + cvar_pt_bilerp_pics = Cvar_Get("pt_bilerp_pics", "0", CVAR_ARCHIVE); + cvar_pt_bilerp_chars->changed = cvar_pt_bilerp_pics->changed = pt_nearest_changed; + #ifdef VKPT_DEVICE_GROUPS cvar_sli = Cvar_Get("sli", "1", CVAR_REFRESH | CVAR_ARCHIVE); #endif diff --git a/src/refresh/vkpt/textures.c b/src/refresh/vkpt/textures.c index 6645cc02c..5f589ca52 100644 --- a/src/refresh/vkpt/textures.c +++ b/src/refresh/vkpt/textures.c @@ -91,6 +91,8 @@ static uint8_t descriptor_set_dirty_flags[MAX_FRAMES_IN_FLIGHT] = { 0 }; // init static const float megabyte = 1048576.0f; extern cvar_t* cvar_pt_nearest; +extern cvar_t* cvar_pt_bilerp_chars; +extern cvar_t* cvar_pt_bilerp_pics; void vkpt_textures_prefetch() { @@ -1936,14 +1938,21 @@ void vkpt_textures_update_descriptor_set() image_view = tex_invalid_texture_image_view; VkSampler sampler = qvk.tex_sampler; - if (!strcmp(q_img->name, "pics/conchars.pcx") || !strcmp(q_img->name, "pics/ch1.pcx")) + + if (q_img->type == IT_WALL || q_img->type == IT_SKIN) { + if (cvar_pt_nearest->integer == 1) + sampler = qvk.tex_sampler_nearest_mipmap_aniso; + else if (cvar_pt_nearest->integer >= 2) + sampler = qvk.tex_sampler_nearest; + } else if (q_img->flags & IF_NEAREST) { sampler = qvk.tex_sampler_nearest; - else if (q_img->type == IT_SPRITE) + } else if (q_img->type == IT_SPRITE) { sampler = qvk.tex_sampler_linear_clamp; - else if (cvar_pt_nearest->integer == 1) - sampler = qvk.tex_sampler_nearest_mipmap_aniso; - else if (cvar_pt_nearest->integer >= 2) - sampler = qvk.tex_sampler_nearest; + } else if (q_img->type == IT_FONT) { + sampler = (cvar_pt_bilerp_chars->integer == 0) ? qvk.tex_sampler_nearest : qvk.tex_sampler_linear_clamp; + } else if (q_img->type == IT_PIC) { + sampler = (cvar_pt_bilerp_pics->integer == 0) ? qvk.tex_sampler_nearest : qvk.tex_sampler_linear_clamp; + } VkDescriptorImageInfo img_info = { .imageLayout = VK_IMAGE_LAYOUT_GENERAL,