Bug 94595 - [Mesa AMD&swrast] Texture views attached as framebuffers return their viewed tecture's color encoding and render incorrectly
Summary: [Mesa AMD&swrast] Texture views attached as framebuffers return their viewed ...
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: Other Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-17 16:33 UTC by Edwin Smith (Feral Interactive)
Modified: 2016-03-22 09:35 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
TextureViewFramebufferSRGB Test Sample Code (6.86 KB, text/plain)
2016-03-18 09:07 UTC, Edwin Smith (Feral Interactive)
Details
AMD Mesa Output (Incorrect Behaviour) (717 bytes, text/plain)
2016-03-18 09:07 UTC, Edwin Smith (Feral Interactive)
Details
Intel Output (Correct Behaviour) (713 bytes, text/plain)
2016-03-18 09:08 UTC, Edwin Smith (Feral Interactive)
Details
Nvidia Output (Correct Behaviour) (713 bytes, text/plain)
2016-03-18 09:09 UTC, Edwin Smith (Feral Interactive)
Details
Swrast Output (Incorrect Behaviour) (717 bytes, text/plain)
2016-03-18 09:09 UTC, Edwin Smith (Feral Interactive)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Edwin Smith (Feral Interactive) 2016-03-17 16:33:53 UTC
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.
Comment 1 Nicolai Hähnle 2016-03-17 17:13:36 UTC
Thanks for the report - did you forget to attach a source file?
Comment 2 Edwin Smith (Feral Interactive) 2016-03-18 09:07:05 UTC
Created attachment 122407 [details]
TextureViewFramebufferSRGB Test Sample Code
Comment 3 Edwin Smith (Feral Interactive) 2016-03-18 09:07:53 UTC
Created attachment 122408 [details]
AMD Mesa Output (Incorrect Behaviour)
Comment 4 Edwin Smith (Feral Interactive) 2016-03-18 09:08:42 UTC
Created attachment 122409 [details]
Intel Output (Correct Behaviour)
Comment 5 Edwin Smith (Feral Interactive) 2016-03-18 09:09:16 UTC
Created attachment 122410 [details]
Nvidia Output (Correct Behaviour)
Comment 6 Edwin Smith (Feral Interactive) 2016-03-18 09:09:42 UTC
Created attachment 122411 [details]
Swrast Output (Incorrect Behaviour)
Comment 7 Nicolai Hähnle 2016-03-18 19:33:36 UTC
Hi Edwin, thanks for following up with the details. I'm going to look into this.
Comment 8 Nicolai Hähnle 2016-03-18 23:14:46 UTC
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.
Comment 9 Nicolai Hähnle 2016-03-22 04:11:07 UTC
Fixed in Mesa master, commit a8b315b8271e867db30650dedb52e53d8dd9667c
Comment 10 Edwin Smith (Feral Interactive) 2016-03-22 09:35:57 UTC
The test case submitted now works as expected using the latest mesa git drivers. Thank you for such a quick fix!


bug/show.html.tmpl processed on Feb 24, 2017 at 21:53:09.
(provided by the Example extension).