-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Add check for float texture linear filtering support #102089
Conversation
Did you try RGBH/RH instead? Using RGB8/R8 means we lose all HDR data and have much lower precision, which can be problematic for some use cases. |
5f06cc4
to
7fb5459
Compare
@Calinou Fixed! And it works! And I greatly simplified the code, didn't know that |
c6f1fca
to
5998986
Compare
Is this an iOS specific problem? AFAIK RGB32F textures should be supported by all WebGL implementations edit: Just double checked, RGB32F is supported by WebGL 2.0 https://registry.khronos.org/webgl/specs/latest/2.0/. Therefore I suspect this is more a problem of safari on iOS not being compliant with WebGL 2 OOOOhhhh, According to https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D the floating point formats are supported, but may not be texture filterable! Could you test on iOS with the linear filtering disabled? Edit: and that's confirmed by the OpenGL ES 3.0 spec https://registry.khronos.org/OpenGL/specs/es/3.0/es_spec_3.0.pdf Okay, so, ideally what we would do is check if an implementation supports using the linear filter with a given texture, then convert the texture automatically. This is how we handle compressed textures: godot/drivers/gles3/storage/texture_storage.cpp Lines 462 to 471 in 6dc78c8
And here is what we did in 3.6 for GLES2 where float textures are only supported with an extension: godot/drivers/gles2/rasterizer_storage_gles2.cpp Lines 258 to 271 in d47e265
|
I found the missing piece! We need to check if the It is basically supported everywhere except iOS: https://caniuse.com/?search=OES_texture_float_linear edit: Aaaaaaannd looks like we handled this correctly in 3.x godot/drivers/gles3/rasterizer_storage_gles3.cpp Line 8190 in d47e265
So, to summarize. We need to add This: godot/drivers/gles3/storage/texture_storage.cpp Lines 401 to 405 in 6dc78c8
Becomes:
|
5998986
to
1b7afcf
Compare
@clayjohn It works! |
1b7afcf
to
7033606
Compare
7033606
to
0bcb79d
Compare
Co-authored-by: Clay John <claynjohn@gmail.com>
0bcb79d
to
6091317
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! This might even fix a few other iOS issues
r_gl_format = GL_RED; | ||
r_gl_type = GL_FLOAT; | ||
} else { | ||
ERR_PRINT("R32 float texture not supported, converting to R16."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERR_PRINT()
might be a bit spammy in projects using lots of CurveTextures, so maybe we should use WARN_PRINT_ONCE()
instead. The condition can't change at runtime anyway – if float textures aren't supported when the project starts, they won't be supported afterwards in the same session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can change this in a followup PR if it ends up being too intrusive
Thanks! |
This PR makes it so that, on the web platform, the curve texture is rendered using anint-half-float-based image format instead of a float based one.Thanks to @clayjohn #102089 (comment), this PR now adds a check for float texture linear filtering support.
Fixes #102088