Skip to content

Commit

Permalink
Merge pull request #9060 from CesiumGS/highpClippingPlaneTex
Browse files Browse the repository at this point in the history
Specify highp sampler2D for clipping plane textures to improve reliability on some devices
  • Loading branch information
lilleyse authored Jul 24, 2020
2 parents 43571ba + 5589bc3 commit 67a36c7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Fixed `translucencyByDistance` for label outline color [#9003](https://github.com/CesiumGS/cesium/pull/9003)
- Fixed return value for `SampledPositionProperty.removeSample` [#9017](https://github.com/CesiumGS/cesium/pull/9017)
- Fixed issue where wall doesn't have correct texture coordinates when there are duplicate positions input [#9042](https://github.com/CesiumGS/cesium/issues/9042)
- Fixed an issue where clipping planes would not clip at the correct distances on some Android devices, most commonly reproducible on devices with `Mali` GPUs that do not support float textures via WebGL [#9023](https://github.com/CesiumGS/cesium/issues/9023)

### 1.71 - 2020-07-01

Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -4797,7 +4797,7 @@ function modifyShaderForClippingPlanes(
shader = ShaderSource.replaceMain(shader, "gltf_clip_main");
shader += Model._getClippingFunction(clippingPlaneCollection, context) + "\n";
shader +=
"uniform sampler2D gltf_clippingPlanes; \n" +
"uniform highp sampler2D gltf_clippingPlanes; \n" +
"uniform mat4 gltf_clippingPlanesMatrix; \n" +
"uniform vec4 gltf_clippingPlanesEdgeStyle; \n" +
"void main() \n" +
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PointCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ function createShaders(pointCloud, frameState, style) {

if (hasClippedContent) {
fs +=
"uniform sampler2D u_clippingPlanes; \n" +
"uniform highp sampler2D u_clippingPlanes; \n" +
"uniform mat4 u_clippingPlanesMatrix; \n" +
"uniform vec4 u_clippingPlanesEdgeStyle; \n";
fs += "\n";
Expand Down
4 changes: 2 additions & 2 deletions Source/Scene/getClippingFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function getClippingPlaneFloat(width, height) {
}

var functionString =
"vec4 getClippingPlane(sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n" +
"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n" +
"{\n" +
" int pixY = clippingPlaneNumber / " +
width +
Expand Down Expand Up @@ -148,7 +148,7 @@ function getClippingPlaneUint8(width, height) {
}

var functionString =
"vec4 getClippingPlane(sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n" +
"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n" +
"{\n" +
" int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n" + // clipping planes are two pixels each
" int pixY = clippingPlaneStartIndex / " +
Expand Down
2 changes: 1 addition & 1 deletion Source/Shaders/GlobeFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ uniform vec2 u_nightFadeDistance;
#endif

#ifdef ENABLE_CLIPPING_PLANES
uniform sampler2D u_clippingPlanes;
uniform highp sampler2D u_clippingPlanes;
uniform mat4 u_clippingPlanesMatrix;
uniform vec4 u_clippingPlanesEdgeStyle;
#endif
Expand Down

0 comments on commit 67a36c7

Please sign in to comment.