Skip to content

Commit 9bd4fb3

Browse files
committed
Lift up FXAA shader GLSL version check to opengl_post_load_shader(), out of the GLSL shader compiler preprocessor stage.
1 parent 49b5d9a commit 9bd4fb3

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

code/globalincs/def_files.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,14 +1904,6 @@ char* Default_fxaa_fragment_shader =
19041904
"#extension GL_EXT_gpu_shader4 : enable\n"
19051905
"#define FXAA_EARLY_EXIT 1\n"
19061906
"#define FXAA_DISCARD 1\n"
1907-
"#if __VERSION__ == 120\n"
1908-
" #define FXAA_GLSL_120 1\n"
1909-
" #define FXAA_GLSL_130 0\n"
1910-
"#endif\n"
1911-
"#if __VERSION__ > 120\n"
1912-
" #define FXAA_GLSL_120 0\n"
1913-
" #define FXAA_GLSL_130 1\n"
1914-
"#endif\n"
19151907
"#ifndef FXAA_FAST_PIXEL_OFFSET\n"
19161908
" #ifdef GL_EXT_gpu_shader4\n"
19171909
" #define FXAA_FAST_PIXEL_OFFSET 1\n"

code/graphics/gropenglpostprocessing.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,18 @@ void opengl_post_load_shader(SCP_string &sflags, shader_type shader_t, int flags
693693
sprintf(temp, "#define SAMPLE_NUM %d\n", ls_samplenum);
694694
sflags += temp;
695695
} else if ( shader_t == SDR_TYPE_POST_PROCESS_FXAA ) {
696+
/* GLSL version < 120 are guarded against reaching this code
697+
path via testing is_minimum_GLSL_version().
698+
Accordingly do not test for them again here. */
699+
if (GLSL_version == 120) {
700+
sflags += "#define FXAA_GLSL_120 1\n";
701+
sflags += "#define FXAA_GLSL_130 0\n";
702+
}
703+
if (GLSL_version > 120) {
704+
sflags += "#define FXAA_GLSL_120 0\n";
705+
sflags += "#define FXAA_GLSL_130 1\n";
706+
}
707+
696708
switch (Cmdline_fxaa_preset) {
697709
case 0:
698710
sflags += "#define FXAA_QUALITY_PRESET 10\n";

0 commit comments

Comments
 (0)