Remove MAX_GLTEXTURES limit.

This commit is contained in:
Shpoike 2020-07-11 20:43:19 +01:00
parent bd6d2ab660
commit 6e809c4999
1 changed files with 11 additions and 5 deletions

View File

@ -33,7 +33,6 @@ static cvar_t gl_max_size = {"gl_max_size", "0", CVAR_NONE};
static cvar_t gl_picmip = {"gl_picmip", "0", CVAR_NONE};
static GLint gl_hardware_maxsize;
#define MAX_GLTEXTURES 2048
static int numgltextures;
static gltexture_t *active_gltextures, *free_gltextures;
gltexture_t *notexture, *nulltexture;
@ -382,8 +381,14 @@ gltexture_t *TexMgr_NewTexture (void)
{
gltexture_t *glt;
if (numgltextures == MAX_GLTEXTURES)
Sys_Error("numgltextures == MAX_GLTEXTURES\n");
if (!free_gltextures)
{
int i, newtexturecount = 64;
free_gltextures = (gltexture_t *) malloc (newtexturecount * sizeof(gltexture_t));
for (i = 0; i < newtexturecount - 1; i++)
free_gltextures[i].next = &free_gltextures[i+1];
free_gltextures[i].next = NULL;
}
glt = free_gltextures;
free_gltextures = glt->next;
@ -660,9 +665,10 @@ void TexMgr_Init (void)
extern texture_t *r_notexture_mip, *r_notexture_mip2;
// init texture list
free_gltextures = (gltexture_t *) Hunk_AllocName (MAX_GLTEXTURES * sizeof(gltexture_t), "gltextures");
int initialtexturecount = 256;
free_gltextures = (gltexture_t *) Hunk_AllocName (initialtexturecount * sizeof(gltexture_t), "gltextures");
active_gltextures = NULL;
for (i = 0; i < MAX_GLTEXTURES - 1; i++)
for (i = 0; i < initialtexturecount - 1; i++)
free_gltextures[i].next = &free_gltextures[i+1];
free_gltextures[i].next = NULL;
numgltextures = 0;