Add vk_nolerp_list support

This commit is contained in:
Denis Pauk 2020-12-02 23:27:59 +02:00 committed by Yamagi
parent 539fea96bb
commit b7bdd0be72
8 changed files with 42 additions and 28 deletions

View file

@ -341,6 +341,11 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
* `2` - try to load the pack or scale up all 8bit textures if pack is
not installed.
* **vk_nolerp_list**: list separate by spaces of textures omitted from
bilinear filtering. Used by default to exclude the console and HUD
fonts. Make sure to include the default values when extending the
list.
* **vk_strings**: Print some basic Vulkan/GPU information.
* **vk_mem**: Print dynamic vertex/index/uniform/triangle fan buffer

View file

@ -162,6 +162,7 @@ extern cvar_t *vk_aniso;
extern cvar_t *vk_sampleshading;
extern cvar_t *vk_device_idx;
extern cvar_t *vk_retexturing;
extern cvar_t *vk_nolerp_list;
extern cvar_t *vid_fullscreen;
extern cvar_t *vid_gamma;
@ -225,8 +226,8 @@ struct image_s *RE_RegisterSkin (char *name);
void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height);
image_t *Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
int height, int realheight, imagetype_t type,
int bits, qvksampler_t *samplerType);
image_t *Vk_FindImage (char *name, imagetype_t type, qvksampler_t *samplerType);
int bits);
image_t *Vk_FindImage (char *name, imagetype_t type);
void Vk_TextureMode( char *string );
void Vk_LmapTextureMode( char *string );
void Vk_ImageList_f (void);

View file

@ -31,9 +31,7 @@ Draw_InitLocal
*/
void Draw_InitLocal (void)
{
// load console characters (don't bilerp characters)
qvksampler_t samplerType = S_NEAREST;
draw_chars = Vk_FindImage("pics/conchars.pcx", it_pic, &samplerType);
draw_chars = Vk_FindImage("pics/conchars.pcx", it_pic);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx", __func__);
@ -91,10 +89,10 @@ image_t *RE_Draw_FindPic (char *name)
char fullname[MAX_QPATH];
Com_sprintf(fullname, sizeof(fullname), "pics/%s.pcx", name);
vk = Vk_FindImage(fullname, it_pic, NULL);
vk = Vk_FindImage(fullname, it_pic);
}
else
vk = Vk_FindImage(name + 1, it_pic, NULL);
vk = Vk_FindImage(name + 1, it_pic);
return vk;
}

View file

@ -939,12 +939,19 @@ This is also used as an entry point for the generated r_notexture
image_t *
Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
int height, int realheight, imagetype_t type,
int bits, qvksampler_t *samplerType)
int bits)
{
image_t *image;
byte *texBuffer;
int upload_width, upload_height;
qboolean nolerp = false;
if (vk_nolerp_list != NULL && vk_nolerp_list->string != NULL)
{
nolerp = strstr(vk_nolerp_list->string, name) != NULL;
}
{
int i;
// find a free image_t
@ -998,7 +1005,7 @@ Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer,
image->upload_width, image->upload_height,
samplerType ? *samplerType : vk_current_sampler);
nolerp ? S_NEAREST : vk_current_sampler);
QVk_DebugSetObjectName((uint64_t)image->vk_texture.resource.image,
VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
QVk_DebugSetObjectName((uint64_t)image->vk_texture.imageView,
@ -1041,7 +1048,7 @@ static image_t *Vk_LoadWal (char *name, imagetype_t type)
image = Vk_LoadPic(name, (byte *)mt + ofs,
width, width,
height, height,
type, 8, NULL);
type, 8);
ri.FS_FreeFile ((void *)mt);
@ -1049,7 +1056,7 @@ static image_t *Vk_LoadWal (char *name, imagetype_t type)
}
static image_t*
Vk_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t type, qvksampler_t *samplerType)
Vk_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t type)
{
image_t *image = NULL;
byte *pic = NULL;
@ -1083,7 +1090,7 @@ Vk_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t
image = Vk_LoadPic(name, pic,
width, realwidth,
height, realheight,
type, 32, samplerType);
type, 32);
}
}
@ -1096,14 +1103,14 @@ Vk_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t
}
static image_t*
Vk_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type, qvksampler_t *samplerType)
Vk_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type)
{
image_t *image = NULL;
// with retexturing
if (vk_retexturing->value)
{
image = Vk_LoadHiColorImage(name, namewe, ext, type, samplerType);
image = Vk_LoadHiColorImage(name, namewe, ext, type);
}
if (!image)
@ -1126,7 +1133,7 @@ Vk_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type,
image = Vk_LoadPic(name, pic,
width, width,
height, height,
type, 8, samplerType);
type, 8);
if (palette)
free(palette);
@ -1144,7 +1151,7 @@ Vk_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type,
image = Vk_LoadPic(name, pic,
width, width,
height, height,
type, 32, samplerType);
type, 32);
}
if (pic)
@ -1161,7 +1168,7 @@ Vk_FindImage
Finds or loads the given image
===============
*/
image_t *Vk_FindImage (char *name, imagetype_t type, qvksampler_t *samplerType)
image_t *Vk_FindImage (char *name, imagetype_t type)
{
image_t *image;
int i, len;
@ -1211,7 +1218,7 @@ image_t *Vk_FindImage (char *name, imagetype_t type, qvksampler_t *samplerType)
//
// load the pic from disk
//
return Vk_LoadImage(name, namewe, ext, type, samplerType);
return Vk_LoadImage(name, namewe, ext, type);
}
@ -1222,7 +1229,7 @@ RE_RegisterSkin
*/
struct image_s *RE_RegisterSkin (char *name)
{
return Vk_FindImage (name, it_skin, NULL);
return Vk_FindImage (name, it_skin);
}

