mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
more internal cleanup...
the only visible change is that polymost_trytexcache (formerly two instances of nearly duplicate code) now prints a diagnostic after a cache miss. The one that one is most likely to encounter is "r_downsize doesn't match", meaning that this setting likely differs between Mapster and the game. git-svn-id: https://svn.eduke32.com/eduke32@2248 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e3150b2801
commit
7e6f712ad1
3 changed files with 65 additions and 152 deletions
|
@ -32,8 +32,7 @@ struct glfiltermodes {
|
||||||
#define numglfiltermodes 6
|
#define numglfiltermodes 6
|
||||||
extern struct glfiltermodes glfiltermodes[numglfiltermodes];
|
extern struct glfiltermodes glfiltermodes[numglfiltermodes];
|
||||||
|
|
||||||
extern const char *TEXCACHEDIR;
|
//void phex(char v, char *s);
|
||||||
void phex(char v, char *s);
|
|
||||||
void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt, int32_t texfmt, coltype *pic, int32_t tsizx, int32_t tsizy, int32_t dameth);
|
void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt, int32_t texfmt, coltype *pic, int32_t tsizx, int32_t tsizy, int32_t dameth);
|
||||||
void polymost_drawsprite(int32_t snum);
|
void polymost_drawsprite(int32_t snum);
|
||||||
void polymost_drawmaskwall(int32_t damaskwallcnt);
|
void polymost_drawmaskwall(int32_t damaskwallcnt);
|
||||||
|
@ -76,12 +75,14 @@ typedef struct cacheitem_t texcacheindex;
|
||||||
//extern texcacheindex *firstcacheindex;
|
//extern texcacheindex *firstcacheindex;
|
||||||
//extern texcacheindex *curcacheindex;
|
//extern texcacheindex *curcacheindex;
|
||||||
extern texcacheindex *cacheptrs[MAXTILES<<1];
|
extern texcacheindex *cacheptrs[MAXTILES<<1];
|
||||||
extern int32_t numcacheentries;
|
//extern int32_t numcacheentries;
|
||||||
|
|
||||||
int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, uint32_t miplen);
|
int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, void *midbuf, char *packbuf, uint32_t miplen);
|
||||||
int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked);
|
int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked);
|
||||||
|
|
||||||
void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head);
|
void writexcache(const char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head);
|
||||||
|
int32_t polymost_trytexcache(const char *fn, int32_t len, int32_t dameth, char effect,
|
||||||
|
texcacheheader *head, int32_t modelp);
|
||||||
|
|
||||||
extern float shadescale;
|
extern float shadescale;
|
||||||
extern int32_t shadescale_unbounded;
|
extern int32_t shadescale_unbounded;
|
||||||
|
@ -105,21 +106,12 @@ typedef struct pthtyp_t
|
||||||
struct pthtyp_t *ofb; // only fullbright
|
struct pthtyp_t *ofb; // only fullbright
|
||||||
} pthtyp;
|
} pthtyp;
|
||||||
|
|
||||||
pthtyp * gltexcache (int32_t dapicnum, int32_t dapalnum, int32_t dameth);
|
pthtyp *gltexcache(int32_t dapicnum, int32_t dapalnum, int32_t dameth);
|
||||||
|
|
||||||
extern palette_t hictinting[MAXPALOOKUPS];
|
|
||||||
extern float gtang;
|
|
||||||
extern int32_t globalposx, globalposy, globalposz, globalhoriz;
|
|
||||||
extern int16_t globalang, globalcursectnum;
|
|
||||||
extern int32_t globalpal, cosglobalang, singlobalang;
|
|
||||||
extern int32_t cosviewingrangeglobalang, sinviewingrangeglobalang;
|
|
||||||
extern float shadescale;
|
|
||||||
extern int32_t globalnoeffect;
|
extern int32_t globalnoeffect;
|
||||||
extern int32_t drawingskybox;
|
extern int32_t drawingskybox;
|
||||||
|
|
||||||
extern double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz;
|
extern double gyxscale, gxyaspect, /*gviewxrange,*/ ghalfx, grhalfxdown10, ghoriz;
|
||||||
extern double gcosang, gsinang, gcosang2, gsinang2;
|
|
||||||
extern double gchang, gshang, gctang, gstang, gvisibility;
|
|
||||||
|
|
||||||
#define FOGSCALE 0.0000768
|
#define FOGSCALE 0.0000768
|
||||||
|
|
||||||
|
|
|
@ -610,105 +610,7 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// JONOF'S COMPRESSED TEXTURE CACHE STUFF ---------------------------------------------------
|
// JONOF'S COMPRESSED TEXTURE CACHE STUFF ---------------------------------------------------
|
||||||
int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect, texcacheheader *head)
|
static int32_t mdloadskin_cached(int32_t fil, const texcacheheader *head, int32_t *doalloc, GLuint *glpic, int32_t *xsiz, int32_t *ysiz, int32_t pal)
|
||||||
{
|
|
||||||
int32_t fp, err=0;
|
|
||||||
char cachefn[BMAX_PATH], *cp;
|
|
||||||
uint8_t mdsum[16];
|
|
||||||
|
|
||||||
if (!glinfo.texcompr || !glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1;
|
|
||||||
if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
|
|
||||||
{
|
|
||||||
// lacking the necessary extensions to do this
|
|
||||||
OSD_Printf("Warning: the GL driver lacks necessary functions to use caching\n");
|
|
||||||
glusetexcache = 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
md4once((uint8_t *)fn, strlen(fn), mdsum);
|
|
||||||
// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++);
|
|
||||||
// *(cp++) = '/';
|
|
||||||
cp = cachefn;
|
|
||||||
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
|
||||||
Bsprintf(cp, "-%x-%x%x", len, pal, effect);
|
|
||||||
|
|
||||||
// fil = kopen4load(cachefn, 0);
|
|
||||||
// if (fil < 0) return -1;
|
|
||||||
|
|
||||||
{
|
|
||||||
int32_t offset = 0;
|
|
||||||
int32_t len = 0;
|
|
||||||
int32_t i;
|
|
||||||
/*
|
|
||||||
texcacheindex *cacheindexptr = &firstcacheindex;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// initprintf("checking %s against %s\n",cachefn,cacheindexptr->name);
|
|
||||||
if (!Bstrcmp(cachefn,cacheindexptr->name))
|
|
||||||
{
|
|
||||||
offset = cacheindexptr->offset;
|
|
||||||
len = cacheindexptr->len;
|
|
||||||
// initprintf("got a match for %s offset %d\n",cachefn,offset);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cacheindexptr = cacheindexptr->next;
|
|
||||||
}
|
|
||||||
while (cacheindexptr->next);
|
|
||||||
*/
|
|
||||||
i = hash_find(&h_texcache,cachefn);
|
|
||||||
if (i != -1)
|
|
||||||
{
|
|
||||||
texcacheindex *cacheindexptr = cacheptrs[i];
|
|
||||||
len = cacheindexptr->len;
|
|
||||||
offset = cacheindexptr->offset;
|
|
||||||
// initprintf("got a match for %s offset %d\n",cachefn,offset);
|
|
||||||
}
|
|
||||||
if (len == 0) return -1; // didn't find it
|
|
||||||
cachepos = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
// initprintf("Loading cached skin: %s\n", cachefn);
|
|
||||||
|
|
||||||
if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(texcacheheader)))
|
|
||||||
{
|
|
||||||
// initprintf("using memcache!\n");
|
|
||||||
Bmemcpy(head, memcachedata + cachepos, sizeof(texcacheheader));
|
|
||||||
cachepos += sizeof(texcacheheader);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Blseek(cachefilehandle, cachepos, BSEEK_SET);
|
|
||||||
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader))
|
|
||||||
{
|
|
||||||
cachepos += sizeof(texcacheheader);
|
|
||||||
err = 1;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
cachepos += sizeof(texcacheheader);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp(head->magic, TEXCACHEMAGIC, 4)) { err=2; goto failure; }
|
|
||||||
|
|
||||||
head->xdim = B_LITTLE32(head->xdim);
|
|
||||||
head->ydim = B_LITTLE32(head->ydim);
|
|
||||||
head->flags = B_LITTLE32(head->flags);
|
|
||||||
head->quality = B_LITTLE32(head->quality);
|
|
||||||
|
|
||||||
if (head->quality != r_downsize) { err=3; goto failure; }
|
|
||||||
if ((head->flags & 4) && glusetexcache != 2) { err=4; goto failure; }
|
|
||||||
if (!(head->flags & 4) && glusetexcache == 2) { err=5; goto failure; }
|
|
||||||
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) { err=6; goto failure; }
|
|
||||||
if (!glinfo.texnpot && (head->flags & 1)) { err=7; goto failure; }
|
|
||||||
|
|
||||||
return cachefilehandle;
|
|
||||||
failure:
|
|
||||||
// kclose(fil);
|
|
||||||
initprintf("skin cache miss: %d\n", err);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mdloadskin_cached(int32_t fil, texcacheheader *head, int32_t *doalloc, GLuint *glpic, int32_t *xsiz, int32_t *ysiz, int32_t pal)
|
|
||||||
{
|
{
|
||||||
int32_t level, r;
|
int32_t level, r;
|
||||||
texcachepicture pict;
|
texcachepicture pict;
|
||||||
|
@ -866,7 +768,8 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
||||||
|
|
||||||
startticks = getticks();
|
startticks = getticks();
|
||||||
|
|
||||||
cachefil = mdloadskin_trytexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), &cachead);
|
cachefil = polymost_trytexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK),
|
||||||
|
&cachead, 1);
|
||||||
if (cachefil >= 0 && !mdloadskin_cached(cachefil, &cachead, &doalloc, texidx, &xsiz, &ysiz, pal))
|
if (cachefil >= 0 && !mdloadskin_cached(cachefil, &cachead, &doalloc, texidx, &xsiz, &ysiz, pal))
|
||||||
{
|
{
|
||||||
osizx = cachead.xdim;
|
osizx = cachead.xdim;
|
||||||
|
|
|
@ -117,7 +117,8 @@ int32_t shadescale_unbounded = 0;
|
||||||
|
|
||||||
int32_t r_usenewshading = 1;
|
int32_t r_usenewshading = 1;
|
||||||
|
|
||||||
double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz;
|
static double gviewxrange;
|
||||||
|
double gyxscale, gxyaspect, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz;
|
||||||
double gcosang, gsinang, gcosang2, gsinang2;
|
double gcosang, gsinang, gcosang2, gsinang2;
|
||||||
double gchang, gshang, gctang, gstang, gvisibility;
|
double gchang, gshang, gctang, gstang, gvisibility;
|
||||||
float gtang = 0.0;
|
float gtang = 0.0;
|
||||||
|
@ -303,11 +304,11 @@ float alphahackarray[MAXTILES];
|
||||||
static texcacheindex *firstcacheindex = NULL;
|
static texcacheindex *firstcacheindex = NULL;
|
||||||
static texcacheindex *curcacheindex = NULL;
|
static texcacheindex *curcacheindex = NULL;
|
||||||
texcacheindex *cacheptrs[MAXTILES<<1];
|
texcacheindex *cacheptrs[MAXTILES<<1];
|
||||||
int32_t numcacheentries = 0;
|
static int32_t numcacheentries = 0;
|
||||||
|
|
||||||
|
|
||||||
#define GLTEXCACHEADSIZ 8192
|
#define GLTEXCACHEADSIZ 8192
|
||||||
pthtyp *gltexcachead[GLTEXCACHEADSIZ];
|
static pthtyp *gltexcachead[GLTEXCACHEADSIZ];
|
||||||
|
|
||||||
int32_t drawingskybox = 0;
|
int32_t drawingskybox = 0;
|
||||||
|
|
||||||
|
@ -582,7 +583,7 @@ static void Cachefile_CloseBoth(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cachefile_RemoveDups(void)
|
static void Cachefile_Free(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
|
@ -681,7 +682,7 @@ void polymost_glreset()
|
||||||
memset(gltexcachead,0,sizeof(gltexcachead));
|
memset(gltexcachead,0,sizeof(gltexcachead));
|
||||||
glox1 = -1;
|
glox1 = -1;
|
||||||
|
|
||||||
Cachefile_RemoveDups();
|
Cachefile_Free();
|
||||||
|
|
||||||
polymost_cachesync();
|
polymost_cachesync();
|
||||||
#ifdef DEBUGGINGAIDS
|
#ifdef DEBUGGINGAIDS
|
||||||
|
@ -700,7 +701,7 @@ static void clear_cache_internal(void)
|
||||||
memcachesize = -1;
|
memcachesize = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cachefile_RemoveDups();
|
Cachefile_Free();
|
||||||
|
|
||||||
curcacheindex = firstcacheindex = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
|
curcacheindex = firstcacheindex = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
|
||||||
numcacheentries = 0;
|
numcacheentries = 0;
|
||||||
|
@ -1309,7 +1310,7 @@ static int32_t LoadCacheOffsets(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void phex(char v, char *s)
|
static void phex(char v, char *s)
|
||||||
{
|
{
|
||||||
int32_t x;
|
int32_t x;
|
||||||
x = v>>4;
|
x = v>>4;
|
||||||
|
@ -1318,12 +1319,14 @@ void phex(char v, char *s)
|
||||||
s[1] = x<10 ? (x+'0') : (x-10+'a');
|
s[1] = x<10 ? (x+'0') : (x-10+'a');
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head)
|
int32_t polymost_trytexcache(const char *fn, int32_t len, int32_t dameth, char effect,
|
||||||
|
texcacheheader *head, int32_t modelp)
|
||||||
{
|
{
|
||||||
int32_t fp, err=0;
|
int32_t fp, err=0;
|
||||||
char cachefn[BMAX_PATH], *cp;
|
char cachefn[BMAX_PATH], *cp;
|
||||||
uint8_t mdsum[16];
|
uint8_t mdsum[16];
|
||||||
|
|
||||||
|
// in the former mdloadskin_trytexcache, glinfo.texcompr used to be in the first check
|
||||||
if (!glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1;
|
if (!glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1;
|
||||||
if (!glinfo.texcompr || !bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
|
if (!glinfo.texcompr || !bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
|
||||||
{
|
{
|
||||||
|
@ -1333,7 +1336,7 @@ static int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, t
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
md4once((uint8_t *)fn, strlen(fn), mdsum);
|
md4once((const uint8_t *)fn, strlen(fn), mdsum);
|
||||||
// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++);
|
// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++);
|
||||||
// *(cp++) = '/';
|
// *(cp++) = '/';
|
||||||
cp = cachefn;
|
cp = cachefn;
|
||||||
|
@ -1341,24 +1344,13 @@ static int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, t
|
||||||
Bsprintf(cp, "-%x-%x%x", len, dameth, effect);
|
Bsprintf(cp, "-%x-%x%x", len, dameth, effect);
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t offset = 0;
|
int32_t i = hash_find(&h_texcache,cachefn);
|
||||||
int32_t i;
|
|
||||||
|
|
||||||
i = hash_find(&h_texcache,cachefn);
|
if (i < 0 || !cacheptrs[i])
|
||||||
if (i > -1)
|
|
||||||
{
|
|
||||||
texcacheindex *t = cacheptrs[i];
|
|
||||||
if (!t)
|
|
||||||
i = -1;
|
|
||||||
else
|
|
||||||
offset = t->offset;
|
|
||||||
/*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < 0)
|
|
||||||
return -1; // didn't find it
|
return -1; // didn't find it
|
||||||
|
|
||||||
cachepos = offset;
|
cachepos = cacheptrs[i]->offset;
|
||||||
|
// initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initprintf("Loading cached tex: %s\n", cachefn);
|
// initprintf("Loading cached tex: %s\n", cachefn);
|
||||||
|
@ -1375,32 +1367,58 @@ static int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, t
|
||||||
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader))
|
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader))
|
||||||
{
|
{
|
||||||
cachepos += sizeof(texcacheheader);
|
cachepos += sizeof(texcacheheader);
|
||||||
err = 1;
|
err = 0;
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
cachepos += sizeof(texcacheheader);
|
cachepos += sizeof(texcacheheader);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Bmemcmp(head->magic, TEXCACHEMAGIC, 4)) { err=2; goto failure; }
|
// checks...
|
||||||
|
if (Bmemcmp(head->magic, TEXCACHEMAGIC, 4)) { err=1; goto failure; }
|
||||||
|
|
||||||
head->xdim = B_LITTLE32(head->xdim);
|
head->xdim = B_LITTLE32(head->xdim);
|
||||||
head->ydim = B_LITTLE32(head->ydim);
|
head->ydim = B_LITTLE32(head->ydim);
|
||||||
head->flags = B_LITTLE32(head->flags);
|
head->flags = B_LITTLE32(head->flags);
|
||||||
head->quality = B_LITTLE32(head->quality);
|
head->quality = B_LITTLE32(head->quality);
|
||||||
|
|
||||||
|
if (modelp)
|
||||||
|
if (head->quality != r_downsize)
|
||||||
|
{
|
||||||
|
err=2;
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
if ((head->flags & 4) && glusetexcache != 2) { err=3; goto failure; }
|
if ((head->flags & 4) && glusetexcache != 2) { err=3; goto failure; }
|
||||||
if (!(head->flags & 4) && glusetexcache == 2) { err=4; goto failure; }
|
if (!(head->flags & 4) && glusetexcache == 2) { err=4; goto failure; }
|
||||||
|
|
||||||
if (!(head->flags & 8) && head->quality != r_downsize) return -1; // handle nocompress
|
if (!modelp) // handle nocompress
|
||||||
|
if (!(head->flags & 8) && head->quality != r_downsize)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) { err=5; goto failure; }
|
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) { err=5; goto failure; }
|
||||||
if (!glinfo.texnpot && (head->flags & 1)) { err=6; goto failure; }
|
if (!glinfo.texnpot && (head->flags & 1)) { err=6; goto failure; }
|
||||||
|
|
||||||
return cachefilehandle;
|
return cachefilehandle;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
initprintf("cache miss: %d\n", err);
|
{
|
||||||
|
static const char *error_msgs[] = {
|
||||||
|
"failed reading texture cache header", // 0
|
||||||
|
"header magic string doesn't match", // 1
|
||||||
|
"r_downsize doesn't match", // 2 (skins only)
|
||||||
|
"compression doesn't match: cache contains compressed tex", // 3
|
||||||
|
"compression doesn't match: cache contains uncompressed tex", // 4
|
||||||
|
"texture in cache exceeds maximum supported size", // 5
|
||||||
|
"texture in cache has non-power-of-two size, unsupported", // 6
|
||||||
|
};
|
||||||
|
|
||||||
|
initprintf("%s cache miss: %s\n", modelp?"Skin":"Texture", error_msgs[err]);
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head)
|
void writexcache(const char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head)
|
||||||
{
|
{
|
||||||
int32_t fp;
|
int32_t fp;
|
||||||
char cachefn[BMAX_PATH], *cp;
|
char cachefn[BMAX_PATH], *cp;
|
||||||
|
@ -1435,7 +1453,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
md4once((uint8_t *)fn, strlen(fn), mdsum);
|
md4once((const uint8_t *)fn, strlen(fn), mdsum);
|
||||||
|
|
||||||
cp = cachefn;
|
cp = cachefn;
|
||||||
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
||||||
|
@ -1695,7 +1713,7 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre
|
||||||
|
|
||||||
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
|
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
|
||||||
|
|
||||||
cachefil = trytexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
|
cachefil = polymost_trytexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead, 0);
|
||||||
if (cachefil >= 0 && !gloadtile_cached(cachefil, &cachead, &doalloc, pth, dapalnum))
|
if (cachefil >= 0 && !gloadtile_cached(cachefil, &cachead, &doalloc, pth, dapalnum))
|
||||||
{
|
{
|
||||||
tsizx = cachead.xdim;
|
tsizx = cachead.xdim;
|
||||||
|
@ -6485,7 +6503,7 @@ Description of Ken's filter to improve LZW compression of DXT1 format by ~15%: (
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, uint32_t miplen)
|
int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, void *midbuf, char *packbuf, uint32_t miplen)
|
||||||
{
|
{
|
||||||
void *writebuf;
|
void *writebuf;
|
||||||
uint32_t j, k, offs, stride, cleng;
|
uint32_t j, k, offs, stride, cleng;
|
||||||
|
@ -6554,7 +6572,7 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c
|
||||||
cptr = midbuf;
|
cptr = midbuf;
|
||||||
for (j=0; (unsigned)j<miplen; j+=stride)
|
for (j=0; (unsigned)j<miplen; j+=stride)
|
||||||
{
|
{
|
||||||
char *c2 = &pic[j+offs+4];
|
const char *c2 = &pic[j+offs+4];
|
||||||
cptr[0] = ((c2[0]>>0)&3) + (((c2[1]>>0)&3)<<2) + (((c2[2]>>0)&3)<<4) + (((c2[3]>>0)&3)<<6);
|
cptr[0] = ((c2[0]>>0)&3) + (((c2[1]>>0)&3)<<2) + (((c2[2]>>0)&3)<<4) + (((c2[3]>>0)&3)<<6);
|
||||||
cptr[1] = ((c2[0]>>2)&3) + (((c2[1]>>2)&3)<<2) + (((c2[2]>>2)&3)<<4) + (((c2[3]>>2)&3)<<6);
|
cptr[1] = ((c2[0]>>2)&3) + (((c2[1]>>2)&3)<<2) + (((c2[2]>>2)&3)<<4) + (((c2[3]>>2)&3)<<6);
|
||||||
cptr[2] = ((c2[0]>>4)&3) + (((c2[1]>>4)&3)<<2) + (((c2[2]>>4)&3)<<4) + (((c2[3]>>4)&3)<<6);
|
cptr[2] = ((c2[0]>>4)&3) + (((c2[1]>>4)&3)<<2) + (((c2[2]>>4)&3)<<4) + (((c2[3]>>4)&3)<<6);
|
||||||
|
@ -6583,7 +6601,7 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked)
|
int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked)
|
||||||
{
|
{
|
||||||
void *inbuf;
|
void *inbuf;
|
||||||
int32_t j, k, offs, stride, cleng;
|
int32_t j, k, offs, stride, cleng;
|
||||||
|
|
Loading…
Reference in a new issue