-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
sRGB findings on various platforms #1652
Comments
SRGB setting in EGL is mostly when you're dealing with GLES context and not OpenGL from what I understand, because you can't manipulate with attachment function in OpenGL.
It should have it with gles context.. I'm not that familiar with real OpenGL use. |
Should be available on both afaik: https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_gl_colorspace.txt
Oh no, more variables; maybe I should retest this all again and put the results in a big table that's a bit more clear. More on that later. Replying to the rest of your sRGB comments from #1653 (comment) here:
Do you imply from As outlined in this issue that sRGB blending/conversion seems to be applied to non-sRGB-capable configs. And gl.GetFramebufferAttachmentParameteriv(
gl::FRAMEBUFFER,
gl::FRONT,
gl::FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,
&mut ce
);
Isn't it the other way around? After all I also had to switch |
Hm, I know that with gles you can't change buffer colorspace at runtime, at least with gles2, maybe you can with gles3. It should be testable if you pick ES context and play with srgb on a surface, though, you likely did that already.
Not sure what you mean. I was saying that some platforms define buffer type at surface creation, e.g. EGLSurface with gles2 context. That's the only reason we have sRGB API on a surface creation. |
I can get an ES 3.2 and OpenGL 4.6 context on the RX 6800 XT from Mesa. Via Wayland EGL, on OpenGL 4.6, as above (Maybe I am reading On GLES3 on the same Mesa driver it works better: the linear->sRGB conversion only happens when I set On GLX on this Mesa driver I get identical behaviour.
Only EGL does this, WGL has a way to set it on the config, GLX doesn't expose any parameters. I think I should leave this here and focus on EGL colorspace support, instead of messing with broken sRGB support :) |
https://registry.khronos.org/EGL/specs/eglspec.1.5.pdf
Strange because I need that flag on ES to get sRGB conversion working 😅 |
For the past while I've been working on and off on turning the current sRGB colorspace support into full-fledged color space support, with a focus on EGL (Wayland desktop and Android phones). As it turns out there are quite a few backend differences that only make this feasible for the EGL backend. But before we get into some design questions I'd like to ask (separate issue), let's first look at sRGB as every backend and implementation has already gotten me totally confused. This is not really a Glutin issue but more of a general OpenGL ecosystem mess, though it might definitely be relevant to keep our implementation and documentation in check so I'm sharing it anyway.
The following was tested on a:
Preface
GL_FRAMEBUFFER_SRGB
is a feature that performs linear->sRGB conversion when writing to sRGB textures / framebuffers. It has no effect when the target is already linear (or so it is documented...);FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
;GL_FRAMEBUFFER_SRGB
is what is queried/filtered viaFRAMEBUFFER_SRGB_CAPABLE_*
on WGL and GLX. Though it works regardless if it is not capable (??);Android EGL
GL_FRAMEBUFFER_SRGB
(automatic linear->srgb conversion when writing to an srgb framebuffer) is on by default;FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
is not supported (it's GLES 3.2 though...);EGL_GL_COLORSPACE
toEGL_GL_COLORSPACE_SRGB
appropriately uses the defaultFRAMEBUFFER_SRGB
conversion, the image is now brighter;GL_COLORSPACE_SRGB
withgl.Disable(gl::FRAMEBUFFER_SRGB)
.👍, all working as expected.
Wayland EGL (AMD Mesa)
GL_SRGB
is always reported byFRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
;EGL_GL_COLORSPACE
makes no difference (color stays the same,COLOR_ENCODING
always returnsGL_SRGB
);GL_FRAMEBUFFER_SRGB
is off by default;GL_FRAMEBUFFER_SRGB
always makes the image brighter (makes sense given that the framebuffer is always considered to be inGL_SRGB
colorspace);EGL_(GL_)COLORSPACE
attributes follow which color is being set inCreatePlatformWindowSurface*
.Wayland EGL (AMD ProGL)
(using
progl
command)GL_LINEAR
according toFRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
;EGL_COLORSPACE
isEGL_GL_COLORSPACE_SRGB
, butEGL_GL_COLORSPACE
isEGL_GL_COLORSPACE_LINEAR
;EGL_COLORSPACE
has no effect;EGL_GL_COLORSPACE
toSRGB
correctly makesCOLOR_ENCODING
returnGL_SRGB
;GL_FRAMEBUFFER_SRGB
makes the image brighter (only when the color encoding is sRGB 👍).X11 (AMD Mesa)
COLOR_ENCODING
is alwaysGL_SRGB
;GL_FRAMEBUFFER_SRGB
makes the output lighter on every config (even those that are not "sRGB capable").X11 (AMD ProGL)
COLOR_ENCODING
always reportsGL_LINEAR
;GL_FRAMEBUFFER_SRGB
makes the output bright (this should not be the case for linear framebuffers?!).Wayland EGL (Intel UHD 620 on Mesa)
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
is alwaysGL_SRGB
;EGL_COLORSPACE
isEGL_COLORSPACE_SRGB
, whileEGL_GL_COLORSPACE
isEGL_COLORSPACE_LINEAR
;COLOR_ENCODING
;GL_FRAMEBUFFER_SRGB
always makes the image brighter (as expected forCOLOR_ENCODING
=GL_SRGB
).X11 (Intel UHD 620 on Mesa)
COLOR_ENCODING
isGL_SRGB
;FRAMEBUFFER_SRGB
is disabled by default, but enabling it always makes the image brighter.Windows (RX 6800 XT)
COLOR_ENCODING
isGL_LINEAR
;GL_FRAMEBUFFER_SRGB
is disabled;GL_FRAMEBUFFER_SRGB
makes the image brighter (again, weird for alinear
color encoding...);WGL_EXT_colorspace
is not in the list of supported extensions;WGL_COLORSPACE_EXT
viawglGetPixelFormatAttribivARB()
always fails;WGL_COLORSPACE_EXT
toWGL_COLORSPACE_SRGB_EXT
viawglChoosePixelFormatARB()
:COLOR_ENCODING
returnGL_SRGB
👍;GL_FRAMEBUFFER_SRGB
gets the image back to normal colors 👍.The text was updated successfully, but these errors were encountered: