Fix GPU particles transform feedback error for WebGL 2 #56465
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For
3.x
. Not relevant formaster
.When exporting HTML5 projects with GLES3 (WebGL2), GPU particles do not work (Edge 96.0, Chrome 96.0, Firefox 95.0.2, all on Windows 10).
In Chrome, this results in the following error:
This is easily fixed by unbinding GL_ARRAY_BUFFER before binding the particle buffer to GL_TRANSFORM_FEEDBACK_BUFFER.
This error occurs because the particle buffer was bound to GL_ARRAY_BUFFER for the draw call and was never unbound. This is defined in the WebGL2 spec, which breaks compatibility with the OpenGL3 spec by replacing "undefined behavior" with an error. (No undefined behavior would have actually occurred, because the array buffer is not used.)
Related: #28573, #14428 (comment)