GLES: Specify glsl version precisely in depal.

Should prevent more of #11588 on vertex shaders, and may help Apple
devices some too.
This commit is contained in:
Unknown W. Brackets 2018-12-23 20:08:08 -08:00
parent 2dbdd73e5f
commit e46701dee6
3 changed files with 5 additions and 4 deletions

View File

@ -51,7 +51,7 @@ void GenerateDepalShader300(char *buffer, GEBufferFormat pixelFormat, ShaderLang
WRITE(p, "precision mediump float;\n");
WRITE(p, "precision highp int;\n");
} else {
WRITE(p, "#version 330\n");
WRITE(p, "#version %d\n", gl_extensions.GLSLVersion());
}
WRITE(p, "in vec2 v_texcoord0;\n");
WRITE(p, "out vec4 fragColor0;\n");

View File

@ -75,8 +75,9 @@ bool DepalShaderCacheGLES::CreateVertexShader() {
std::string prelude;
if (gl_extensions.IsGLES) {
prelude = useGL3_ ? "#version 300 es\n" : "#version 100\n";
} else if (useGL3_) {
prelude = "#version 330\n";
} else {
// We need to add a corresponding #version. Apple drivers fail without an exact match.
prelude = StringFromFormat("#version %d\n", gl_extensions.GLSLVersion());
}
vertexShader_ = render_->CreateShader(GL_VERTEX_SHADER, prelude + src, "depal");
return true;

View File

@ -579,7 +579,7 @@ std::string ApplyGLSLPrelude(const std::string &source, uint32_t stage) {
std::string temp;
std::string version = "";
if (!gl_extensions.IsGLES && gl_extensions.IsCoreContext) {
// We need to add a corresponding #version. Apple drives fail without an exact match.
// We need to add a corresponding #version. Apple drivers fail without an exact match.
version = StringFromFormat("#version %d\n", gl_extensions.GLSLVersion());
}
if (stage == GL_FRAGMENT_SHADER) {