View file

@ -433,7 +433,7 @@ static void Mod_LoadTexinfo (lump_t *l)
out->next = NULL;
Com_sprintf (name, sizeof(name), "textures/%s.wal", in->texture);
out->image = Vk_FindImage (name, it_wall, NULL);
out->image = Vk_FindImage (name, it_wall);
if (!out->image)
{
R_Printf(PRINT_ALL, "Couldn't load %s\n", name);
@ -1010,7 +1010,7 @@ static void Mod_LoadAliasModel (model_t *mod, void *buffer)
for (i=0 ; i<pheader->num_skins ; i++)
{
mod->skins[i] = Vk_FindImage ((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME
, it_skin, NULL);
, it_skin);
}
mod->mins[0] = -32;
@ -1063,7 +1063,7 @@ static void Mod_LoadSpriteModel (model_t *mod, void *buffer)
sprout->frames[i].origin_y = LittleLong (sprin->frames[i].origin_y);
memcpy (sprout->frames[i].name, sprin->frames[i].name, MAX_SKINNAME);
mod->skins[i] = Vk_FindImage (sprout->frames[i].name,
it_sprite, NULL);
it_sprite);
}
mod->type = mod_sprite;
@ -1125,13 +1125,13 @@ struct model_s *RE_RegisterModel (char *name)
sprout = (dsprite_t *)mod->extradata;
for (i=0 ; i<sprout->numframes ; i++)
mod->skins[i] = Vk_FindImage (sprout->frames[i].name, it_sprite, NULL);
mod->skins[i] = Vk_FindImage (sprout->frames[i].name, it_sprite);
}
else if (mod->type == mod_alias)
{
pheader = (dmdl_t *)mod->extradata;
for (i=0 ; i<pheader->num_skins ; i++)
mod->skins[i] = Vk_FindImage ((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, it_skin, NULL);
mod->skins[i] = Vk_FindImage ((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, it_skin);
//PGM
mod->numframes = pheader->num_frames;
//PGM

View file

@ -123,6 +123,7 @@ cvar_t *vk_mip_nearfilter;
cvar_t *vk_sampleshading;
cvar_t *vk_device_idx;
cvar_t *vk_retexturing;
cvar_t *vk_nolerp_list;
cvar_t *vid_fullscreen;
cvar_t *vid_gamma;
@ -1177,6 +1178,8 @@ R_Register( void )
vk_sampleshading = ri.Cvar_Get("vk_sampleshading", "1", CVAR_ARCHIVE);
vk_device_idx = ri.Cvar_Get("vk_device", "-1", CVAR_ARCHIVE);
vk_retexturing = ri.Cvar_Get("vk_retexturing", "1", CVAR_ARCHIVE);
/* don't bilerp characters and crosshairs */
vk_nolerp_list = ri.Cvar_Get("vk_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);
// clamp vk_msaa to accepted range so that video menu doesn't crash on us
if (vk_msaa->value < 0)

View file

@ -58,7 +58,7 @@ void RE_InitParticleTexture (void)
}
}
r_particletexture = Vk_LoadPic("***particle***", (byte *)data,
8, 8, 8, 8, it_sprite, 32, NULL);
8, 8, 8, 8, it_sprite, 32);
//
// particle texture
@ -74,7 +74,7 @@ void RE_InitParticleTexture (void)
}
}
r_squaretexture = Vk_LoadPic("***square***", (byte *)data,
8, 8, 8, 8, it_sprite, 32, NULL);
8, 8, 8, 8, it_sprite, 32);
//
// also use this for bad textures, but without alpha
@ -90,7 +90,7 @@ void RE_InitParticleTexture (void)
}
}
r_notexture = Vk_LoadPic("***r_notexture***", (byte *)data,
8, 8, 8, 8, it_wall, 32, NULL);
8, 8, 8, 8, it_wall, 32);
}

View file

@ -686,7 +686,7 @@ void RE_SetSky (char *name, float rotate, vec3_t axis)
Com_sprintf(pathname, sizeof(pathname), "env/%s%s.tga", skyname, suf[i]);
sky_images[i] = Vk_FindImage(pathname, it_sky, NULL);
sky_images[i] = Vk_FindImage(pathname, it_sky);
if (!sky_images[i])
sky_images[i] = r_notexture;