Bug 100650 - texelFetch should always perform sRGB decode
Summary: texelFetch should always perform sRGB decode
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: i965-deqp
  Show dependency treegraph
 
Reported: 2017-04-11 05:24 UTC by Kenneth Graunke
Modified: 2019-03-14 08:40 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Kenneth Graunke 2017-04-11 05:24:13 UTC
The i965 driver fails the following dEQP test on all platforms:

dEQP-GLES31.functional.srgb_texture_decode.skip_decode.srgba8.texel_fetch

This is because it respects GL_SKIP_DECODE_EXT for all texturing functions, when it's required to ignore it for texelFetch*().  From the EXT_texture_sRGB_decode spec:

   "The conversion of sRGB color space components to linear color space is
    always performed if the texel lookup function is one of the texelFetch
    builtin functions.

    Otherwise, if the texel lookup function is one of the texture builtin
    functions or one of the texture gather functions, the conversion of sRGB
    color space components to linear color space is controlled by the
    TEXTURE_SRGB_DECODE_EXT parameter.

    If the TEXTURE_SRGB_DECODE_EXT parameter is DECODE_EXT, the conversion
    of sRGB color space components to linear color space is performed.

    If the TEXTURE_SRGB_DECODE_EXT parameter is SKIP_DECODE_EXT, the value
    is returned without decoding. However, if the texture is also accessed
    with a texelFetch function, then the result of texture builtin functions
    and/or texture gather functions may be returned with decoding or without
    decoding."
Comment 1 Annie 2017-04-27 04:57:06 UTC
Hi Ken-Thanks for filing. So is this (for sure) a mesa issue? If so, can you help me determine a priority? Thank you.
Comment 2 Annie 2017-08-24 22:17:54 UTC
@Ken-Is this something we should review again as we get closer to Android O?
Comment 3 Kenneth Graunke 2017-08-27 22:47:14 UTC
Yes.
Comment 4 Kenneth Graunke 2017-10-06 10:24:32 UTC
Discussed the spec at Khronos.  Still need to fix this.

The srgb-txf branch of my tree has patches to fix this, I ought to drop the BRW_META_IN_PROGRESS rubbish (which causes more CPU overhead) in favor of whacking the uses_txf bitfield somehow.  I'll want to do that before sending them for review.
Comment 5 Kenneth Graunke 2017-10-07 02:58:33 UTC
Nicolai just fixed this on radeonsi today, so I may have to rebase.
Comment 6 Pallavi G 2017-10-11 04:39:56 UTC
The same test is failing in the Android-IA on O.
It would be great if we get the fix quickly as possible.
Kindly let me know the status of the fix.
Comment 7 Kenneth Graunke 2017-10-11 09:52:01 UTC
There are patches to fix the bug here,
https://cgit.freedesktop.org/~kwg/mesa/log/?h=srgb-txf

but I haven't mailed them out for review yet because Nicolai is imminently pushing patches that conflict with them.  I should be able to sort it out tomorrow.
Comment 8 Pallavi G 2017-10-11 10:33:17 UTC
Thank you will try with the patches(In reply to Kenneth Graunke from comment #7)
> There are patches to fix the bug here,
> https://cgit.freedesktop.org/~kwg/mesa/log/?h=srgb-txf
> 
> but I haven't mailed them out for review yet because Nicolai is imminently
> pushing patches that conflict with them.  I should be able to sort it out
> tomorrow.
Comment 9 Kenneth Graunke 2017-10-13 00:24:57 UTC
Fixed by

commit cb9a4ae6c00245398aa63644bf6ab4f1b09050fa
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Sep 9 00:20:26 2017 -0700

    i965: Ignore GL_SKIP_DECODE_EXT for textures accessed via texelFetch().

Thanks to Nicolai and Jason for reviewing.


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.