mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 11:40:52 +00:00
Fix lighting breaking if trying to use unavailable shaders
This commit is contained in:
parent
ce1d017a73
commit
4e8349fccc
3 changed files with 9 additions and 5 deletions
|
@ -66,7 +66,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
|
|||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
// jimita
|
||||
EXPORT void HWRAPI(LoadShaders) (void);
|
||||
EXPORT boolean HWRAPI(LoadShaders) (void);
|
||||
EXPORT void HWRAPI(KillShaders) (void);
|
||||
EXPORT void HWRAPI(SetShader) (int shader);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
|
|
@ -119,6 +119,8 @@ static line_t *gr_linedef;
|
|||
static sector_t *gr_frontsector;
|
||||
static sector_t *gr_backsector;
|
||||
|
||||
boolean gr_shadersavailable = true;
|
||||
|
||||
// ==========================================================================
|
||||
// View position
|
||||
// ==========================================================================
|
||||
|
@ -142,7 +144,7 @@ static INT32 drawcount = 0;
|
|||
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, UINT32 mixcolor, UINT32 fadecolor)
|
||||
{
|
||||
if (!cv_grshaders.value || (cv_grshaders.value && !cv_grfog.value))
|
||||
if (!cv_grshaders.value || (cv_grshaders.value && !cv_grfog.value) || !gr_shadersavailable)
|
||||
{
|
||||
RGBA_t mix_color, fog_color, final_color;
|
||||
INT32 mix;
|
||||
|
@ -205,7 +207,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, UINT32 mixcolor, UIN
|
|||
|
||||
void HWR_NoColormapLighting(FSurfaceInfo *Surface, INT32 light_level, UINT32 mixcolor, UINT32 fadecolor)
|
||||
{
|
||||
if (!cv_grshaders.value || (cv_grshaders.value && !cv_grfog.value))
|
||||
if (!cv_grshaders.value || (cv_grshaders.value && !cv_grfog.value) || !gr_shadersavailable)
|
||||
{
|
||||
RGBA_t mix_color, fog_color, final_color;
|
||||
INT32 mix, fogmix, lightmix;
|
||||
|
@ -4947,7 +4949,8 @@ void HWR_Startup(void)
|
|||
|
||||
// jimita
|
||||
HWD.pfnKillShaders();
|
||||
HWD.pfnLoadShaders();
|
||||
if (!HWD.pfnLoadShaders())
|
||||
gr_shadersavailable = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -796,7 +796,7 @@ EXPORT void HWRAPI(LoadShaders) (void)
|
|||
GLuint gl_vertShader, gl_fragShader;
|
||||
GLint i, result;
|
||||
|
||||
if (!pglUseProgram) return;
|
||||
if (!pglUseProgram) return false;
|
||||
|
||||
gl_customvertexshaders[0] = NULL;
|
||||
gl_customfragmentshaders[0] = NULL;
|
||||
|
@ -904,6 +904,7 @@ EXPORT void HWRAPI(LoadShaders) (void)
|
|||
#undef GETUNI
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boolean fragment)
|
||||
|
|
Loading…
Reference in a new issue