Browse Source

ref: add R_GammaChanged function that engine calls on every gamma change

pull/2/head
Alibek Omarov 6 months ago
parent
commit
a0c31120d9
  1. 1
      engine/ref_api.h
  2. 1
      ref/gl/gl_context.c
  3. 2
      ref/gl/gl_local.h
  4. 16
      ref/gl/gl_rmain.c
  5. 1
      ref/soft/r_context.c
  6. 1
      ref/soft/r_local.h
  7. 8
      ref/soft/r_main.c

1
engine/ref_api.h

@ -463,6 +463,7 @@ typedef struct ref_interface_s @@ -463,6 +463,7 @@ typedef struct ref_interface_s
void (*GL_ClearExtensions)( void );
// scene rendering
void (*R_GammaChanged)( qboolean do_reset_gamma );
void (*R_BeginFrame)( qboolean clearScene );
void (*R_RenderScene)( void );
void (*R_EndFrame)( void );

1
ref/gl/gl_context.c

@ -372,6 +372,7 @@ ref_interface_t gReffuncs = @@ -372,6 +372,7 @@ ref_interface_t gReffuncs =
GL_InitExtensions,
GL_ClearExtensions,
R_GammaChanged,
R_BeginFrame,
R_RenderScene,
R_EndFrame,

2
ref/gl/gl_local.h

@ -402,7 +402,6 @@ void R_AllowFog( qboolean allowed ); @@ -402,7 +402,6 @@ void R_AllowFog( qboolean allowed );
qboolean R_OpaqueEntity( cl_entity_t *ent );
void R_SetupFrustum( void );
void R_FindViewLeaf( void );
void R_CheckGamma( void );
void R_PushScene( void );
void R_PopScene( void );
void R_DrawFog( void );
@ -534,6 +533,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags ); @@ -534,6 +533,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
void GL_FreeImage( const char *name );
qboolean VID_ScreenShot( const char *filename, int shot_type );
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
void R_GammaChanged( qboolean do_reset_gamma );
void R_BeginFrame( qboolean clearScene );
void R_RenderFrame( const struct ref_viewpass_s *vp );
void R_EndFrame( void );

16
ref/gl/gl_rmain.c

@ -985,6 +985,22 @@ void R_RenderScene( void ) @@ -985,6 +985,22 @@ void R_RenderScene( void )
R_EndGL();
}
void R_GammaChanged( qboolean do_reset_gamma )
{
if( do_reset_gamma )
{
// paranoia cubemap rendering
if( gEngfuncs.drawFuncs->GL_BuildLightmaps )
gEngfuncs.drawFuncs->GL_BuildLightmaps( );
}
else
{
glConfig.softwareGammaUpdate = true;
GL_RebuildLightmaps();
glConfig.softwareGammaUpdate = false;
}
}
/*
===============
R_BeginFrame

1
ref/soft/r_context.c

@ -418,6 +418,7 @@ ref_interface_t gReffuncs = @@ -418,6 +418,7 @@ ref_interface_t gReffuncs =
GL_InitExtensions,
GL_ClearExtensions,
R_GammaChanged,
R_BeginFrame,
R_RenderScene,
R_EndFrame,

1
ref/soft/r_local.h

@ -607,6 +607,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags ); @@ -607,6 +607,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
void GL_FreeImage( const char *name );
qboolean VID_ScreenShot( const char *filename, int shot_type );
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
void R_GammaChanged( qboolean do_reset_gamma );
void R_BeginFrame( qboolean clearScene );
void R_RenderFrame( const struct ref_viewpass_s *vp );
void R_EndFrame( void );

8
ref/soft/r_main.c

@ -1636,6 +1636,14 @@ qboolean R_DoResetGamma( void ) @@ -1636,6 +1636,14 @@ qboolean R_DoResetGamma( void )
#endif
}
void R_GammaChanged( qboolean do_reset_gamma )
{
if( do_reset_gamma ) // unused
return;
D_FlushCaches( );
}
/*
===============
R_BeginFrame

Loading…
Cancel
Save