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

Handle uniform precision mismatches #2984

Merged
merged 6 commits into from
Sep 1, 2015

Conversation

lilleyse
Copy link
Contributor

For #817

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 31, 2015

Thanks @lilleyse!

Although this doesn't change the Cesium API, this is still a public-facing change that we want to include in the release notes, CHANGES.md (for more info on when to update CHANGES.md, see CONTRIBUTING.md). Add something like the following to the 1.13 section in CHANGES.md:

  • Fixed a GLSL precision issue that enables Cesium to now support Mali-400MP GPUs and other mobile GPUs where GLSL shaders did not compile. #817

If we're able to test on real hardware today, I expect we'll merge this in time for the 1.13 release tomorrow; otherwise, we'll wait for 1.14, and update CHANGES.md accordingly.

@@ -263,6 +263,9 @@ define([
ContextLimits._maximumViewportWidth = maximumViewportDimensions[0];
ContextLimits._maximumViewportHeight = maximumViewportDimensions[1];

var highp = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
Copy link
Contributor

Choose a reason for hiding this comment

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

Take a closer look at this code example. We need to account for HIGH_INT, not just HIGH_FLOAT, even though it isn't a problem yet. Let's add explicit getters for highp float and int, and then just check to see if either isn't support in ShaderProgram.

};
expect(sp.allUniforms.u_value).toBeDefined();
expect(sp.allUniforms.u_value_f).toBeDefined();
expect(renderFragment(context, sp, uniformMap)).toEqual([204, 204, 204, 204]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is most likely a fragile test, where it will pass on some systems, but not others. Can we rework the shader to be more coarse-grained, e.g., black is failing, non-black is passing.

var uniformName = uniform;
// if it's a duplicate uniform, use its original name so it is updated correctly
var duplicateUniform = shader._duplicateUniformNames[uniformName];
if (duplicateUniform) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use defined.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 31, 2015

This looks good. That may seem like a lot of comments, but they are all minor.

@lilleyse
Copy link
Contributor Author

Updated to account for the comments here.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 31, 2015

Looks good, thanks @lilleyse. This is all good with me. We'll merge once we can test on actual hardware. Have you tried asking on the forum post?

@mramato
Copy link
Contributor

mramato commented Aug 31, 2015

The Mali-400 I tried reported it was mediump/lowp and not highp/mediump, and Cesium loaded and ran (poorly and with artifacts) but there were no shader compile failures. This was both with master and this branch.

We should probably ask people on the forum to test it out and have them use webgl report to confirm precision. I've posted a temporary copy of the built Cesium Viewer at http://cesiumjs.org/mediump/index.html.

You can also use this link to load it with some data http://cesiumjs.org/mediump/index.html?source=/Cesium/Apps/SampleData/simple.czml to verify primitives work as well.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 1, 2015

This was verified on the actual hardware.

pjcozzi added a commit that referenced this pull request Sep 1, 2015
Handle uniform precision mismatches
@pjcozzi pjcozzi merged commit 29812e6 into CesiumGS:master Sep 1, 2015
@pjcozzi pjcozzi deleted the uniform-mediump branch September 1, 2015 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants