why does this still exist?

This commit is contained in:
Jaime Passos 2020-02-08 18:19:27 -03:00
parent d633435cd6
commit b38f336dc5
6 changed files with 7 additions and 54 deletions

View File

@ -1615,10 +1615,7 @@ void CON_Drawer(void)
return; return;
if (needpatchrecache) if (needpatchrecache)
{
W_FlushCachedPatches();
HU_LoadGraphics(); HU_LoadGraphics();
}
if (con_recalc) if (con_recalc)
{ {

View File

@ -594,15 +594,16 @@ static void D_Display(void)
needpatchrecache = false; needpatchrecache = false;
} }
// Lactozilla: Check the renderer's state // Check the renderer's state
// after a possible renderer switch. // after a possible renderer switch.
void D_CheckRendererState(void) void D_CheckRendererState(void)
{ {
// flush all patches from memory // flush all patches from memory
// (also frees memory tagged with PU_CACHE)
// (which are not necessarily patches but I don't care)
if (needpatchflush) if (needpatchflush)
{
Z_FlushCachedPatches(); Z_FlushCachedPatches();
needpatchflush = false;
}
// some patches have been freed, // some patches have been freed,
// so cache them again // so cache them again

View File

@ -791,9 +791,6 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
{ {
UINT8 *flat; UINT8 *flat;
if (needpatchflush)
W_FlushCachedPatches();
// setup the texture info // setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_P_8; grMipmap->grInfo.format = GR_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
@ -814,9 +811,6 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
if (flatlumpnum == LUMPERROR) if (flatlumpnum == LUMPERROR)
return; return;
if (needpatchflush)
W_FlushCachedPatches();
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap; grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->grInfo.data)
HWR_CacheFlat(grmip, flatlumpnum); HWR_CacheFlat(grmip, flatlumpnum);
@ -895,9 +889,6 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
// -----------------+ // -----------------+
void HWR_GetPatch(GLPatch_t *gpatch) void HWR_GetPatch(GLPatch_t *gpatch)
{ {
if (needpatchflush)
W_FlushCachedPatches();
// is it in hardware cache // is it in hardware cache
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data) if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data)
{ {
@ -928,9 +919,6 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
{ {
GLMipmap_t *grmip, *newmip; GLMipmap_t *grmip, *newmip;
if (needpatchflush)
W_FlushCachedPatches();
if (colormap == colormaps || colormap == NULL) if (colormap == colormaps || colormap == NULL)
{ {
// Load the default (green) color in doom cache (temporary?) AND hardware cache // Load the default (green) color in doom cache (temporary?) AND hardware cache
@ -1054,13 +1042,7 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
// -----------------+ // -----------------+
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum) GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
{ {
GLPatch_t *grpatch; GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum);
if (needpatchflush)
W_FlushCachedPatches();
grpatch = HWR_GetCachedGLPatch(lumpnum);
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
{ {
pic_t *pic; pic_t *pic;
@ -1223,13 +1205,7 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
void HWR_GetFadeMask(lumpnum_t fademasklumpnum) void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{ {
GLMipmap_t *grmip; GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (needpatchflush)
W_FlushCachedPatches();
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->grInfo.data)
HWR_CacheFadeMask(grmip, fademasklumpnum); HWR_CacheFadeMask(grmip, fademasklumpnum);

View File

@ -1474,21 +1474,6 @@ boolean W_IsPatchCached(lumpnum_t lumpnum, void *ptr)
return W_IsPatchCachedPWAD(WADFILENUM(lumpnum),LUMPNUM(lumpnum), ptr); return W_IsPatchCachedPWAD(WADFILENUM(lumpnum),LUMPNUM(lumpnum), ptr);
} }
void W_FlushCachedPatches(void)
{
if (needpatchflush)
{
Z_FreeTag(PU_CACHE);
Z_FreeTag(PU_PATCH);
Z_FreeTag(PU_HUDGFX);
Z_FreeTag(PU_HWRPATCHINFO);
Z_FreeTag(PU_HWRMODELTEXTURE);
Z_FreeTag(PU_HWRCACHE);
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRMODELTEXTURE_UNLOCKED);
}
needpatchflush = false;
}
// ========================================================================== // ==========================================================================
// W_CacheLumpName // W_CacheLumpName
// ========================================================================== // ==========================================================================
@ -1518,9 +1503,6 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
GLPatch_t *grPatch; GLPatch_t *grPatch;
#endif #endif
if (needpatchflush)
W_FlushCachedPatches();
if (!TestValidLump(wad, lump)) if (!TestValidLump(wad, lump))
return NULL; return NULL;

View File

@ -196,7 +196,6 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag); // return a patch
void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag); // return a patch_t void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag); // return a patch_t
void W_UnlockCachedPatch(void *patch); void W_UnlockCachedPatch(void *patch);
void W_FlushCachedPatches(void);
void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5); void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5);

View File

@ -498,13 +498,11 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
// Utility functions // Utility functions
// ----------------- // -----------------
// for renderer switching, free a bunch of stuff // for renderer switching
boolean needpatchflush = false; boolean needpatchflush = false;
boolean needpatchrecache = false; boolean needpatchrecache = false;
// flush all patches from memory // flush all patches from memory
// (also frees memory tagged with PU_CACHE)
// (which are not necessarily patches but I don't care)
void Z_FlushCachedPatches(void) void Z_FlushCachedPatches(void)
{ {
CONS_Debug(DBG_RENDER, "Z_FlushCachedPatches()...\n"); CONS_Debug(DBG_RENDER, "Z_FlushCachedPatches()...\n");