]> git.sesse.net Git - movit/blobdiff - util.cpp
Add support for multiple shader models.
[movit] / util.cpp
index cce3d54a09492956b828cd65c092d15650fab033..01787f013e0a4c70817be2ccf49743cddb7bd254 100644 (file)
--- 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);