Inline OGL_TEXTURE_LIST_SIZE

This commit is contained in:
Kp 2017-03-18 18:07:37 +00:00
parent 056115642b
commit dd4bdcb770
2 changed files with 5 additions and 6 deletions

View file

@ -15,8 +15,6 @@
#ifdef __cplusplus
/* I assume this ought to be >= MAX_BITMAP_FILES in piggy.h? */
#define OGL_TEXTURE_LIST_SIZE 20000
void ogl_init_texture_list_internal(void);
void ogl_smash_texture_list_internal(void);

View file

@ -126,7 +126,8 @@ static int r_polyc,r_tpolyc,r_bitmapc,r_ubitbltc;
#define OGL_BINDTEXTURE(a) glBindTexture(GL_TEXTURE_2D, a);
static array<ogl_texture, OGL_TEXTURE_LIST_SIZE> ogl_texture_list;
/* I assume this ought to be >= MAX_BITMAP_FILES in piggy.h? */
static array<ogl_texture, 20000> ogl_texture_list;
static int ogl_texture_list_cur;
/* some function prototypes */
@ -261,11 +262,11 @@ void ogl_smash_texture_list_internal(void){
}
ogl_texture* ogl_get_free_texture(void){
int i;
for (i=0;i<OGL_TEXTURE_LIST_SIZE;i++){
for (unsigned i = ogl_texture_list.size(); i--;)
{
if (ogl_texture_list[ogl_texture_list_cur].handle<=0 && ogl_texture_list[ogl_texture_list_cur].w==0)
return &ogl_texture_list[ogl_texture_list_cur];
if (++ogl_texture_list_cur>=OGL_TEXTURE_LIST_SIZE)
if (++ogl_texture_list_cur >= ogl_texture_list.size())
ogl_texture_list_cur=0;
}
Error("OGL: texture list full!\n");