mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 16:08:01 +00:00
0900f4066c
... and cull code that is dead with the X*alloc() versions since they never return NULL on requesting memory. Use something like git grep '[^Xx]\(m\|c\|re\)alloc *(' and git grep '[^Xx]strdup *(' to see places where I left the B*alloc() calls intact. BUILD_LUNATIC. git-svn-id: https://svn.eduke32.com/eduke32@4491 1a8010ca-5511-0410-912e-c29ae57300e0
68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
#ifndef _texcache_h_
|
|
# define _texcache_h_
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
#define TEXCACHEMAGIC "LZ40"
|
|
#define GLTEXCACHEADSIZ 8192
|
|
#define TEXCACHEHASHSIZE 1024
|
|
|
|
enum texcacherr_t
|
|
{
|
|
TEXCACHERR_NOERROR,
|
|
TEXCACHERR_OUTOFMEMORY, /* unused */
|
|
TEXCACHERR_BUFFERUNDERRUN,
|
|
TEXCACHERR_DEDXT,
|
|
TEXCACHERR_COMPTEX,
|
|
TEXCACHERR_GETTEXLEVEL,
|
|
TEXCACHEERRORS
|
|
};
|
|
|
|
struct texcacheitem_t
|
|
{
|
|
char name[BMAX_PATH];
|
|
int32_t offset;
|
|
int32_t len;
|
|
struct texcacheitem_t *next;
|
|
};
|
|
|
|
typedef struct texcacheitem_t texcacheindex;
|
|
|
|
typedef struct {
|
|
int32_t filehandle, filepos, numentries;
|
|
FILE *index;
|
|
pthtyp *list[GLTEXCACHEADSIZ];
|
|
texcacheindex *firstindex, *currentindex, *ptrs[MAXTILES<<1];
|
|
hashtable_t hashes;
|
|
struct {
|
|
uint8_t *ptr;
|
|
size_t size;
|
|
// Set to 1 when we failed (re)allocating space for the memcache or failing to
|
|
// read into it (which would presumably generate followup errors spamming the
|
|
// log otherwise):
|
|
int32_t noalloc;
|
|
} memcache;
|
|
} globaltexcache;
|
|
|
|
extern globaltexcache texcache;
|
|
|
|
extern char TEXCACHEFILE[BMAX_PATH];
|
|
|
|
extern void texcache_freeptrs(void);
|
|
extern void texcache_syncmemcache(void);
|
|
extern void texcache_init(void);
|
|
extern void texcache_clearmemcache(void);
|
|
extern int32_t texcache_loadoffsets(void);
|
|
extern int32_t texcache_readdata(void *dest, int32_t len);
|
|
extern pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int32_t dameth);
|
|
extern int32_t texcache_loadskin(const texcacheheader *head, int32_t *doalloc, GLuint *glpic, int32_t *xsiz, int32_t *ysiz);
|
|
extern int32_t texcache_loadtile(const texcacheheader *head, int32_t *doalloc, pthtyp *pth);
|
|
extern void texcache_writetex(const char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head);
|
|
extern int32_t texcache_readtexheader(const char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head, int32_t modelp);
|
|
extern void texcache_openfiles(void);
|
|
extern void texcache_setupmemcache(void);
|
|
extern void texcache_checkgarbage(void);
|
|
extern void texcache_setupindex(void);
|
|
|
|
#endif
|
|
#endif
|