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 GPU particles transform feedback error for WebGL 2 #56465

Conversation

brianwinterpixel
Copy link
Contributor

For 3.x. Not relevant for master.

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:

[.WebGL-000024741487CD00] GL_INVALID_OPERATION: A transform feedback buffer that would be written to is also bound to a non-transform-feedback target, which would cause undefined behavior.

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)

@brianwinterpixel brianwinterpixel requested a review from a team as a code owner January 3, 2022 18:22
@Calinou Calinou added this to the 3.5 milestone Jan 3, 2022
@akien-mga akien-mga merged commit 888779a into godotengine:3.x Jan 3, 2022
@akien-mga
Copy link
Member

Thanks!

@brianwinterpixel brianwinterpixel deleted the fix-webgl2-transform-feedback-bug branch January 3, 2022 23:14
@akien-mga
Copy link
Member

Cherry-picked for 3.4.3.

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.

4 participants