From 6bf496a34a84fb14b1b3b6debfd42ba36568b879 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 4 Oct 2015 02:05:33 +0200 Subject: [PATCH] Remove support for GLSL 1.10. In practice, we haven't _actually_ supported this since we used integers in ResampleEffect (and ResampleEffect is a pretty central effect), so let's be honest with ourselves. (Also, we will soon start using arrays in some cases, which are cumbersome pre-1.30.) I don't know of any drivers that support all the other stuff we want but not GLSL 1.30 anyway; it came with OpenGL 3.0, in 2008. This actually isn't an ABI break, at least not on the C++ level. --- effect_chain.cpp | 2 +- footer.frag | 14 -------------- header.frag | 15 --------------- init.cpp | 10 ++++++---- init.h | 2 +- resample_effect.cpp | 2 +- util.cpp | 4 +--- version.h | 2 +- 8 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 footer.frag delete mode 100644 header.frag diff --git a/effect_chain.cpp b/effect_chain.cpp index 8d030c2..5c4b522 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -208,7 +208,7 @@ Effect *EffectChain::add_effect(Effect *effect, const vector &inputs) return effect; } -// GLSL pre-1.30 doesn't support token pasting. Replace PREFIX(x) with _x. +// ESSL doesn't support token pasting. Replace PREFIX(x) with _x. string replace_prefix(const string &text, const string &prefix) { string output; diff --git a/footer.frag b/footer.frag deleted file mode 100644 index c140b46..0000000 --- a/footer.frag +++ /dev/null @@ -1,14 +0,0 @@ -void main() -{ - vec4 color = INPUT(tc); -#if YCBCR_OUTPUT_PLANAR - gl_FragData[0] = color.rrra; - gl_FragData[1] = color.ggga; - gl_FragData[2] = color.bbba; -#elif YCBCR_OUTPUT_SPLIT_Y_AND_CBCR - gl_FragData[0] = color.rrra; - gl_FragData[1] = color.gbba; -#else - gl_FragColor = color; -#endif -} diff --git a/header.frag b/header.frag deleted file mode 100644 index 44ce5b4..0000000 --- a/header.frag +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef GL_ES -precision highp float; -#endif - -#ifdef GL_EXT_gpu_shader4 -// We sometimes want round(). -#extension GL_EXT_gpu_shader4 : enable -#endif - -varying vec2 tc; - -vec4 tex2D(sampler2D s, vec2 coord) -{ - return texture2D(s, coord); -} diff --git a/init.cpp b/init.cpp index f9e7f15..5b8da89 100644 --- a/init.cpp +++ b/init.cpp @@ -428,12 +428,14 @@ bool init_movit(const string& data_directory, MovitDebugLevel debug_level) } // Find out what shader model we should compile for. + // We need at least 1.30, due to use of (among others) integers. if (epoxy_is_desktop_gl()) { - if (get_glsl_version() >= 1.30) { - movit_shader_model = MOVIT_GLSL_130; - } else { - movit_shader_model = MOVIT_GLSL_110; + if (get_glsl_version() < 1.30f) { + fprintf(stderr, "Movit system requirements: Needs at least GLSL version 1.30 (has version %.1f)\n", + get_glsl_version()); + return false; } + movit_shader_model = MOVIT_GLSL_130; } else { movit_shader_model = MOVIT_ESSL_300; } diff --git a/init.h b/init.h index 3ecc29b..5cede57 100644 --- a/init.h +++ b/init.h @@ -73,7 +73,7 @@ extern bool movit_timer_queries_supported; // What shader model we are compiling for. This only affects the choice // of a few files (like header.frag); most of the shaders are the same. enum MovitShaderModel { - MOVIT_GLSL_110, + MOVIT_GLSL_110, // No longer in use, but kept until next ABI break in order not to change the enums. MOVIT_GLSL_130, MOVIT_ESSL_300 }; diff --git a/resample_effect.cpp b/resample_effect.cpp index 85c6b06..958ed25 100644 --- a/resample_effect.cpp +++ b/resample_effect.cpp @@ -453,7 +453,7 @@ SingleResamplePassEffect::SingleResamplePassEffect(ResampleEffect *parent) register_float("offset", &offset); register_float("zoom", &zoom); register_uniform_sampler2d("sample_tex", &uniform_sample_tex); - register_uniform_int("num_samples", &uniform_num_samples); // FIXME: What about GLSL pre-1.30? + register_uniform_int("num_samples", &uniform_num_samples); register_uniform_float("num_loops", &uniform_num_loops); register_uniform_float("slice_height", &uniform_slice_height); register_uniform_float("sample_x_scale", &uniform_sample_x_scale); diff --git a/util.cpp b/util.cpp index 59f1dcd..c2ac593 100644 --- a/util.cpp +++ b/util.cpp @@ -126,9 +126,7 @@ string read_file(const string &filename) string read_version_dependent_file(const string &base, const string &extension) { - if (movit_shader_model == MOVIT_GLSL_110) { - return read_file(base + "." + extension); - } else if (movit_shader_model == MOVIT_GLSL_130) { + if (movit_shader_model == MOVIT_GLSL_130) { return read_file(base + ".130." + extension); } else if (movit_shader_model == MOVIT_ESSL_300) { return read_file(base + ".300es." + extension); diff --git a/version.h b/version.h index 5a08560..782bfee 100644 --- a/version.h +++ b/version.h @@ -5,6 +5,6 @@ // changes, even within git versions. There is no specific version // documentation outside the regular changelogs, though. -#define MOVIT_VERSION 6 +#define MOVIT_VERSION 7 #endif // !defined(_MOVIT_VERSION_H) -- 2.39.2