OpenGL: early exit from functions that don't mix with core profile

These parts will not be part of final viewport, but are called indirectly during the transition. To avoid runtime errors on core profile, exit early -- functions effectively do nothing.

I put the early exits inside the functions to avoid cluttering the code that calls these. But (long term) the calling functions need to change.

Basic shader's detect_options function was unused and full of old, so I deleted it.

Part of T51164
This commit is contained in:
2017-04-27 14:00:38 -04:00
parent 99fde39f49
commit 0d5c5a8438
2 changed files with 17 additions and 25 deletions

View File

@@ -190,31 +190,6 @@ static bool solid_compatible_lighting(void)
return ((directional & enabled) == enabled);
}
#if 0
static int detect_options()
{
GLint two_sided;
int options = 0;
if (glIsEnabled(GL_TEXTURE_2D))
options |= GPU_SHADER_TEXTURE_2D;
if (glIsEnabled(GL_TEXTURE_RECTANGLE))
options |= GPU_SHADER_TEXTURE_RECT;
GPU_SHADER_TEXTURE_RECT
if (glIsEnabled(GL_COLOR_MATERIAL))
options |= GPU_SHADER_USE_COLOR;
if (glIsEnabled(GL_LIGHTING))
options |= GPU_SHADER_LIGHTING;
glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE, &two_sided);
if (two_sided == GL_TRUE)
options |= GPU_SHADER_TWO_SIDED;
return options;
}
#endif
static GPUShader *gpu_basic_shader(int options)
{
/* glsl code */
@@ -332,6 +307,10 @@ void GPU_basic_shader_colors(
const float diffuse[3], const float specular[3],
int shininess, float alpha)
{
#ifdef WITH_GL_PROFILE_CORE
return;
#endif
float gl_diffuse[4], gl_specular[4];
if (diffuse)
@@ -353,6 +332,10 @@ void GPU_basic_shader_colors(
void GPU_basic_shader_light_set(int light_num, GPULightData *light)
{
#ifdef WITH_GL_PROFILE_CORE
return;
#endif
int light_bit = (1 << light_num);
/* note that light position is affected by the current modelview matrix! */
@@ -426,6 +409,10 @@ void GPU_basic_shader_light_set(int light_num, GPULightData *light)
void GPU_basic_shader_light_set_viewer(bool local)
{
#ifdef WITH_GL_PROFILE_CORE
return;
#endif
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (local) ? GL_TRUE: GL_FALSE);
}