Image: show missed images with r_validation

This commit is contained in:
Denis Pauk 2022-10-17 00:41:34 +03:00
parent 49a1478d44
commit 322424ef33
17 changed files with 48 additions and 85 deletions

View file

@ -37,7 +37,7 @@ void
Draw_InitLocal(void)
{
/* load console characters */
draw_chars = FindPic("conchars", (findimage_t)R_FindImageUnsafe);
draw_chars = FindPic("conchars", (findimage_t)R_FindImage);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx",
@ -107,7 +107,7 @@ RDraw_CharScaled(int x, int y, int num, float scale)
image_t *
RDraw_FindPic(char *name)
{
return FindPic(name, (findimage_t)R_FindImageUnsafe);
return FindPic(name, (findimage_t)R_FindImage);
}
void
@ -115,7 +115,7 @@ RDraw_GetPicSize(int *w, int *h, char *pic)
{
image_t *gl;
gl = FindPic(pic, (findimage_t)R_FindImageUnsafe);
gl = FindPic(pic, (findimage_t)R_FindImage);
if (!gl)
{
@ -132,7 +132,7 @@ RDraw_StretchPic(int x, int y, int w, int h, char *pic)
{
image_t *gl;
gl = FindPic(pic, (findimage_t)R_FindImageUnsafe);
gl = FindPic(pic, (findimage_t)R_FindImage);
if (!gl)
{
@ -177,7 +177,7 @@ RDraw_PicScaled(int x, int y, char *pic, float factor)
{
image_t *gl;
gl = FindPic(pic, (findimage_t)R_FindImageUnsafe);
gl = FindPic(pic, (findimage_t)R_FindImage);
if (!gl)
{
@ -227,7 +227,7 @@ RDraw_TileClear(int x, int y, int w, int h, char *pic)
{
image_t *image;
image = FindPic(pic, (findimage_t)R_FindImageUnsafe);
image = FindPic(pic, (findimage_t)R_FindImage);
if (!image)
{

View file

@ -1031,7 +1031,7 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
* Finds or loads the given image or null
*/
image_t *
R_FindImageUnsafe(const char *name, imagetype_t type)
R_FindImage(const char *name, imagetype_t type)
{
image_t *image;
int i, len;
@ -1084,23 +1084,9 @@ R_FindImageUnsafe(const char *name, imagetype_t type)
image = (image_t *)LoadImage(name, namewe, ext, type,
r_retexturing->value, (loadimage_t)R_LoadPic);
return image;
}
/*
* Finds or loads the given image or notexture
*/
image_t *
R_FindImage(const char *name, imagetype_t type)
{
image_t *image;
image = R_FindImageUnsafe(name, type);
if (!image)
if (!image && r_validation->value)
{
R_Printf(PRINT_ALL, "%s: can't load %s\n", __func__, name);
image = r_notexture;
}
return image;

View file

@ -75,6 +75,7 @@ cvar_t *r_lerpmodels;
cvar_t *gl_lefthand;
cvar_t *r_gunfov;
cvar_t *r_farsee;
cvar_t *r_validation;
cvar_t *r_lightlevel;
cvar_t *gl1_overbrightbits;
@ -1286,6 +1287,7 @@ R_Register(void)
gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE );
r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_validation = ri.Cvar_Get("r_validation", "0", CVAR_ARCHIVE);
r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE);
/* don't bilerp characters and crosshairs */

View file

@ -250,7 +250,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
{
mod->extradata = Mod_LoadMD2(mod->name, buf, modfilelen,
mod->mins, mod->maxs,
(struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe,
(struct image_s **)mod->skins, (findimage_t)R_FindImage,
&(mod->type));
if (!mod->extradata)
{
@ -263,7 +263,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
case IDSPRITEHEADER:
{
mod->extradata = Mod_LoadSP2(mod->name, buf, modfilelen,
(struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe,
(struct image_s **)mod->skins, (findimage_t)R_FindImage,
&(mod->type));
if (!mod->extradata)
{
@ -486,7 +486,7 @@ Mod_LoadTexinfo(model_t *loadmodel, byte *mod_base, lump_t *l)
out->next = NULL;
}
image = GetTexImage(in->texture, (findimage_t)R_FindImageUnsafe);
image = GetTexImage(in->texture, (findimage_t)R_FindImage);
if (!image)
{

View file

@ -751,7 +751,7 @@ RI_SetSky(char *name, float rotate, vec3_t axis)
image_t *image;
image = (image_t *)GetSkyImage(skyname, suf[i],
gl_config.palettedtexture, (findimage_t)R_FindImageUnsafe);
gl_config.palettedtexture, (findimage_t)R_FindImage);
if (!image)
{

View file

@ -193,6 +193,7 @@ extern cvar_t *r_customheight;
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
extern cvar_t *r_validation;
extern cvar_t *gl_nolerp_list;
extern cvar_t *r_lerp_list;
@ -283,7 +284,6 @@ void R_SwapBuffers(int);
image_t *R_LoadPic(const char *name, byte *pic, int width, int realwidth,
int height, int realheight, size_t data_size, imagetype_t type, int bits);
image_t *R_FindImageUnsafe(const char *name, imagetype_t type);
image_t *R_FindImage(const char *name, imagetype_t type);
void R_TextureMode(char *string);
void R_ImageList_f(void);

View file

@ -37,7 +37,7 @@ void
GL3_Draw_InitLocal(void)
{
/* load console characters */
draw_chars = FindPic("conchars", (findimage_t)GL3_FindImageUnsafe);
draw_chars = FindPic("conchars", (findimage_t)GL3_FindImage);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx",
@ -163,7 +163,7 @@ GL3_Draw_CharScaled(int x, int y, int num, float scale)
gl3image_t *
GL3_Draw_FindPic(char *name)
{
return FindPic(name, (findimage_t)GL3_FindImageUnsafe);
return FindPic(name, (findimage_t)GL3_FindImage);
}
void
@ -171,7 +171,7 @@ GL3_Draw_GetPicSize(int *w, int *h, char *pic)
{
gl3image_t *gl;
gl = FindPic(pic, (findimage_t)GL3_FindImageUnsafe);
gl = FindPic(pic, (findimage_t)GL3_FindImage);
if (!gl)
{
@ -186,7 +186,7 @@ GL3_Draw_GetPicSize(int *w, int *h, char *pic)
void
GL3_Draw_StretchPic(int x, int y, int w, int h, char *pic)
{
gl3image_t *gl = FindPic(pic, (findimage_t)GL3_FindImageUnsafe);
gl3image_t *gl = FindPic(pic, (findimage_t)GL3_FindImage);
if (!gl)
{
@ -203,7 +203,7 @@ GL3_Draw_StretchPic(int x, int y, int w, int h, char *pic)
void
GL3_Draw_PicScaled(int x, int y, char *pic, float factor)
{
gl3image_t *gl = FindPic(pic, (findimage_t)GL3_FindImageUnsafe);
gl3image_t *gl = FindPic(pic, (findimage_t)GL3_FindImage);
if (!gl)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
@ -224,7 +224,7 @@ GL3_Draw_PicScaled(int x, int y, char *pic, float factor)
void
GL3_Draw_TileClear(int x, int y, int w, int h, char *pic)
{
gl3image_t *image = FindPic(pic, (findimage_t)GL3_FindImageUnsafe);
gl3image_t *image = FindPic(pic, (findimage_t)GL3_FindImage);
if (!image)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);

View file

@ -601,7 +601,7 @@ GL3_LoadPic(char *name, byte *pic, int width, int realwidth,
* Finds or loads the given image or NULL
*/
gl3image_t *
GL3_FindImageUnsafe(const char *name, imagetype_t type)
GL3_FindImage(const char *name, imagetype_t type)
{
gl3image_t *image;
int i, len;
@ -654,22 +654,9 @@ GL3_FindImageUnsafe(const char *name, imagetype_t type)
image = (gl3image_t *)LoadImage(name, namewe, ext, type,
r_retexturing->value, (loadimage_t)GL3_LoadPic);
return image;
}
/*
* Finds or loads the given image or notexture
*/
gl3image_t *
GL3_FindImage(const char *name, imagetype_t type)
{
gl3image_t *image;
image = GL3_FindImageUnsafe(name, type);
if (!image)
if (!image && r_validation->value)
{
R_Printf(PRINT_ALL, "%s: can't load %s\n", __func__, name);
image = gl3_notexture;
}
return image;

View file

@ -130,6 +130,7 @@ cvar_t *gl3_debugcontext;
cvar_t *gl3_usebigvbo;
cvar_t *r_fixsurfsky;
cvar_t *r_palettedtexture;
cvar_t *r_validation;
cvar_t *gl3_usefbo;
// Yaw-Pitch-Roll
@ -230,6 +231,7 @@ GL3_Register(void)
r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0);
r_fixsurfsky = ri.Cvar_Get("r_fixsurfsky", "0", CVAR_ARCHIVE);
r_palettedtexture = ri.Cvar_Get("r_palettedtexture", "0", 0);
r_validation = ri.Cvar_Get("r_validation", "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", CVAR_ARCHIVE);

View file

@ -354,7 +354,7 @@ Mod_LoadTexinfo(gl3model_t *loadmodel, byte *mod_base, lump_t *l)
out->next = NULL;
}
image = GetTexImage(in->texture, (findimage_t)GL3_FindImageUnsafe);
image = GetTexImage(in->texture, (findimage_t)GL3_FindImage);
if (!image)
{
R_Printf(PRINT_ALL, "%s: Couldn't load %s\n",
@ -1044,7 +1044,7 @@ Mod_ForName (char *name, gl3model_t *parent_model, qboolean crash)
{
mod->extradata = Mod_LoadMD2(mod->name, buf, modfilelen,
mod->mins, mod->maxs,
(struct image_s **)mod->skins, (findimage_t)GL3_FindImageUnsafe,
(struct image_s **)mod->skins, (findimage_t)GL3_FindImage,
&(mod->type));
if (!mod->extradata)
{
@ -1057,7 +1057,7 @@ Mod_ForName (char *name, gl3model_t *parent_model, qboolean crash)
case IDSPRITEHEADER:
{
mod->extradata = Mod_LoadSP2(mod->name, buf, modfilelen,
(struct image_s **)mod->skins, (findimage_t)GL3_FindImageUnsafe,
(struct image_s **)mod->skins, (findimage_t)GL3_FindImage,
&(mod->type));
if (!mod->extradata)
{

View file

@ -325,7 +325,7 @@ GL3_SetSky(char *name, float rotate, vec3_t axis)
gl3image_t *image;
image = (gl3image_t *)GetSkyImage(skyname, suf[i],
r_palettedtexture->value, (findimage_t)GL3_FindImageUnsafe);
r_palettedtexture->value, (findimage_t)GL3_FindImage);
if (!image)
{

View file

@ -442,7 +442,6 @@ extern void GL3_BindLightmap(int lightmapnum);
extern gl3image_t *GL3_LoadPic(char *name, byte *pic, int width, int realwidth,
int height, int realheight, size_t data_size,
imagetype_t type, int bits);
extern gl3image_t *GL3_FindImageUnsafe(const char *name, imagetype_t type);
extern gl3image_t *GL3_FindImage(const char *name, imagetype_t type);
extern gl3image_t *GL3_RegisterSkin(char *name);
extern void GL3_ShutdownImages(void);
@ -550,6 +549,7 @@ extern cvar_t *gl_lightmap;
extern cvar_t *gl_shadows;
extern cvar_t *r_fixsurfsky;
extern cvar_t *r_palettedtexture;
extern cvar_t *r_validation;
extern cvar_t *gl3_debugcontext;

View file

@ -426,6 +426,7 @@ extern cvar_t *sw_stipplealpha;
extern cvar_t *sw_surfcacheoverride;
extern cvar_t *sw_waterwarp;
extern cvar_t *sw_gunzposition;
extern cvar_t *r_validation;
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
@ -588,7 +589,6 @@ void RE_Draw_FadeScreen (void);
extern byte d_8to24table[256 * 4];
void R_InitImages(void);
void R_ShutdownImages(void);
image_t *R_FindImageUnsafe(const char *name, imagetype_t type);
image_t *R_FindImage(const char *name, imagetype_t type);
byte *Get_BestImageSize(const image_t *image, int *req_width, int *req_height);
void R_FreeUnusedImages(void);

View file

@ -35,7 +35,7 @@ RE_Draw_FindPic
image_t *
RE_Draw_FindPic (char *name)
{
return FindPic(name, (findimage_t)R_FindImageUnsafe);
return FindPic(name, (findimage_t)R_FindImage);
}
@ -48,7 +48,7 @@ Draw_InitLocal
void
Draw_InitLocal (void)
{
draw_chars = FindPic ("conchars", (findimage_t)R_FindImageUnsafe);
draw_chars = FindPic ("conchars", (findimage_t)R_FindImage);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx", __func__);
@ -148,7 +148,7 @@ RE_Draw_GetPicSize (int *w, int *h, char *name)
{
image_t *image;
image = FindPic (name, (findimage_t)R_FindImageUnsafe);
image = FindPic (name, (findimage_t)R_FindImage);
if (!image)
{
*w = *h = -1;
@ -306,7 +306,7 @@ RE_Draw_StretchPic (int x, int y, int w, int h, char *name)
{
image_t *pic;
pic = FindPic (name, (findimage_t)R_FindImageUnsafe);
pic = FindPic (name, (findimage_t)R_FindImage);
if (!pic)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
@ -379,7 +379,7 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
{
image_t *pic;
pic = FindPic (name, (findimage_t)R_FindImageUnsafe);
pic = FindPic (name, (findimage_t)R_FindImage);
if (!pic)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
@ -429,7 +429,7 @@ RE_Draw_TileClear (int x, int y, int w, int h, char *name)
VID_DamageBuffer(x, y);
VID_DamageBuffer(x + w, y + h);
pic = FindPic (name, (findimage_t)R_FindImageUnsafe);
pic = FindPic (name, (findimage_t)R_FindImage);
if (!pic)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", name);

View file

@ -476,13 +476,13 @@ R_ApplyLight(pixel_t pix, const light3_t light)
/*
===============
R_FindImageUnsafe
R_FindImage
Finds or loads the given image or NULL
===============
*/
image_t *
R_FindImageUnsafe(const char *name, imagetype_t type)
R_FindImage(const char *name, imagetype_t type)
{
image_t *image;
int i, len;
@ -541,26 +541,9 @@ R_FindImageUnsafe(const char *name, imagetype_t type)
image = (image_t *)LoadImage(name, namewe, ext, type,
r_retexturing->value, (loadimage_t)R_LoadPic);
return image;
}
/*
===============
R_FindImage
Finds or loads the given image or no_texture
===============
*/
image_t *
R_FindImage(const char *name, imagetype_t type)
{
image_t *image;
image = R_FindImageUnsafe(name, type);
if (!image)
if (!image && r_validation->value)
{
R_Printf(PRINT_ALL, "%s: can't load %s\n", __func__, name);
image = r_notexture_mip;
}
return image;

View file

@ -151,6 +151,7 @@ cvar_t *sw_texture_filtering;
cvar_t *r_retexturing;
cvar_t *r_scale8bittextures;
cvar_t *sw_gunzposition;
cvar_t *r_validation;
static cvar_t *sw_partialrefresh;
cvar_t *r_drawworld;
@ -381,6 +382,7 @@ R_RegisterVariables (void)
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);
r_validation = ri.Cvar_Get("r_validation", "0", CVAR_ARCHIVE);
// On MacOS texture is cleaned up after render and code have to copy a whole
// screen to texture, other platforms save previous texture content and can be
@ -1740,7 +1742,7 @@ RE_SetSky (char *name, float rotate, vec3_t axis)
image_t *image;
image = (image_t *)GetSkyImage(skyname, suf[r_skysideimage[i]],
r_palettedtexture->value, (findimage_t)R_FindImageUnsafe);
r_palettedtexture->value, (findimage_t)R_FindImage);
if (!image)
{

View file

@ -200,7 +200,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
{
mod->extradata = Mod_LoadMD2(mod->name, buf, modfilelen,
mod->mins, mod->maxs,
(struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe,
(struct image_s **)mod->skins, (findimage_t)R_FindImage,
&(mod->type));
if (!mod->extradata)
{
@ -213,7 +213,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
case IDSPRITEHEADER:
{
mod->extradata = Mod_LoadSP2(mod->name, buf, modfilelen,
(struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe,
(struct image_s **)mod->skins, (findimage_t)R_FindImage,
&(mod->type));
if (!mod->extradata)
{
@ -531,10 +531,11 @@ Mod_LoadTexinfo (model_t *loadmodel, byte *mod_base, lump_t *l)
out->next = NULL;
}
image = GetTexImage(in->texture, (findimage_t)R_FindImageUnsafe);
image = GetTexImage(in->texture, (findimage_t)R_FindImage);
if (!image)
{
R_Printf(PRINT_ALL, "%s: Couldn't load %s\n", __func__, in->texture);
R_Printf(PRINT_ALL, "%s: Couldn't load %s\n",
__func__, in->texture);
image = r_notexture_mip;
}