mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-06 15:35:04 +00:00
This work fixes a problem where GL 3.30 was being chosen for (#493)
GLES 2.0 mode. GLES needs Version 3.00 ES. This was done by switching the order of how a StaticGl Shader is constructed, And there is additional code that properly sets up the GLSLGenerator for GLES mode.
This commit is contained in:
@ -16,7 +16,6 @@ class StaticGlShaders {
|
||||
|
||||
static std::shared_ptr<StaticGlShaders> 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 <number>\n" to the provided
|
||||
// shader text, where <number> is derived from the queried GLSL version (or
|
||||
// overridden when the manager was constructed with `use_gles` = true).
|
||||
|
||||
7
src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp
Executable file → Normal file
7
src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp
Executable file → Normal file
@ -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;");
|
||||
|
||||
Reference in New Issue
Block a user