-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Emscripten should not set a precision on vertex shaders #8627
Comments
For OpenGL ES you must specify a default precision for float variables in shaders, and will get compilation errors without it unless all variables have an explicit precision applied. Edit although sounds like WebGL doesn't, so perhaps for WebGL this can just be removed for vertex shaders. The problem is not so much the presence of a default, it's just that The default selected should be based on shader type - use a |
This NOT true. Only fragment shaders need a default. Vertex shaders do not!!! From the spec section 4.5.3
And there are webgl conformance tests that you do NOT need a declaration in the vertex shader but do in the fragment shader. The conformance tests that you don't need one in the vertex shader are implicit because the majority of the tests that use vertex shaders don't declare a precision since none is needed. I know because I wrote most of the tests but you can look at them yourself. example |
Heh, worked with it for years, and never noticed that one =) Thanks for the correction. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
this line
emscripten/src/library_glemu.js
Line 366 in 49d9559
is adding
to any vertex shader that doesn't have a precision set. While fragment shaders need a precision specified vertex shaders do not in WebGL and they default to
highp
. Setting them tomediump
is breaking content on mobile for no reasonthe solution is to delete that line.
While we're on the topic there is similar code for fragment shaders. I'd argue that code should default to
highp
. Why ... because lots of lighting code breaks (using world positions for lights etc) when in mediump. I get that it's probably set to mediump because some old phones don't support highp in fragment shaders but I suspect that's a pretty low percentage in 2019?In any case, the vertex shader side should have that check removed.
The text was updated successfully, but these errors were encountered: