Browse Source

engine: slightly update RefAPI

pull/2/head
Alibek Omarov 5 years ago
parent
commit
5e8373fa46
  1. 2
      engine/ref_api.h
  2. 10
      ref_gl/gl_image.c
  3. 7
      ref_gl/gl_local.h
  4. 6
      ref_gl/gl_opengl.c

2
engine/ref_api.h

@ -106,6 +106,8 @@ typedef struct ref_globals_s @@ -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

10
ref_gl/gl_image.c

@ -687,25 +687,25 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan @@ -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 @@ -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 ))
{

7
ref_gl/gl_local.h

@ -691,13 +691,6 @@ typedef struct @@ -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;

6
ref_gl/gl_opengl.c

@ -1041,7 +1041,7 @@ void GL_SetupAttributes( int safegl ) @@ -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 ) @@ -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 );

Loading…
Cancel
Save