Bug 36965 - GL_EXT_texture_sRGB (included in OpenGL 2.1) is broken (glean/texture_srgb broken too)
Summary: GL_EXT_texture_sRGB (included in OpenGL 2.1) is broken (glean/texture_srgb br...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: 7.10
Hardware: All Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-08 07:00 UTC by Martin Lambers
Modified: 2012-11-02 12:13 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Martin Lambers 2011-05-08 07:00:30 UTC
The GL extension GL_EXT_texture_sRGB (which is in OpenGL 2.1 core) defines the texture formats GL_SRGB and friends and specifies that sampling such a texture automatically converts the values from non-linear RGB (sRGB) to linear RGB.

However, this conversion is not performed; the textures are sampled as if they were normal GL_RGB textures. This results in wrong colors (e.g. in the Bino 3D video player: far too bright).

I'm running Ubuntu 11.04 on x86_64 and get the following version info from GL:
OpenGL version: 2.1 Mesa 7.10.2
OpenGL renderer: Gallium 0.4 on AMD RV710
OpenGL vendor: X.Org

If you need more information, please let me know.

[This is the same as bug 32323, but re-reported for newer Mesa versions]
Comment 1 Pavel Ondračka 2011-05-12 09:11:08 UTC
I see similar problems in Starcraft 2, there are also over bright textures which go away when MESA_EXTENSION_OVERRIDE="-GL_EXT_texture_sRGB_decode" is set.
OpenGL renderer string: Gallium 0.4 on ATI RV530
OpenGL version string: 2.1 Mesa 7.11-devel (git-32a95cb)
Comment 2 Pavel Ondračka 2011-05-12 09:18:11 UTC
BTW this should be probably a mesa core bug, right?
Comment 3 Martin Lambers 2011-05-12 10:20:51 UTC
(In reply to comment #2)
> BTW this should be probably a mesa core bug, right?

There is code in Mesa to handle SRGB textures correctly, see http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/main/texgetimage.c lines 223-301.

I guess drivers can override this, but I don't know the internal structure of Mesa.
Comment 4 Marek Olšák 2011-05-12 12:50:02 UTC
There is a lot of other code which plays role in handling sRGB textures. I don't think getteximage.c is relevant to this issue(s).

Nevertheless, it looks like Pavel's and Martin's issues are different bugs.

Pavel reported that GL_EXT_texture_sRGB_decode, which is only in 7.11, is broken specifically on r300g, but other drivers might be affected as well and it definitely looks like a Mesa core bug. Pavel, could you please add it as a new bug against Mesa core?

Martin's issue is likely related to the fact that piglit/glean/texture_srgb fails on r600g. Taking a look at it might be a good start.
Comment 5 Pavel Ondračka 2011-05-12 14:07:59 UTC
(In reply to comment #4)
> There is a lot of other code which plays role in handling sRGB textures. I
> don't think getteximage.c is relevant to this issue(s).
> 
> Nevertheless, it looks like Pavel's and Martin's issues are different bugs.
> 
> Pavel reported that GL_EXT_texture_sRGB_decode, which is only in 7.11, is
> broken specifically on r300g, but other drivers might be affected as well and
> it definitely looks like a Mesa core bug. Pavel, could you please add it as a
> new bug against Mesa core?
> 
Reported against mesa core as bug 37150.
Comment 6 Andreas Boll 2012-11-02 10:37:35 UTC
(In reply to comment #4)
> There is a lot of other code which plays role in handling sRGB textures. I
> don't think getteximage.c is relevant to this issue(s).
> 
> Nevertheless, it looks like Pavel's and Martin's issues are different bugs.
> 
> Pavel reported that GL_EXT_texture_sRGB_decode, which is only in 7.11, is
> broken specifically on r300g, but other drivers might be affected as well
> and it definitely looks like a Mesa core bug. Pavel, could you please add it
> as a new bug against Mesa core?
> 
> Martin's issue is likely related to the fact that piglit/glean/texture_srgb
> fails on r600g. Taking a look at it might be a good start.

the piglit passes for me on my rv770 with mesa from git (470952f)

@Martin: Can you test with a newer version of mesa (9.0 or mesa from git)?
Comment 7 Martin Lambers 2012-11-02 11:55:38 UTC
I don't have access anymore to the AMD graphics card that originally exposed the problem for me.

I can only confirm that the problem does not exist with Mesa 9.0 (from Ubuntu 12.10) with an Intel Sandybridge GPU:
OpenGL Version: 3.0 Mesa 9.0
OpenGL Renderer: Mesa DRI Intel(R) Sandybridge Mobile 
OpenGL Vendor: Intel Open Source Technology Center

Thanks for your work.

Martin


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.