Skip to content
Browse files

Add settings / UI support for shaders without tex_env_crossbar (added…

… in 64a3cc1).
  • Loading branch information...
1 parent 64a3cc1 commit 7e3be754d4daddd771de1e115ed6845652300638 @Safety0ff Safety0ff committed Jun 26, 2012
Showing with 40 additions and 6 deletions.
  1. +15 −1 lib/ivis_opengl/piestate.cpp
  2. +2 −0 lib/ivis_opengl/piestate.h
  3. +2 −0 lib/ivis_opengl/screen.cpp
  4. +4 −2 src/frontend.cpp
  5. +14 −1 src/main.cpp
  6. +3 −2 src/warzoneconfig.h
View
16 lib/ivis_opengl/piestate.cpp
@@ -38,6 +38,7 @@
static bool shadersAvailable = false;
static bool shaderUsage = false;
+static bool fallbackAvailable = true;
static GLuint shaderProgram[SHADER_MAX];
static GLfloat shaderStretch = 0;
static GLint locTeam, locStretch, locTCMask, locFog, locNormalMap, locEcm, locTime;
@@ -140,14 +141,27 @@ void pie_SetShaderAvailability(bool availability)
shadersAvailable = availability;
}
+bool pie_GetFallbackAvailability(void)
+{
+ return fallbackAvailable;
+}
+
+void pie_SetFallbackAvailability(bool availability)
+{
+ fallbackAvailable = availability;
+}
+
bool pie_GetShaderUsage(void)
{
return shaderUsage;
}
void pie_SetShaderUsage(bool usage)
{
- shaderUsage = pie_GetShaderAvailability() && usage;
+ bool valid = !usage && pie_GetFallbackAvailability();
+ valid = valid || (usage && pie_GetShaderAvailability());
+ if (valid)
+ shaderUsage = usage;
}
// Read shader into text buffer
View
2 lib/ivis_opengl/piestate.h
@@ -85,6 +85,8 @@ extern void pie_SetRendMode(REND_MODE rendMode);
// Shaders control center
extern bool pie_GetShaderAvailability(void);
extern void pie_SetShaderAvailability(bool);
+extern bool pie_GetFallbackAvailability(void);
+extern void pie_SetFallbackAvailability(bool);
extern bool pie_GetShaderUsage(void);
extern void pie_SetShaderUsage(bool);
View
2 lib/ivis_opengl/screen.cpp
@@ -171,6 +171,8 @@ bool screenInitialise()
bool canRunFallback = GLEW_VERSION_1_2 && haveARB_vertex_buffer_object && haveARB_texture_env_crossbar;
bool canRunShaders = GLEW_VERSION_1_2 && haveARB_vertex_buffer_object && glslVersion >= std::make_pair(1, 20); // glGetString(GL_SHADING_LANGUAGE_VERSION) >= "1.20"
+ pie_SetFallbackAvailability(canRunFallback);
+
if (canRunShaders)
{
screen_EnableMissingFunctions(); // We need to do this before pie_LoadShaders(), but the effect of this call will be undone later by iV_TextInit(), so we will need to call it again.
View
6 src/frontend.cpp
@@ -887,7 +887,7 @@ static bool startVideoOptionsMenu(void)
// Shaders
addTextButton(FRONTEND_SHADERS, FRONTEND_POS6X-35, FRONTEND_POS7Y, _("Shaders"), 0);
- if (war_GetShaders() == SHADERS_ON)
+ if (war_GetShaders() == SHADERS_ON || war_GetShaders() == SHADERS_ONLY)
{
addTextButton(FRONTEND_SHADERS_R, FRONTEND_POS6M-55, FRONTEND_POS7Y, _("On"), 0);
}
@@ -1063,16 +1063,18 @@ bool runVideoOptionsMenu(void)
{
case SHADERS_ON:
war_SetShaders(SHADERS_OFF);
+ pie_SetShaderUsage(false);
widgSetString(psWScreen, FRONTEND_SHADERS_R, _("Off"));
break;
case SHADERS_OFF:
war_SetShaders(SHADERS_ON);
+ pie_SetShaderUsage(true);
widgSetString(psWScreen, FRONTEND_SHADERS_R, _("On"));
break;
case FALLBACK:
+ case SHADERS_ONLY:
break;
}
- pie_SetShaderUsage(war_GetShaders()==SHADERS_ON);
break;
}
View
15 src/main.cpp
@@ -1251,13 +1251,26 @@ int realmain(int argc, char *argv[])
war_SetWidth(pie_GetVideoBufferWidth());
war_SetHeight(pie_GetVideoBufferHeight());
+ // Fix up settings from the config file
if (!pie_GetShaderAvailability())
{
war_SetShaders(FALLBACK);
}
else
{
- pie_SetShaderUsage(war_GetShaders()==SHADERS_ON);
+ if (war_GetShaders() == FALLBACK)
+ {
+ war_SetShaders(SHADERS_OFF);
+ }
+ if (!pie_GetFallbackAvailability())
+ {
+ war_SetShaders(SHADERS_ONLY);
+ pie_SetShaderUsage(true);
+ }
+ else if (war_GetShaders() == SHADERS_ONLY)
+ {
+ war_SetShaders(SHADERS_ON);
+ }
}
pie_SetFogStatus(false);
View
5 src/warzoneconfig.h
@@ -52,8 +52,9 @@ enum FSAA_LEVEL
enum RENDER_MODE
{
FALLBACK, /// Shaders not supported
- SHADERS_OFF,/// Shaders supported but off
- SHADERS_ON, /// Shaders supported and on
+ SHADERS_OFF,/// Shaders supported but off (fallback supported)
+ SHADERS_ON, /// Shaders supported and on (fallback supported)
+ SHADERS_ONLY/// Shaders but no fallback support
};
/***************************************************************************/
/*

0 comments on commit 7e3be75

Please sign in to comment.
Something went wrong with that request. Please try again.