engine: slightly update RefAPI

This commit is contained in:
Alibek Omarov 2019-10-26 04:37:01 +03:00
parent 9d826016b0
commit 5e8373fa46
4 changed files with 10 additions and 15 deletions

View File

@ -106,6 +106,8 @@ typedef struct ref_globals_s
sortedface_t *draw_surfaces; // used for sorting translucent surfaces
int max_surfaces; // max surfaces per submodel (for all models)
size_t visbytes; // cluster size
int desktopBitsPixel;
} ref_globals_t;
enum

View File

@ -687,25 +687,25 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan
{
if( haveColor && haveAlpha )
{
if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 )
if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 )
tex->format = GL_RGBA16F_ARB;
else tex->format = GL_RGBA32F_ARB;
}
else if( haveColor )
{
if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 )
if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 )
tex->format = GL_RGB16F_ARB;
else tex->format = GL_RGB32F_ARB;
}
else if( haveAlpha )
{
if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 )
if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 )
tex->format = GL_RG16F;
else tex->format = GL_RG32F;
}
else
{
if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 )
if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 )
tex->format = GL_LUMINANCE16F_ARB;
else tex->format = GL_LUMINANCE32F_ARB;
}
@ -713,7 +713,7 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan
else
{
// NOTE: not all the types will be compressed
int bits = glw_state.desktopBitsPixel;
int bits = gpGlobals->desktopBitsPixel;
switch( GL_CalcTextureSamples( channelMask ))
{

View File

@ -691,13 +691,6 @@ typedef struct
typedef struct
{
void* context; // handle to GL rendering context
int safe;
int desktopBitsPixel;
int desktopWidth;
int desktopHeight;
qboolean initialized; // OpenGL subsystem started
qboolean extended; // extended context allows to GL_Debug
} glwstate_t;

View File

@ -1041,7 +1041,7 @@ void GL_SetupAttributes( int safegl )
if( safegl < SAFE_NOACC )
gEngfuncs.GL_SetAttribute( REF_GL_ACCELERATED_VISUAL, 1 );
gEngfuncs.Con_Printf( "bpp %d\n", glw_state.desktopBitsPixel );
gEngfuncs.Con_Printf( "bpp %d\n", gpGlobals->desktopBitsPixel );
if( safegl < SAFE_NOSTENCIL )
gEngfuncs.GL_SetAttribute( REF_GL_STENCIL_SIZE, gl_stencilbits->value );
@ -1056,13 +1056,13 @@ void GL_SetupAttributes( int safegl )
if( safegl < SAFE_NOCOLOR )
{
if( glw_state.desktopBitsPixel >= 24 )
if( gpGlobals->desktopBitsPixel >= 24 )
{
gEngfuncs.GL_SetAttribute( REF_GL_RED_SIZE, 8 );
gEngfuncs.GL_SetAttribute( REF_GL_GREEN_SIZE, 8 );
gEngfuncs.GL_SetAttribute( REF_GL_BLUE_SIZE, 8 );
}
else if( glw_state.desktopBitsPixel >= 16 )
else if( gpGlobals->desktopBitsPixel >= 16 )
{
gEngfuncs.GL_SetAttribute( REF_GL_RED_SIZE, 5 );
gEngfuncs.GL_SetAttribute( REF_GL_GREEN_SIZE, 6 );