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

GL_EXT_frag_depth reported missing even if enabled #1405

Closed
chrismile opened this issue Aug 27, 2019 · 3 comments · Fixed by avaer/webgl-to-opengl#7 · May be fixed by #1407
Closed

GL_EXT_frag_depth reported missing even if enabled #1405

chrismile opened this issue Aug 27, 2019 · 3 comments · Fixed by avaer/webgl-to-opengl#7 · May be fixed by #1407

Comments

@chrismile
Copy link

Describe the bug
When using gl_FragDepthEXT in a WebGL 1 context with exokit, the following error message is printed on the command line even when GL_EXT_frag_depth is enabled (unimportant parts omitted in the text below).

[
  '#extension GL_EXT_frag_depth : enable',
  'precision highp float;',
  'uniform vec3 uAmbient;',
  ...
  'gl_FragDepthEXT = (projPoint.z / projPoint.w + 1.0) / 2.0;',
  ...
]
v {
  message: 'Error compiling shader:\n0(158) : error C7531: global variable ' +
    'gl_FragDepthEXT requires "#extension GL_EXT_frag_depth : enable" ' +
    'before use\n'
}

To Reproduce
Open any web page using GL_EXT_frag_depth and gl_FragDepthEXT in exokit.

System information:

  • OS: Ubuntu 18.04

  • Exokit Version: master branch from 2019-08-27 (today)

  • Node version: v12.2.0

  • Is your Exokit downloaded or built? Built

  • GPU: NVIDIA GTX 1070

  • Driver version: 430.40

@avaer
Copy link
Member

avaer commented Aug 27, 2019

Thanks, that looks like a bug.

In Exokit WebGL1 contexts actually have WebGL2 functionality so you should have gl_fragDepth regardless (without the EXT).

However, to fix this for WebGL1 compatibility, I think it might be sufficient to not slice out the extension pragma here: https://github.com/modulesio/webgl-to-opengl/blob/e1db71cddfd7b3023b89bee5dae54502fb35e4c8/index.js#L15

(webgl-to-opengl) should be in node_modules. Does deleting that filter help the WebGL1 case?

@chrismile
Copy link
Author

Yes, that fixes the problem. Thanks! Maybe you can also include the fix upstream in webgl-to-opengl then. I'll close this issue.

@avaer
Copy link
Member

avaer commented Aug 27, 2019

Yup, will PR that. Thanks for testing!

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