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

Unbind the framebuffer when updating meshes #79772

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

Malcolmnixon
Copy link
Contributor

Skeleton-driven meshes are rendered corrupted (missing, frozen, exploded, or stuttering) when running mobile XR games using the gl_compatibility renderer. Additionally users have reported streams of "Mismatch between shader number of views and FBO number of views" error messages in logcat outputs.

The cause is having an XR framebuffer with two views bound when calling the skeleton vertex shaders to deform the meshes. The skeleton shaders don't actually render to the framebuffer, but the mobile GLES drivers will still verify the shaders and framebuffer are compatible. In this case the XR framebuffer has two views (stereoscopic left and right eyes) but the shaders are not configured for two views and so GLES refuses to run the skeleton vertex shader.

This pull request fixes the issue #79769 by unbinding the framebuffer with a glBindFramebuffer(GL_FRAMEBUFFER, 0); at the beginning of MeshStorage::update_mesh_instances() at the same time rasterization is disabled.

While the vertex shaders used to update the meshes aren't actually rendering to the framebuffer, they may still refuse to run with some framebuffers bound - such as XR with multiple views.
Copy link
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue has been bugging us for ages, such a simple fix for such an annoying problem :)

@RedworkDE RedworkDE linked an issue Jul 22, 2023 that may be closed by this pull request
@YuriSizov YuriSizov changed the title Unbind the framebuffer when updating meshes. Unbind the framebuffer when updating meshes Jul 24, 2023
@YuriSizov YuriSizov merged commit b1f4e58 into godotengine:master Jul 24, 2023
@YuriSizov
Copy link
Contributor

Thanks!

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.2.

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.

Skeleton meshes not updating in XR modes under gl_compatibility
4 participants