As seen in the example given, when attaching an SRGB/RGB texture view is created from an alternate RGB/SRGB texture, then attached as a framebuffer, rendering will gamma correct wrongly and querying GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING will return GL_LINEAR for an SRGB backed frame buffer.
This is causing AA renders to be too dark as in our unreleased project, among many other subtle colour issues.
Tested on latest 11.3 (git-9d9965c from oibaf) and seen on older drivers as well.
$ g++ TextureViewFramebufferSRGBTest.cpp.cpp $( sdl2-config --cflags --libs ) -lGL
This reproduces on Mesa AMD and swrast.
Thanks for the report - did you forget to attach a source file?
Created attachment 122407 [details]
TextureViewFramebufferSRGB Test Sample Code
Created attachment 122408 [details]
AMD Mesa Output (Incorrect Behaviour)
Created attachment 122409 [details]
Intel Output (Correct Behaviour)
Created attachment 122410 [details]
Nvidia Output (Correct Behaviour)
Created attachment 122411 [details]
Swrast Output (Incorrect Behaviour)
Hi Edwin, thanks for following up with the details. I'm going to look into this.
There is a patch at https://patchwork.freedesktop.org/patch/77510/ which fixes your test case (and should fix format casting with render-to-texture more generally).
Let us know if this fixes your SRGB-related rendering problems.
Fixed in Mesa master, commit a8b315b8271e867db30650dedb52e53d8dd9667c
The test case submitted now works as expected using the latest mesa git drivers. Thank you for such a quick fix!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.