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 for webgl reflection probes #45465

Merged
merged 1 commit into from
Jan 29, 2021
Merged

Fix for webgl reflection probes #45465

merged 1 commit into from
Jan 29, 2021

Conversation

WeaselShoppe
Copy link

@WeaselShoppe WeaselShoppe commented Jan 26, 2021

Render buffer storage was being configured with wrong format on WebGL leading to reflection probes failing.

Fix #38571

@Calinou
Copy link
Member

Calinou commented Jan 26, 2021

Thanks for opening a pull request!

If you have spare time, it might be worth checking whether this should also be fixed in GLES3 (WebGL 2.0).

@WeaselShoppe
Copy link
Author

Thanks for opening a pull request!

If you have spare time, it might be worth checking whether this should also be fixed in GLES3 (WebGL 2.0).

No problem. I will check/test reflection probes in GLES3.0/WebGL 2.0 as well. For right now I am trying to figure out what I did to make clang-format angry...

@clayjohn
Copy link
Member

clayjohn commented Jan 27, 2021

Looking into the code a little deeper, it appears that the issue is actually with a few calls to glRenderbufferStorage that are accidentally using config.depth_internalformat instead of config.depth_buffer_internalformat.

textures should use depth_internalformat while storage buffers should use depth_buffer_internalformat

@WeaselShoppe
Copy link
Author

Looking into the code a little deeper, it appears that the issue is actually with a few calls to glRenderbufferStorage that are accidentally using config.depth_internalformat instead of config.depth_buffer_internalformat.

textures should use depth_internalformat while storage buffers should use depth_buffer_internalformat

ah. this makes a lot of sense. is depth_buffer_internalformat correctly set to GL_DEPTH_COMPONENT16 when running in WebGL 1.0 context?

@clayjohn
Copy link
Member

@WeaselShoppe Yep :)

#ifdef JAVASCRIPT_ENABLED
// RenderBuffer internal format must be 16 bits in WebGL,
// but depth_texture should default to 32 always
// if the implementation doesn't support 32, it should just quietly use 16 instead
// https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/
config.depth_buffer_internalformat = GL_DEPTH_COMPONENT16;
config.depth_type = GL_UNSIGNED_INT;
#else

@WeaselShoppe
Copy link
Author

@WeaselShoppe Yep :)

#ifdef JAVASCRIPT_ENABLED
// RenderBuffer internal format must be 16 bits in WebGL,
// but depth_texture should default to 32 always
// if the implementation doesn't support 32, it should just quietly use 16 instead
// https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/
config.depth_buffer_internalformat = GL_DEPTH_COMPONENT16;
config.depth_type = GL_UNSIGNED_INT;
#else

Awesome. Should I just revise this PR by reverting back to 3.2 HEAD, and fixing the calls to glRenderbufferStorage? (after testing on my devices of course).

@clayjohn
Copy link
Member

Awesome. Should I just revise this PR by reverting back to 3.2 HEAD, and fixing the calls to glRenderbufferStorage? (after testing on my devices of course)

Yes please :)

@clayjohn
Copy link
Member

Looks good. You are going to need to squash your commits now so that it is just a single commit. How to do so is explained here https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks great now! Thank you and good job!

@WeaselShoppe
Copy link
Author

Looks great now! Thank you and good job!

No problem. Thanks for all the help/guidance!

@akien-mga akien-mga merged commit 06895e0 into godotengine:3.2 Jan 29, 2021
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@akien-mga akien-mga modified the milestones: 3.2, 3.3 Apr 20, 2021
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