Skip to content

Commit

Permalink
GLES: Specify glsl version precisely in depal.
Browse files Browse the repository at this point in the history
Should prevent more of hrydgard#11588 on vertex shaders, and may help Apple
devices some too.
  • Loading branch information
unknownbrackets committed Dec 24, 2018
1 parent 2dbdd73 commit e46701d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GPU/Common/DepalettizeShaderCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 3 additions & 2 deletions GPU/GLES/DepalettizeShaderGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ext/native/gfx_es2/gpu_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e46701d

Please sign in to comment.