GLES: on EGL, respect the user requesting a non-sRGB surface format (#3817)

* EGL: respect the user requesting a non-sRGB surface format
What used to happen was that sRGB was used whether you requested it or not.
This commit fixes that and now passing in a non-sRGB texture format in SurfaceConfiguration will result in a non-sRGB surface being created.

* add changelog entry about the EGL non-sRGB support change
This commit is contained in:
liquidev authored and GitHub committed 2023-06-06 19:59:00 +02:00
1 parent 2e4209c537
commit dfa5400a78
2 files changed
+12 -9

No files matched your search

+11 -9
View File
@@ -1152,15 +1152,17 @@ impl crate::Surface<super::Api> for Surface {
khronos_egl::SINGLE_BUFFER
},
];
match self.srgb_kind {
SrgbFrameBufferKind::None => {}
SrgbFrameBufferKind::Core => {
attributes.push(khronos_egl::GL_COLORSPACE);
attributes.push(khronos_egl::GL_COLORSPACE_SRGB);
}
SrgbFrameBufferKind::Khr => {
attributes.push(EGL_GL_COLORSPACE_KHR as i32);
attributes.push(EGL_GL_COLORSPACE_SRGB_KHR as i32);
if config.format.is_srgb() {
match self.srgb_kind {
SrgbFrameBufferKind::None => {}
SrgbFrameBufferKind::Core => {
attributes.push(khronos_egl::GL_COLORSPACE);
attributes.push(khronos_egl::GL_COLORSPACE_SRGB);
}
SrgbFrameBufferKind::Khr => {
attributes.push(EGL_GL_COLORSPACE_KHR as i32);
attributes.push(EGL_GL_COLORSPACE_SRGB_KHR as i32);
}
}
}
attributes.push(khronos_egl::ATTRIB_NONE as i32);