Skip to content

Commit

Permalink
Merge pull request #11308 from CesiumGS/standard-derivatives
Browse files Browse the repository at this point in the history
Fix misleading warnings for OES_standard_derivatives
  • Loading branch information
lilleyse authored May 24, 2023
2 parents 2cbe296 + 95c5e60 commit 8da0967
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 28 deletions.
3 changes: 3 additions & 0 deletions packages/engine/Source/Renderer/demodernizeShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ function demodernizeShader(input, isFragmentShader) {
// Replace gl_FragDepth with gl_FragDepthEXT.
output = output.replaceAll(/gl_FragDepth/g, `gl_FragDepthEXT`);
}

// Enable the OES_standard_derivatives extension
output = `#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n${output}`;
} else {
// Replace the in with attribute.
output = output.replaceAll(/(in)\s+(vec\d|mat\d|float)/g, `attribute $2`);
Expand Down
3 changes: 0 additions & 3 deletions packages/engine/Source/Scene/Cesium3DTileBatchTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,6 @@ function getLogDepthPolygonOffsetFragmentShaderProgram(context, shaderProgram) {
fs.defines = defined(fs.defines) ? fs.defines.slice(0) : [];
fs.defines.push("POLYGON_OFFSET");

fs.sources.unshift(
"#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"
);
shader = context.shaderCache.createDerivedShaderProgram(
shaderProgram,
"zBackfaceLogDepth",
Expand Down
4 changes: 0 additions & 4 deletions packages/engine/Source/Shaders/BillboardCollectionFS.glsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif

uniform sampler2D u_atlas;

#ifdef VECTOR_TILE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ in float v_depthFromNearPlusOne;

#ifdef POLYGON_OFFSET
uniform vec2 u_polygonOffset;
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
#endif

#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif

uniform vec4 color;
uniform float spacing;
uniform float width;
Expand Down
4 changes: 0 additions & 4 deletions packages/engine/Source/Shaders/Materials/GridMaterial.glsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif

uniform vec4 color;
uniform float cellAlpha;
uniform vec2 lineCount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif

uniform vec4 color;

float getPointOnLine(vec2 p0, vec2 p1, float x)
Expand Down
6 changes: 0 additions & 6 deletions packages/engine/Source/Shaders/Model/ModelFS.glsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
#endif

czm_modelMaterial defaultModelMaterial()
{
czm_modelMaterial material;
Expand Down

0 comments on commit 8da0967

Please sign in to comment.