Skip to content

Commit

Permalink
move automatic OES_standard_derivatives enabling behind LEGACY_GL_EMU…
Browse files Browse the repository at this point in the history
…LATION define
  • Loading branch information
inolen committed Feb 2, 2014
1 parent 2aa3348 commit 62ca84a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/library_gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ var LibraryGL = {
}
},

#if LEGACY_GL_EMULATION
// Find a token in a shader source string
findToken: function(source, token) {
function isIdentChar(ch) {
Expand Down Expand Up @@ -238,6 +239,7 @@ var LibraryGL = {
} while (true);
return false;
},
#endif

getSource: function(shader, count, string, length) {
var source = '';
Expand All @@ -255,6 +257,7 @@ var LibraryGL = {
}
source += frag;
}
#if LEGACY_GL_EMULATION
// Let's see if we need to enable the standard derivatives extension
type = GLctx.getShaderParameter(GL.shaders[shader], 0x8B4F /* GL_SHADER_TYPE */);
if (type == 0x8B30 /* GL_FRAGMENT_SHADER */) {
Expand All @@ -270,6 +273,7 @@ var LibraryGL = {
#endif
}
}
#endif
return source;
},

Expand Down
1 change: 1 addition & 0 deletions tests/hello_world_gles_deriv.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ static const char vertex_shader[] =

static const char fragment_shader[] =
"#ifdef GL_ES\n"
"#extension GL_OES_standard_derivatives : enable\n"
"precision mediump float;\n"
"#endif\n"
"varying vec4 Color;\n"
Expand Down

0 comments on commit 62ca84a

Please sign in to comment.