-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
WebGPU: fix crashes in Firefox and Safari #16045
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/16045/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16045/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/16045/merge#BCU1XR#0 |
Visualization tests for WebGPU (Experimental) |
WebGL2 visualization test reporter: |
Unfortunatelly the changes in GRL has introduced an error on WebGL in Safari/Firefox/Chrome - I'm on MacOS: I tried to get WebGPU support working in Firefox by enabling the required flags, but no luck. Let me do some research. |
Ah, too bad... It could be that the offsets buffer is not yet set when calling One question I have is if offsets are always used, or if they are optional? The shader code always define the #ifdef GREASED_LINE_USE_OFFSETS
attribute vec3 grl_offsets;
#else
vec3 grl_offsets = vec3(0.);
#endif Of course, you will have to set the appropriate true/false value to |
I think we have two options:
Which is the better choice? Interestengly the PG runs w/o issues on Chrome/WebGPU. |
I think 1/ would be better, because it would not consume a vertex buffer when we don't need it. The PG runs in Chrome because they don't handle a limit condition the same way than in Firefox/Safari, but the specification allows both implementations. |
Yes, this seems to be the better option. I don't expect anyone to frequently set or unset the offsets, so there will essentially be one shader recompilation when the offsets are initially set. Changing the offsets afterward will not require shader recompilation. I'm on it... Thanks for sharing your thoughts! |
This PG crashes in Firefox / Safari because an empty vertex buffer is bound to the pipeline. The fix is simply to call
this._createOffsetsBuffer()
earlier so that the correct vertex buffer is created (cc @RolandCsibrei, to make sure it's the right fix / in the right place).This PG crashes for the same reason, but the fix is a bit more complex as we shouldn't use an attribute in a node material if the mesh using that material doesn't support the attribute. So I've added some code to declare a regular (dummy) variable with the same name as the attribute when the latter is not supported.
Note that I also added some debug code (mostly labels) to ease debugging in WebGPU.