Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for IE model + clipping planes shader bug #6584

Merged
merged 2 commits into from
May 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Change Log
* Fixed incorrect 3D Tiles statistics when a tile fails during processing. [#6558](https://github.com/AnalyticalGraphicsInc/cesium/pull/6558)
* Fixed race condition causing intermittent crash when changing geometry show value [#3061](https://github.com/AnalyticalGraphicsInc/cesium/issues/3061)
* `ProviderViewModel`s with no category are displayed in an untitled group in `BaseLayerPicker` instead of being labeled as `'Other'` [#6574](https://github.com/AnalyticalGraphicsInc/cesium/pull/6574)
* Added a workaround for clipping planes causing a picking shader compilation failure for gltf models and 3D Tilesets in Internet Explorer [#6575](https://github.com/AnalyticalGraphicsInc/cesium/issues/6575)

### 1.45 - 2018-05-01

Expand Down
33 changes: 23 additions & 10 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1995,10 +1995,16 @@ define([
var drawVS = modifyShader(vs, id, model._vertexShaderLoaded);
var drawFS = modifyShader(fs, id, model._fragmentShaderLoaded);

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
// Internet Explorer seems to have problems with discard (for clipping planes) after too many levels of indirection:
// https://github.com/AnalyticalGraphicsInc/cesium/issues/6575.
// For IE log depth code is defined out anyway due to unsupported WebGL extensions, so the wrappers can be omitted.
if (!FeatureDetection.isInternetExplorer()) {
drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
}

var pickFS, pickVS;
var pickFS;
var pickVS;
if (model.allowPicking) {
// PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181
pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded);
Expand All @@ -2008,8 +2014,10 @@ define([
pickFS = ShaderSource.createPickFragmentShaderSource(fs, 'uniform');
}

pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
if (!FeatureDetection.isInternetExplorer()) {
pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
}
}
createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context);
}
Expand Down Expand Up @@ -2041,10 +2049,13 @@ define([
var drawVS = modifyShader(vs, id, model._vertexShaderLoaded);
var drawFS = modifyShader(finalFS, id, model._fragmentShaderLoaded);

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
if (!FeatureDetection.isInternetExplorer()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
}

var pickFS, pickVS;
var pickFS;
var pickVS;
if (model.allowPicking) {
// PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181
pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded);
Expand All @@ -2058,8 +2069,10 @@ define([
pickFS = modifyShaderForClippingPlanes(pickFS, clippingPlaneCollection);
}

pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
if (!FeatureDetection.isInternetExplorer()) {
pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
}
}
createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context);
}
Expand Down