egui_glow: default to RGBA8 if sRGB not supported (#2007)

The Vivante GPU on many STM32MP1 based boards does not support sRGB
as an internal format.

Introduce a check for sRGB support and default to `RGBA8` internal format
if not supported.

Additionally the STM32MP1 needs to be checked for `GL_ARB_vertex_array_object`

Closes #1991
This commit is contained in:
Luke Jones 2022-09-06 20:07:49 +12:00 committed by GitHub
parent 1d5f20b46c
commit 7fae634dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -117,6 +117,7 @@ impl Painter {
let header = shader_version.version_declaration();
tracing::debug!("Shader header: {:?}.", header);
let srgb_support = gl.supported_extensions().contains("EXT_sRGB");
tracing::debug!("SRGB Support: {:?}.", srgb_support);
let (post_process, srgb_support_define) = match (shader_version, srgb_support) {
// WebGL2 support sRGB default
@ -591,6 +592,8 @@ impl Painter {
glow::RGBA
};
(format, format)
} else if !self.srgb_support {
(glow::RGBA8, glow::RGBA)
} else {
(glow::SRGB8_ALPHA8, glow::RGBA)
};

View file

@ -147,6 +147,7 @@ fn supports_vao(gl: &glow::Context) -> bool {
let supported_extensions = gl.supported_extensions();
tracing::debug!("Supported OpenGL extensions: {:?}", supported_extensions);
supported_extensions.contains("ARB_vertex_array_object")
|| supported_extensions.contains("GL_ARB_vertex_array_object")
} else {
true
}