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

egui_glow: default to RGBA8 if sRGB not supported #2007

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/egui_glow/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
};
Expand Down
1 change: 1 addition & 0 deletions crates/egui_glow/src/vao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down