mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Save last rendered texture tempoarily in memory when precaching. This cuts about 10 percent on initial precaching time on the average (E1-3 L1-4, current HRP). Also don't precache special palettes that the user hasn't chosen to render (saves a few % maybe) or models (can be substantial).
git-svn-id: https://svn.eduke32.com/eduke32@1610 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e7c9ce8624
commit
8854ea2dbb
2 changed files with 57 additions and 10 deletions
|
@ -1561,6 +1561,10 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
int32_t cachefil = -1;
|
int32_t cachefil = -1;
|
||||||
texcacheheader cachead;
|
texcacheheader cachead;
|
||||||
|
|
||||||
|
static coltype *lastpic = NULL;
|
||||||
|
static char *lastfn = NULL;
|
||||||
|
static int32_t lastsize = 0;
|
||||||
|
|
||||||
if (!hicr) return -1;
|
if (!hicr) return -1;
|
||||||
if (facen > 0)
|
if (facen > 0)
|
||||||
{
|
{
|
||||||
|
@ -1625,7 +1629,39 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
}
|
}
|
||||||
pic = (coltype *)Bcalloc(xsiz,ysiz*sizeof(coltype)); if (!pic) { Bfree(picfil); return 1; }
|
pic = (coltype *)Bcalloc(xsiz,ysiz*sizeof(coltype)); if (!pic) { Bfree(picfil); return 1; }
|
||||||
|
|
||||||
if (kprender(picfil,picfillen,(intptr_t)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { Bfree(picfil); Bfree(pic); return -2; }
|
if (lastpic && lastfn && !Bstrcmp(lastfn,fn))
|
||||||
|
{
|
||||||
|
// if (hicprecaching) OSD_Printf("use %4d: p%-3d m%d e%d\n", dapic, dapalnum, dameth, effect);
|
||||||
|
Bmemcpy(pic, lastpic, xsiz*ysiz*sizeof(coltype));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if (hicprecaching) OSD_Printf("rend %4d: p%-3d m%d e%d: `%s'\n", dapic, dapalnum, dameth, effect, fn);
|
||||||
|
if (kprender(picfil,picfillen,(intptr_t)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { Bfree(picfil); Bfree(pic); return -2; }
|
||||||
|
|
||||||
|
if (hicprecaching)
|
||||||
|
{
|
||||||
|
lastfn = fn; // careful...
|
||||||
|
if (!lastpic)
|
||||||
|
{
|
||||||
|
lastpic = Bmalloc(xsiz*ysiz*sizeof(coltype));
|
||||||
|
lastsize = xsiz*ysiz;
|
||||||
|
}
|
||||||
|
else if (lastsize < xsiz*ysiz)
|
||||||
|
{
|
||||||
|
Bfree(lastpic);
|
||||||
|
lastpic = Bmalloc(xsiz*ysiz*sizeof(coltype));
|
||||||
|
}
|
||||||
|
if (lastpic)
|
||||||
|
Bmemcpy(lastpic, pic, xsiz*ysiz*sizeof(coltype));
|
||||||
|
}
|
||||||
|
else if (lastpic)
|
||||||
|
{
|
||||||
|
Bfree(lastpic); lastpic=NULL;
|
||||||
|
lastfn = NULL;
|
||||||
|
lastsize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
r=(glinfo.bgra)?hictinting[dapalnum].r:hictinting[dapalnum].b;
|
r=(glinfo.bgra)?hictinting[dapalnum].r:hictinting[dapalnum].b;
|
||||||
g=hictinting[dapalnum].g;
|
g=hictinting[dapalnum].g;
|
||||||
|
@ -6016,7 +6052,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
|
||||||
gltexcache(dapicnum, dapalnum, (datype & 1) << 2);
|
gltexcache(dapicnum, dapalnum, (datype & 1) << 2);
|
||||||
hicprecaching = 0;
|
hicprecaching = 0;
|
||||||
|
|
||||||
if (datype == 0) return;
|
if (datype == 0 || !usemodels) return;
|
||||||
|
|
||||||
mid = md_tilehasmodel(dapicnum,dapalnum);
|
mid = md_tilehasmodel(dapicnum,dapalnum);
|
||||||
if (mid < 0 || models[mid]->mdnum < 2) return;
|
if (mid < 0 || models[mid]->mdnum < 2) return;
|
||||||
|
|
|
@ -274,7 +274,7 @@ static void G_PrecacheSprites(void)
|
||||||
for (i=SHRINKSPARK; i<SHRINKSPARK+4; i++) tloadtile(i,1);
|
for (i=SHRINKSPARK; i<SHRINKSPARK+4; i++) tloadtile(i,1);
|
||||||
for (i=GROWSPARK; i<GROWSPARK+4; i++) tloadtile(i,1);
|
for (i=GROWSPARK; i<GROWSPARK+4; i++) tloadtile(i,1);
|
||||||
for (i=SHRINKEREXPLOSION; i<SHRINKEREXPLOSION+4; i++) tloadtile(i,1);
|
for (i=SHRINKEREXPLOSION; i<SHRINKEREXPLOSION+4; i++) tloadtile(i,1);
|
||||||
for (i=MORTER; i<MORTER+4; i++) tloadtile(i,4);
|
for (i=MORTER; i<MORTER+4; i++) tloadtile(i,1);
|
||||||
for (i=0; i<=60; i++) tloadtile(i,1);
|
for (i=0; i<=60; i++) tloadtile(i,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,15 +487,26 @@ void G_CacheMapData(void)
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (ud.config.useprecache)
|
if (ud.config.useprecache)
|
||||||
{
|
{
|
||||||
int32_t k;
|
int32_t k,type;
|
||||||
|
|
||||||
if (precachehightile[0][i>>3] & pow2char[i&7])
|
for (type=0; type<=1; type++)
|
||||||
for (k=0; k<MAXPALOOKUPS && !KB_KeyPressed(sc_Space); k++)
|
if (precachehightile[type][i>>3] & pow2char[i&7])
|
||||||
polymost_precache(i,k,0);
|
{
|
||||||
|
for (k=0; k<MAXPALOOKUPS-RESERVEDPALS && !KB_KeyPressed(sc_Space); k++)
|
||||||
|
polymost_precache(i,k,type);
|
||||||
|
if (r_detailmapping && !KB_KeyPressed(sc_Space))
|
||||||
|
polymost_precache(i,DETAILPAL,type);
|
||||||
|
if (r_glowmapping && !KB_KeyPressed(sc_Space))
|
||||||
|
polymost_precache(i,GLOWPAL,type);
|
||||||
|
|
||||||
if (precachehightile[1][i>>3] & pow2char[i&7])
|
if (rendmode==4)
|
||||||
for (k=0; k<MAXPALOOKUPS && !KB_KeyPressed(sc_Space); k++)
|
{
|
||||||
polymost_precache(i,k,1);
|
if (pr_specularmapping && !KB_KeyPressed(sc_Space))
|
||||||
|
polymost_precache(i,SPECULARPAL,type);
|
||||||
|
if (pr_normalmapping && !KB_KeyPressed(sc_Space))
|
||||||
|
polymost_precache(i,NORMALPAL,type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
j++;
|
j++;
|
||||||
|
|
Loading…
Reference in a new issue