mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
I am the CEO of renderers
This commit is contained in:
parent
dc93cafda9
commit
da93e0f1f5
11 changed files with 61 additions and 60 deletions
|
@ -1267,7 +1267,7 @@ void CONS_Printf(const char *fmt, ...)
|
|||
con_scrollup = 0;
|
||||
|
||||
// if not in display loop, force screen update
|
||||
if (con_startup)
|
||||
if (con_startup && (!setrenderneeded))
|
||||
{
|
||||
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
@ -1584,13 +1584,11 @@ void CON_Drawer(void)
|
|||
if (!con_started || !graphics_started)
|
||||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
if (con_recalc)
|
||||
{
|
||||
CON_RecalcSize();
|
||||
CON_ClearHUD();
|
||||
if (con_curlines <= 0)
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
if (con_curlines > 0)
|
||||
|
|
52
src/d_main.c
52
src/d_main.c
|
@ -117,6 +117,8 @@ boolean devparm = false; // started game with -devparm
|
|||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
static void D_CheckRendererState(void);
|
||||
|
||||
postimg_t postimgtype = postimg_none;
|
||||
INT32 postimgparam;
|
||||
postimg_t postimgtype2 = postimg_none;
|
||||
|
@ -227,7 +229,7 @@ gamestate_t wipegamestate = GS_LEVEL;
|
|||
|
||||
static void D_Display(void)
|
||||
{
|
||||
INT32 setrenderstillneeded = setrenderneeded;
|
||||
INT32 setrenderstillneeded = 0;
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
|
@ -242,9 +244,16 @@ static void D_Display(void)
|
|||
if (setrenderneeded && (moviemode != MM_OFF))
|
||||
M_StopMovie();
|
||||
|
||||
// check for change of screen size (video mode)
|
||||
if ((setmodeneeded || setrenderneeded) && !wipe)
|
||||
// check for change of renderer or screen size (video mode)
|
||||
if ((setrenderneeded || setmodeneeded) && !wipe)
|
||||
{
|
||||
if (setrenderneeded)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "setrenderneeded set (%d)\n", setrenderneeded);
|
||||
setrenderstillneeded = setrenderneeded;
|
||||
}
|
||||
SCR_SetMode(); // change video mode
|
||||
}
|
||||
|
||||
if (vid.recalc || setrenderstillneeded)
|
||||
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
|
||||
|
@ -256,6 +265,8 @@ static void D_Display(void)
|
|||
forcerefresh = true; // force background redraw
|
||||
}
|
||||
|
||||
D_CheckRendererState();
|
||||
|
||||
// draw buffered stuff to screen
|
||||
// Used only by linux GGI version
|
||||
I_UpdateNoBlit();
|
||||
|
@ -495,16 +506,24 @@ static void D_Display(void)
|
|||
I_FinishUpdate(); // page flip or blit buffer
|
||||
}
|
||||
|
||||
// in the occasion no functions
|
||||
// that require patches to be cached
|
||||
// have been called.
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
void D_CheckRendererState(void)
|
||||
{
|
||||
// flush all patches from memory
|
||||
// (also frees memory tagged with PU_CACHE)
|
||||
// (which are not necessarily patches but I don't care)
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
// some patches have been freed,
|
||||
// so cache them again
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// D_SRB2Loop
|
||||
// =========================================================================
|
||||
|
@ -1201,6 +1220,21 @@ void D_SRB2Main(void)
|
|||
|
||||
// set user default mode or mode set at cmdline
|
||||
SCR_CheckDefaultMode();
|
||||
// renderer needs to change?
|
||||
// ok cool please just change it
|
||||
// exactly right now please.
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
VID_CheckRenderer();
|
||||
// set cv_renderer back
|
||||
if (setrenderneeded == render_soft)
|
||||
CV_StealthSetValue(&cv_renderer, 1);
|
||||
else if (setrenderneeded == render_opengl)
|
||||
CV_StealthSetValue(&cv_renderer, 2);
|
||||
}
|
||||
D_CheckRendererState();
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
||||
|
|
|
@ -712,9 +712,6 @@ void HWR_GetFlat(lumpnum_t flatlumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
|
@ -751,9 +748,6 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
{
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap.downloaded && !gpatch->mipmap.grInfo.data)
|
||||
{
|
||||
|
@ -781,9 +775,6 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
|
@ -909,9 +900,6 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
{
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
|
||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||
|
@ -1109,9 +1097,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
|
|
|
@ -1993,9 +1993,6 @@ static void HU_DrawDemoInfo(void)
|
|||
//
|
||||
void HU_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifndef NONET
|
||||
// draw chat string plus cursor
|
||||
if (chat_on)
|
||||
|
|
|
@ -2481,9 +2481,6 @@ void M_Drawer(void)
|
|||
if (currentMenu == &MessageDef)
|
||||
menuactive = true;
|
||||
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
if (menuactive)
|
||||
{
|
||||
// now that's more readable with a faded background (yeah like Quake...)
|
||||
|
|
|
@ -3098,10 +3098,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
// preload graphics
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_PrepLevelCache(numtextures);
|
||||
//HWR_FreeColormaps();
|
||||
}
|
||||
#endif
|
||||
|
||||
P_MapEnd();
|
||||
|
|
|
@ -1353,7 +1353,7 @@ void R_InitHardwareMode(void)
|
|||
|
||||
void R_ReloadHUDGraphics(void)
|
||||
{
|
||||
Z_FlushCachedPatches();
|
||||
CONS_Debug(DBG_RENDER, "R_ReloadHUDGraphics()...\n");
|
||||
ST_LoadGraphics();
|
||||
HU_LoadGraphics();
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
|
|
|
@ -1909,9 +1909,6 @@ static void ST_overlayDrawer(void)
|
|||
|
||||
void ST_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifdef SEENAMES
|
||||
if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo)
|
||||
{
|
||||
|
|
|
@ -830,10 +830,10 @@ void W_UnloadWadFile(UINT16 num)
|
|||
lumpcache = delwad->lumpcache;
|
||||
numwadfiles--;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_FreeTextureCache();
|
||||
HWR_FreeColormaps();
|
||||
HWR_FreeTextureCache();
|
||||
}
|
||||
M_AATreeFree(delwad->hwrcache);
|
||||
#endif
|
||||
|
@ -1512,9 +1512,6 @@ static inline void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
|||
{
|
||||
GLPatch_t *grPatch;
|
||||
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
if (rendermode == render_soft || rendermode == render_none)
|
||||
return W_CacheLumpNumPwad(wad, lump, tag);
|
||||
|
||||
|
|
|
@ -192,7 +192,6 @@ void Y_IntermissionDrawer(void)
|
|||
if (needpatchrecache)
|
||||
{
|
||||
Y_CleanupData();
|
||||
R_ReloadHUDGraphics();
|
||||
safetorender = false;
|
||||
}
|
||||
|
||||
|
|
24
src/z_zone.c
24
src/z_zone.c
|
@ -415,20 +415,20 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
|||
boolean needpatchflush = false;
|
||||
boolean needpatchrecache = false;
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (needpatchflush)
|
||||
{
|
||||
Z_FreeTag(PU_CACHE);
|
||||
Z_FreeTag(PU_PATCH);
|
||||
Z_FreeTag(PU_HUDGFX);
|
||||
Z_FreeTag(PU_HWRPATCHINFO);
|
||||
Z_FreeTag(PU_HWRPATCHCOLMIPMAP);
|
||||
Z_FreeTag(PU_HWRCACHE);
|
||||
Z_FreeTag(PU_HWRCACHE_UNLOCKED);
|
||||
Z_FreeTag(PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
needpatchflush = false;
|
||||
CONS_Debug(DBG_RENDER, "Z_FlushCachedPatches()...\n");
|
||||
Z_FreeTag(PU_CACHE);
|
||||
Z_FreeTag(PU_PATCH);
|
||||
Z_FreeTag(PU_HUDGFX);
|
||||
Z_FreeTag(PU_HWRPATCHINFO);
|
||||
Z_FreeTag(PU_HWRPATCHCOLMIPMAP);
|
||||
Z_FreeTag(PU_HWRCACHE);
|
||||
Z_FreeTag(PU_HWRCACHE_UNLOCKED);
|
||||
Z_FreeTag(PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue