Skip to content

Commit 5d593f0

Browse files
committed
Plumb through is_minimum_GLSL_version()
1 parent a045e5d commit 5d593f0

File tree

16 files changed

+36
-43
lines changed

16 files changed

+36
-43
lines changed

code/cutscene/oggplayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static void OGG_video_init(theora_info *tinfo)
345345
opengl_set_texture_target(GL_TEXTURE_2D);
346346
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
347347

348-
if(!Use_GLSL)
348+
if(!is_minimum_GLSL_version())
349349
use_shaders = false;
350350

351351
if(use_shaders) {

code/graphics/2d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ uint gr_determine_model_shader_flags(
21472147
) {
21482148
uint shader_flags = 0;
21492149

2150-
if ( Use_GLSL > 1 ) {
2150+
if ( Use_GLSL >= 2 ) {
21512151
shader_flags |= SDR_FLAG_MODEL_CLIP;
21522152
}
21532153

code/graphics/gropengl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ bool gr_opengl_init()
20152015
GLint max_texture_units = GL_supported_texture_units;
20162016
GLint max_texture_coords = GL_supported_texture_units;
20172017

2018-
if (Use_GLSL) {
2018+
if (is_minimum_GLSL_version()) {
20192019
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_units);
20202020
}
20212021

@@ -2095,7 +2095,7 @@ bool gr_opengl_init()
20952095
mprintf(( " Post-processing enabled: %s\n", (Cmdline_postprocess) ? "YES" : "NO"));
20962096
mprintf(( " Using %s texture filter.\n", (GL_mipmap_filter) ? NOX("trilinear") : NOX("bilinear") ));
20972097

2098-
if (Use_GLSL) {
2098+
if (is_minimum_GLSL_version()) {
20992099
mprintf(( " OpenGL Shader Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION) ));
21002100
}
21012101

code/graphics/gropengldraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ void opengl_setup_scene_textures()
25462546
{
25472547
Scene_texture_initialized = 0;
25482548

2549-
if ( !Use_GLSL || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
2549+
if ( !is_minimum_GLSL_version() || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
25502550
Cmdline_postprocess = 0;
25512551
Cmdline_softparticles = 0;
25522552
Cmdline_fb_explosions = 0;

code/graphics/gropenglextension.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void opengl_extensions_init()
466466
}
467467

468468
// can't have this stuff without GLSL support
469-
if ( !Use_GLSL ) {
469+
if ( !is_minimum_GLSL_version() ) {
470470
Cmdline_normal = 0;
471471
Cmdline_height = 0;
472472
Cmdline_postprocess = 0;
@@ -480,7 +480,7 @@ void opengl_extensions_init()
480480
Cmdline_no_batching = true;
481481
}
482482

483-
if (Use_GLSL) {
483+
if (is_minimum_GLSL_version()) {
484484
GLint max_texture_units;
485485
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &max_texture_units);
486486

@@ -495,7 +495,7 @@ void opengl_extensions_init()
495495
Cmdline_height = 0;
496496
} else if (max_texture_units < 4) {
497497
mprintf(( "Not enough texture units found for GLSL support. We need at least 4, we found %d.\n", max_texture_units ));
498-
Use_GLSL = 0;
498+
GLSL_version = 0;
499499
}
500500
}
501501
}

code/graphics/gropengllight.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void FSLight2GLLight(light *FSLight, opengl_light *GLLight)
118118
GLLight->Position[2] = FSLight->vec2.xyz.z;
119119
GLLight->Position[3] = 1.0f;
120120

121-
if ( Use_GLSL > 1 ) {
121+
if ( is_minimum_GLSL_version() ) {
122122
// Valathil: When using shaders pass the beam direction (not normalized IMPORTANT for calculation of tube)
123123
vec3d a;
124124
vm_vec_sub(&a, &FSLight->vec2, &FSLight->vec);
@@ -164,7 +164,7 @@ void opengl_set_light(int light_num, opengl_light *ltp)
164164
GLfloat diffuse[4];
165165
memcpy(diffuse, ltp->Diffuse, sizeof(GLfloat) * 4);
166166

167-
if ( !Use_GLSL && (ltp->type == LT_DIRECTIONAL) && (GL_light_factor < 1.0f) ) {
167+
if ( !is_minimum_GLSL_version() && (ltp->type == LT_DIRECTIONAL) && (GL_light_factor < 1.0f) ) {
168168
// if we're not using shaders, manually adjust the diffuse light factor.
169169
diffuse[0] *= GL_light_factor;
170170
diffuse[1] *= GL_light_factor;

code/graphics/gropenglpostprocessing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ void opengl_post_process_init()
970970
return;
971971
}
972972

973-
if ( !Use_GLSL || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
973+
if ( !is_minimum_GLSL_version() || Cmdline_no_fbo || !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) ) {
974974
Cmdline_postprocess = 0;
975975
return;
976976
}

code/graphics/gropenglshader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void opengl_shader_set_current(int handle)
226226
*/
227227
int gr_opengl_maybe_create_shader(shader_type shader_t, unsigned int flags)
228228
{
229-
if (Use_GLSL < 2)
229+
if (!is_minimum_GLSL_version())
230230
return -1;
231231

232232
size_t idx;
@@ -268,7 +268,7 @@ void opengl_shader_shutdown()
268268
{
269269
size_t i;
270270

271-
if ( !Use_GLSL ) {
271+
if ( !is_minimum_GLSL_version() ) {
272272
return;
273273
}
274274

@@ -519,7 +519,7 @@ int opengl_compile_shader(shader_type sdr, uint flags)
519519
*/
520520
void opengl_shader_init()
521521
{
522-
if ( !Use_GLSL ) {
522+
if ( !is_minimum_GLSL_version() ) {
523523
return;
524524
}
525525

code/graphics/gropengltnl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void gr_opengl_set_buffer(int idx)
563563
GL_state.Array.BindElementBuffer(0);
564564
}
565565

566-
if ( (Use_GLSL > 1) && !GLSL_override ) {
566+
if ( is_minimum_GLSL_version() && !GLSL_override ) {
567567
opengl_shader_set_current();
568568
}
569569

@@ -1342,7 +1342,7 @@ void gr_opengl_render_buffer(int start, const vertex_buffer *bufferp, int texi,
13421342

13431343
const buffer_data *datap = &bufferp->tex_buf[texi];
13441344

1345-
if ( (Use_GLSL > 1) && !GLSL_override ) {
1345+
if ( is_minimum_GLSL_version() && !GLSL_override ) {
13461346
opengl_render_pipeline_program(start, bufferp, datap, flags);
13471347
} else {
13481348
opengl_render_pipeline_fixed(start, bufferp, datap, flags);
@@ -1837,7 +1837,7 @@ void gr_opengl_end_clip_plane()
18371837
return;
18381838
}
18391839

1840-
if ( Use_GLSL > 1 ) {
1840+
if ( is_minimum_GLSL_version() ) {
18411841
return;
18421842
}
18431843

@@ -1850,7 +1850,7 @@ void gr_opengl_start_clip_plane()
18501850
return;
18511851
}
18521852

1853-
if ( Use_GLSL > 1 ) {
1853+
if ( is_minimum_GLSL_version() ) {
18541854
// bail since we're gonna clip in the shader
18551855
return;
18561856
}

code/lab/lab.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,8 +1907,6 @@ void labviewer_close_render_options_window(GUIObject *caller)
19071907
y += cbp->GetHeight() + 1; \
19081908
}
19091909

1910-
extern int Use_GLSL;
1911-
19121910
void labviewer_make_render_options_window(Button *caller)
19131911
{
19141912
Checkbox *cbp;
@@ -1930,7 +1928,7 @@ void labviewer_make_render_options_window(Button *caller)
19301928
ADD_RENDER_FLAG("Show Insignia", Lab_viewer_flags, LAB_FLAG_SHOW_INSIGNIA);
19311929
ADD_RENDER_FLAG("Show Damage Lightning", Lab_viewer_flags, LAB_FLAG_LIGHTNING_ARCS);
19321930
ADD_RENDER_FLAG("Rotate Subsystems", Lab_viewer_flags, LAB_FLAG_SUBMODEL_ROTATE);
1933-
if (Use_GLSL) {
1931+
if (is_minimum_GLSL_version()) {
19341932
ADD_RENDER_BOOL("Fixed Render Pipeline", GLSL_override);
19351933
if (Cmdline_postprocess) {
19361934
ADD_RENDER_BOOL("Hide Post Processing", PostProcessing_override);

0 commit comments

Comments
 (0)