X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=util.cpp;h=01787f013e0a4c70817be2ccf49743cddb7bd254;hp=cce3d54a09492956b828cd65c092d15650fab033;hb=28bc5f37437fa8eaca523a209c558b807ced2db3;hpb=70f86335e039280a182119c3055aabeae01713bc;ds=inline diff --git a/util.cpp b/util.cpp index cce3d54..01787f0 100644 --- a/util.cpp +++ b/util.cpp @@ -96,6 +96,19 @@ string read_file(const string &filename) return string(buf, len); } +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) { + return read_file(base + ".130." + extension); + } else if (movit_shader_model == MOVIT_ESSL_300) { + return read_file(base + ".300es." + extension); + } else { + assert(false); + } +} + GLuint compile_shader(const string &shader_src, GLenum type) { GLuint obj = glCreateShader(type);