mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Minor cleanups, mostly just formatting. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4752 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1bbb077fca
commit
d73f7f113d
3 changed files with 88 additions and 95 deletions
|
@ -1292,35 +1292,33 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
pth->skyface = facen;
|
pth->skyface = facen;
|
||||||
pth->hicr = hicr;
|
pth->hicr = hicr;
|
||||||
|
|
||||||
if (glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & HICR_NOSAVE))
|
if (!gotcache && glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & HICR_NOSAVE))
|
||||||
if (!gotcache)
|
{
|
||||||
|
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
|
||||||
|
|
||||||
|
// save off the compressed version
|
||||||
|
cachead.quality = (hicr->flags & HICR_NOCOMPRESS) ? 0 : r_downsize;
|
||||||
|
cachead.xdim = tsiz.x >> cachead.quality;
|
||||||
|
cachead.ydim = tsiz.y >> cachead.quality;
|
||||||
|
|
||||||
|
// handle nocompress:
|
||||||
|
cachead.flags = nonpow2 * CACHEAD_NONPOW2 | (hasalpha != 255 ? CACHEAD_HASALPHA : 0) |
|
||||||
|
(hicr->flags & HICR_NOCOMPRESS ? CACHEAD_NOCOMPRESS : 0);
|
||||||
|
|
||||||
|
/// OSD_Printf("Caching \"%s\"\n", fn);
|
||||||
|
texcache_writetex(fn, picfillen + (dapalnum << 8), dameth, effect, &cachead);
|
||||||
|
|
||||||
|
if (willprint)
|
||||||
{
|
{
|
||||||
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
|
int32_t etime = getticks() - startticks;
|
||||||
|
if (etime >= MIN_CACHETIME_PRINT)
|
||||||
// save off the compressed version
|
OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... cached... %d ms\n", dapic, dapalnum, dameth, effect,
|
||||||
cachead.quality = (hicr->flags & HICR_NOCOMPRESS) ? 0 : r_downsize;
|
willprint == 2 ? fn : "", etime);
|
||||||
cachead.xdim = tsiz.x>>cachead.quality;
|
willprint = 0;
|
||||||
cachead.ydim = tsiz.y>>cachead.quality;
|
|
||||||
|
|
||||||
// handle nocompress:
|
|
||||||
cachead.flags = nonpow2*CACHEAD_NONPOW2 |
|
|
||||||
(hasalpha != 255 ? CACHEAD_HASALPHA : 0) |
|
|
||||||
(hicr->flags & HICR_NOCOMPRESS ? CACHEAD_NOCOMPRESS : 0);
|
|
||||||
|
|
||||||
/// OSD_Printf("Caching \"%s\"\n", fn);
|
|
||||||
texcache_writetex(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
|
|
||||||
|
|
||||||
if (willprint)
|
|
||||||
{
|
|
||||||
int32_t etime = getticks()-startticks;
|
|
||||||
if (etime>=MIN_CACHETIME_PRINT)
|
|
||||||
OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... cached... %d ms\n", dapic, dapalnum, dameth, effect,
|
|
||||||
willprint==2 ? fn : "", etime);
|
|
||||||
willprint = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
OSD_Printf("Cached \"%s\"\n", fn);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
OSD_Printf("Cached \"%s\"\n", fn);
|
||||||
|
}
|
||||||
|
|
||||||
if (willprint)
|
if (willprint)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1143,8 +1143,6 @@ static void destroy_window_resources()
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
void sdlayer_setvideomode_opengl(void)
|
void sdlayer_setvideomode_opengl(void)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
|
|
||||||
polymost_glreset();
|
polymost_glreset();
|
||||||
|
|
||||||
bglEnable(GL_TEXTURE_2D);
|
bglEnable(GL_TEXTURE_2D);
|
||||||
|
@ -1192,31 +1190,32 @@ void sdlayer_setvideomode_opengl(void)
|
||||||
glinfo.texcompr = 0;
|
glinfo.texcompr = 0;
|
||||||
|
|
||||||
// process the extensions string and flag stuff we recognize
|
// process the extensions string and flag stuff we recognize
|
||||||
p = Bstrdup(glinfo.extensions);
|
glinfo.clamptoedge = !!Bstrstr(glinfo.extensions, "GL_EXT_texture_edge_clamp") ||
|
||||||
|
!!Bstrstr(glinfo.extensions, "GL_SGIS_texture_edge_clamp");
|
||||||
|
glinfo.bgra = !!Bstrstr(glinfo.extensions, "GL_EXT_bgra");
|
||||||
|
glinfo.texcompr =
|
||||||
|
!!Bstrstr(glinfo.extensions, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
|
||||||
|
glinfo.texnpot = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_non_power_of_two");
|
||||||
|
glinfo.multisample = !!Bstrstr(glinfo.extensions, "GL_ARB_multisample");
|
||||||
|
glinfo.nvmultisamplehint = !!Bstrstr(glinfo.extensions, "GL_NV_multisample_filter_hint");
|
||||||
|
glinfo.arbfp = !!Bstrstr(glinfo.extensions, "GL_ARB_fragment_program");
|
||||||
|
glinfo.depthtex = !!Bstrstr(glinfo.extensions, "GL_ARB_depth_texture");
|
||||||
|
glinfo.shadow = !!Bstrstr(glinfo.extensions, "GL_ARB_shadow");
|
||||||
|
glinfo.fbos = !!Bstrstr(glinfo.extensions, "GL_EXT_framebuffer_object");
|
||||||
|
glinfo.rect =
|
||||||
|
!!Bstrstr(glinfo.extensions, "GL_NV_texture_rectangle") || !!Bstrstr(glinfo.extensions, "GL_EXT_texture_rectangle");
|
||||||
|
glinfo.multitex = !!Bstrstr(glinfo.extensions, "GL_ARB_multitexture");
|
||||||
|
glinfo.envcombine = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_env_combine");
|
||||||
|
glinfo.vbos = !!Bstrstr(glinfo.extensions, "GL_ARB_vertex_buffer_object");
|
||||||
|
glinfo.sm4 = !!Bstrstr(glinfo.extensions, "GL_EXT_gpu_shader4");
|
||||||
|
glinfo.occlusionqueries = !!Bstrstr(glinfo.extensions, "GL_ARB_occlusion_query");
|
||||||
|
glinfo.glsl = !!Bstrstr(glinfo.extensions, "GL_ARB_shader_objects");
|
||||||
|
glinfo.debugoutput = !!Bstrstr(glinfo.extensions, "GL_ARB_debug_output");
|
||||||
|
|
||||||
glinfo.clamptoedge = !!Bstrstr(p, "GL_EXT_texture_edge_clamp") || !!Bstrstr(p, "GL_SGIS_texture_edge_clamp");
|
if (Bstrstr(glinfo.extensions, "GL_EXT_texture_filter_anisotropic"))
|
||||||
glinfo.bgra = !!Bstrstr(p, "GL_EXT_bgra");
|
|
||||||
glinfo.texcompr = !!Bstrstr(p, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
|
|
||||||
glinfo.texnpot = !!Bstrstr(p, "GL_ARB_texture_non_power_of_two");
|
|
||||||
glinfo.multisample = !!Bstrstr(p, "GL_ARB_multisample");
|
|
||||||
glinfo.nvmultisamplehint = !!Bstrstr(p, "GL_NV_multisample_filter_hint");
|
|
||||||
glinfo.arbfp = !!Bstrstr(p, "GL_ARB_fragment_program");
|
|
||||||
glinfo.depthtex = !!Bstrstr(p, "GL_ARB_depth_texture");
|
|
||||||
glinfo.shadow = !!Bstrstr(p, "GL_ARB_shadow");
|
|
||||||
glinfo.fbos = !!Bstrstr(p, "GL_EXT_framebuffer_object");
|
|
||||||
glinfo.rect = !!Bstrstr(p, "GL_NV_texture_rectangle") || !!Bstrstr(p, "GL_EXT_texture_rectangle");
|
|
||||||
glinfo.multitex = !!Bstrstr(p, "GL_ARB_multitexture");
|
|
||||||
glinfo.envcombine = !!Bstrstr(p, "GL_ARB_texture_env_combine");
|
|
||||||
glinfo.vbos = !!Bstrstr(p, "GL_ARB_vertex_buffer_object");
|
|
||||||
glinfo.sm4 = !!Bstrstr(p, "GL_EXT_gpu_shader4");
|
|
||||||
glinfo.occlusionqueries = !!Bstrstr(p, "GL_ARB_occlusion_query");
|
|
||||||
glinfo.glsl = !!Bstrstr(p, "GL_ARB_shader_objects");
|
|
||||||
glinfo.debugoutput = !!Bstrstr(p, "GL_ARB_debug_output");
|
|
||||||
|
|
||||||
if (Bstrstr(p, "GL_EXT_texture_filter_anisotropic"))
|
|
||||||
bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
|
bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
|
||||||
|
|
||||||
if (Bstrstr(p, "WGL_3DFX_gamma_control"))
|
if (Bstrstr(glinfo.extensions, "WGL_3DFX_gamma_control"))
|
||||||
{
|
{
|
||||||
static int32_t warnonce;
|
static int32_t warnonce;
|
||||||
// 3dfx cards have issues with fog
|
// 3dfx cards have issues with fog
|
||||||
|
@ -1650,13 +1649,10 @@ int32_t setgamma(void)
|
||||||
|
|
||||||
#if !defined(__APPLE__) && !defined(__ANDROID__)
|
#if !defined(__APPLE__) && !defined(__ANDROID__)
|
||||||
extern struct sdlappicon sdlappicon;
|
extern struct sdlappicon sdlappicon;
|
||||||
static SDL_Surface *loadappicon(void)
|
static inline SDL_Surface *loadappicon(void)
|
||||||
{
|
{
|
||||||
SDL_Surface *surf;
|
SDL_Surface *surf = SDL_CreateRGBSurfaceFrom((void *)sdlappicon.pixels, sdlappicon.width, sdlappicon.height, 32,
|
||||||
|
sdlappicon.width * 4, 0xffl, 0xff00l, 0xff0000l, 0xff000000l);
|
||||||
surf = SDL_CreateRGBSurfaceFrom((void *)sdlappicon.pixels, sdlappicon.width, sdlappicon.height, 32,
|
|
||||||
sdlappicon.width * 4, 0xffl, 0xff00l, 0xff0000l, 0xff000000l);
|
|
||||||
|
|
||||||
return surf;
|
return surf;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,7 +95,7 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
|
||||||
int32_t tilestat;
|
int32_t tilestat;
|
||||||
pthtyp *pth;
|
pthtyp *pth;
|
||||||
|
|
||||||
const int32_t j = dapicnum&(GLTEXCACHEADSIZ-1);
|
const int32_t j = dapicnum & (GLTEXCACHEADSIZ - 1);
|
||||||
hicreplctyp *si = usehightile ? hicfindsubst(dapicnum, dapalnum) : NULL;
|
hicreplctyp *si = usehightile ? hicfindsubst(dapicnum, dapalnum) : NULL;
|
||||||
|
|
||||||
if (drawingskybox && usehightile)
|
if (drawingskybox && usehightile)
|
||||||
|
@ -107,8 +107,8 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
|
||||||
|
|
||||||
if (!si)
|
if (!si)
|
||||||
{
|
{
|
||||||
if (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS)) return NULL;
|
return (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS) || hicprecaching) ?
|
||||||
return hicprecaching ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if palette > 0 && replacement found
|
/* if palette > 0 && replacement found
|
||||||
|
@ -118,57 +118,56 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// load a replacement
|
// load a replacement
|
||||||
for (pth=texcache.list[j]; pth; pth=pth->next)
|
for (pth = texcache.list[j]; pth; pth = pth->next)
|
||||||
{
|
{
|
||||||
if (pth->picnum == dapicnum && pth->palnum == si->palnum &&
|
if (pth->picnum == dapicnum && pth->palnum == si->palnum &&
|
||||||
(si->palnum>0 ? 1 : (pth->effects == hictinting[dapalnum].f)) &&
|
(si->palnum > 0 ? 1 : (pth->effects == hictinting[dapalnum].f)) &&
|
||||||
(pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX))
|
(pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX)) ==
|
||||||
== (TO_PTH_CLAMPED(dameth) + PTH_HIGHTILE + (drawingskybox>0)*PTH_SKYBOX) &&
|
(TO_PTH_CLAMPED(dameth) + PTH_HIGHTILE + (drawingskybox > 0) * PTH_SKYBOX) &&
|
||||||
(drawingskybox>0 ? (pth->skyface == drawingskybox) : 1)
|
(drawingskybox > 0 ? (pth->skyface == drawingskybox) : 1))
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (pth->flags & PTH_INVALIDATED)
|
if (pth->flags & PTH_INVALIDATED)
|
||||||
{
|
{
|
||||||
pth->flags &= ~PTH_INVALIDATED;
|
pth->flags &= ~PTH_INVALIDATED;
|
||||||
|
|
||||||
tilestat = gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 0,
|
tilestat = gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 0,
|
||||||
(si->palnum>0) ? 0 : hictinting[dapalnum].f); // reload tile
|
(si->palnum > 0) ? 0 : hictinting[dapalnum].f); // reload tile
|
||||||
|
|
||||||
if (tilestat)
|
if (!tilestat)
|
||||||
{
|
continue;
|
||||||
if (tilestat == -2) // bad filename
|
|
||||||
hicclearsubst(dapicnum, dapalnum);
|
if (tilestat == -2) // bad filename
|
||||||
if (drawingskybox) return NULL;
|
hicclearsubst(dapicnum, dapalnum);
|
||||||
return hicprecaching ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
return (drawingskybox || hicprecaching) ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(pth);
|
return (pth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pth = (pthtyp *)Xcalloc(1,sizeof(pthtyp));
|
pth = (pthtyp *)Xcalloc(1, sizeof(pthtyp));
|
||||||
|
|
||||||
// possibly fetch an already loaded multitexture :_)
|
// possibly fetch an already loaded multitexture :_)
|
||||||
if (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS) && texcache_fetchmulti(pth, si, dapicnum, dameth))
|
if (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS) && texcache_fetchmulti(pth, si, dapicnum, dameth))
|
||||||
return pth;
|
return pth;
|
||||||
|
|
||||||
tilestat = gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 1, (si->palnum>0) ? 0 : hictinting[dapalnum].f);
|
tilestat =
|
||||||
|
gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 1, (si->palnum > 0) ? 0 : hictinting[dapalnum].f);
|
||||||
|
|
||||||
if (tilestat)
|
if (!tilestat)
|
||||||
{
|
{
|
||||||
if (tilestat == -2) // bad filename
|
pth->next = texcache.list[j];
|
||||||
hicclearsubst(dapicnum, dapalnum);
|
pth->palnum = si->palnum;
|
||||||
Bfree(pth);
|
texcache.list[j] = pth;
|
||||||
if (drawingskybox) return NULL;
|
return pth;
|
||||||
return hicprecaching ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pth->palnum = si->palnum;
|
if (tilestat == -2) // bad filename
|
||||||
pth->next = texcache.list[j];
|
hicclearsubst(dapicnum, dapalnum);
|
||||||
texcache.list[j] = pth;
|
|
||||||
|
|
||||||
return(pth);
|
Bfree(pth);
|
||||||
|
|
||||||
|
return (drawingskybox || hicprecaching) ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void texcache_closefiles(void)
|
static void texcache_closefiles(void)
|
||||||
|
@ -183,25 +182,25 @@ static void texcache_closefiles(void)
|
||||||
|
|
||||||
void texcache_freeptrs(void)
|
void texcache_freeptrs(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
texcache.iptrcnt = 0;
|
||||||
|
|
||||||
if (texcache.iptrs)
|
if (!texcache.iptrs)
|
||||||
for (i = 0; i < texcache.numentries; i++)
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < texcache.numentries; i++)
|
||||||
if (texcache.iptrs[i])
|
if (texcache.iptrs[i])
|
||||||
{
|
{
|
||||||
int32_t ii;
|
for (int ii = texcache.numentries - 1; ii >= 0; ii--)
|
||||||
for (ii = texcache.numentries-1; ii >= 0; ii--)
|
|
||||||
if (i != ii && texcache.iptrs[ii] == texcache.iptrs[i])
|
if (i != ii && texcache.iptrs[ii] == texcache.iptrs[i])
|
||||||
{
|
{
|
||||||
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/
|
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/
|
||||||
texcache.iptrs[ii] = NULL;
|
texcache.iptrs[ii] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bfree(texcache.iptrs[i]);
|
Bfree(texcache.iptrs[i]);
|
||||||
texcache.iptrs[i] = NULL;
|
texcache.iptrs[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
texcache.iptrcnt = 0;
|
|
||||||
DO_FREE_AND_NULL(texcache.iptrs);
|
DO_FREE_AND_NULL(texcache.iptrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue