Browse Source

ref: restore missing PARM_TEX_MEMORY RenderAPI parameter

pull/2/head
Alibek Omarov 1 year ago
parent
commit
a738b2a50b
  1. 2
      ref/gl/gl_context.c
  2. 19
      ref/gl/gl_image.c
  3. 1
      ref/gl/gl_local.h
  4. 2
      ref/soft/r_context.c
  5. 17
      ref/soft/r_image.c
  6. 2
      ref/soft/r_local.h

2
ref/gl/gl_context.c

@ -212,6 +212,8 @@ static int GL_RefGetParm( int parm, int arg ) @@ -212,6 +212,8 @@ static int GL_RefGetParm( int parm, int arg )
case PARM_TEX_FLAGS:
glt = R_GetTexture( arg );
return glt->flags;
case PARM_TEX_MEMORY:
return GL_TexMemory();
case PARM_ACTIVE_TMU:
return glState.activeTMU;
case PARM_LIGHTSTYLEVALUE:

19
ref/gl/gl_image.c

@ -1607,7 +1607,7 @@ int GL_LoadTextureArray( const char **names, int flags ) @@ -1607,7 +1607,7 @@ int GL_LoadTextureArray( const char **names, int flags )
len += ret;
}
COM_FileBase( names[i], basename, sizeof( basename ));
ret = Q_snprintf( &name[len], sizeof( name ) - len, "%s[%i]", basename, numLayers );
@ -1943,6 +1943,23 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor ) @@ -1943,6 +1943,23 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
gEngfuncs.FS_FreeImage( pic );
}
/*
================
GL_TexMemory
return size of all uploaded textures
================
*/
int GL_TexMemory( void )
{
int i, total = 0;
for( i = 0; i < gl_numTextures; i++ )
total += gl_textures[i].size;
return total;
}
/*
==============================================================================

1
ref/gl/gl_local.h

@ -366,6 +366,7 @@ void R_InitDlightTexture( void ); @@ -366,6 +366,7 @@ void R_InitDlightTexture( void );
void R_TextureList_f( void );
void R_InitImages( void );
void R_ShutdownImages( void );
int GL_TexMemory( void );
//
// gl_rlight.c

2
ref/soft/r_context.c

@ -147,6 +147,8 @@ static int GL_RefGetParm( int parm, int arg ) @@ -147,6 +147,8 @@ static int GL_RefGetParm( int parm, int arg )
case PARM_TEX_FLAGS:
glt = R_GetTexture( arg );
return glt->flags;
case PARM_TEX_MEMORY:
return R_TexMemory();
case PARM_ACTIVE_TMU:
return 0; //glState.activeTMU;
case PARM_LIGHTSTYLEVALUE:

17
ref/soft/r_image.c

@ -1199,6 +1199,23 @@ void GAME_EXPORT GL_ProcessTexture( int texnum, float gamma, int topColor, int b @@ -1199,6 +1199,23 @@ void GAME_EXPORT GL_ProcessTexture( int texnum, float gamma, int topColor, int b
gEngfuncs.FS_FreeImage( pic );
}
/*
================
R_TexMemory
return size of all uploaded textures
================
*/
int R_TexMemory( void )
{
int i, total = 0;
for( i = 0; i < r_numImages; i++ )
total += r_images[i].size;
return total;
}
/*
==============================================================================

2
ref/soft/r_local.h

@ -448,6 +448,8 @@ void R_InitDlightTexture( void ); @@ -448,6 +448,8 @@ void R_InitDlightTexture( void );
void R_TextureList_f( void );
void R_InitImages( void );
void R_ShutdownImages( void );
int R_TexMemory( void );
#if 1
//
// gl_rlight.c

Loading…
Cancel
Save