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

Fix misleading warnings for OES_standard_derivatives #11308

Merged
merged 1 commit into from
May 24, 2023

Conversation

jjhembd
Copy link
Contributor

@jjhembd jjhembd commented May 24, 2023

When a Custom Shader fails to compile, the error message begins with an irrelevant warning:

image

The OES_standard_derivatives extension is only available in WebGL1 contexts. In a WebGL2 context, the derivatives functionality is available by default. However, several of our fragment shaders (written in ES300) still enabled this extension conditionally:

#ifdef GL_OES_standard_derivatives
    #extension GL_OES_standard_derivatives : enable
#endif

The middle line was then moved to the top of the file in ShaderSource without the #ifdef block, resulting in a warning on WebGL2 contexts.

This PR simplifies our handling of the OES_standard_derivatives extension. Since it is very commonly used, but only needed in WebGL1, I removed all the code to enable the extension in individual shaders. I then always enable the extension (if available) in demodernizeShader.

The above error message now becomes:

image

which better emphasizes the relevant error.

The errors can be reproduced with this local Sandcastle

@cesium-concierge
Copy link

Thanks for the pull request @jjhembd!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@lilleyse
Copy link
Contributor

@jjhembd thanks, the approach here makes sense. I confirmed that the warning no longer shows up and that sandcastle examples using standard derivatives still work in WebGL 1 and 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants