diff --git a/src/libprojectM/Renderer/StaticGlShaders.h b/src/libprojectM/Renderer/StaticGlShaders.h index 8500dce8a..457d83e8d 100644 --- a/src/libprojectM/Renderer/StaticGlShaders.h +++ b/src/libprojectM/Renderer/StaticGlShaders.h @@ -16,7 +16,6 @@ class StaticGlShaders { static std::shared_ptr instance( new StaticGlShaders(use_gles)); - return instance; } @@ -44,15 +43,18 @@ class StaticGlShaders { int major, minor; }; - // Constructs a StaticGlShaders, overriding the version to GLES3 if - // `use_gles` is true. - StaticGlShaders(bool use_gles); - // Queries the system GLSL version using // `glGetString(GL_SHADING_LANGUAGE_VERSION)` and returns the major and // minor numbers. GlslVersion QueryGlslVersion(); + // Constructs a StaticGlShaders, overriding the version to GLES3 if + // `use_gles` is true. + // Note - this happens after GlslVersion is called, because it uses the + // version to determine things. + StaticGlShaders(bool use_gles); + + // Prepends a string of the form "#version \n" to the provided // shader text, where is derived from the queried GLSL version (or // overridden when the manager was constructed with `use_gles` = true). diff --git a/src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp b/src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp old mode 100755 new mode 100644 index 3e6b3e3bc..1bcd3317b --- a/src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp +++ b/src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp @@ -114,7 +114,12 @@ GLSLGenerator::GLSLGenerator() : m_tree = NULL; m_entryName = NULL; m_target = Target_VertexShader; +#ifdef USE_GLES + m_version = Version_300_ES; +#else m_version = Version_330; +#endif + m_versionLegacy = false; m_inAttribPrefix = NULL; m_outAttribPrefix = NULL; @@ -233,7 +238,7 @@ bool GLSLGenerator::Generate(HLSLTree* tree, Target target, Version version, con m_writer.WriteLine(0, "precision highp float;"); } else if (m_version == Version_300_ES) - { + { m_writer.WriteLine(0, "#version 300 es"); m_writer.WriteLine(0, "precision highp float;"); m_writer.WriteLine(0, "precision highp sampler3D;");