summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_extensions.c
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2018-11-13 12:18:27 +0100
committerGert Wollny <[email protected]>2019-01-28 12:18:40 +0100
commit8f9dfb7d8812a045a38b1740e90f43a585aec58e (patch)
treec24974e37a1a64589fdfc13bb2cd2f1311f95f19 /src/mesa/state_tracker/st_extensions.c
parent385081cd17705a2581a6325ac668d2d6fae19e7d (diff)
mesa/st: rework support for sRGB framebuffer attachements
For GLES sRGB framebuffer attachemnt support is provided in two steps: sRGB attachments like described in EXT_sRGB (and GLES 3.0) that enable linear to sRGB color space transformation automatically, and the ability to switch formats of the render target surface between sRGB and linear that introduces full support for EXT_framebuffer_sRGB. Set the according flags to reflect these two levels of sRGB support. As a difference between desktopm GL and GLES, on desktop GL for a sRGB framebuffer attachment the linear-sRGB conversion is turned off by default, and for GLES it is turned on. This needs to be taken into account when initally creating a surface, i.e. on desktop GL creation of a sRGB surface is preferred, but on GLES sRGB surfaces are only created when explicitely requested. v2: - Use the new CAPS name Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_extensions.c')
-rw-r--r--src/mesa/state_tracker/st_extensions.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index b0b9467cdfa..1e456d019d0 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -789,7 +789,7 @@ void st_init_extensions(struct pipe_screen *screen,
PIPE_FORMAT_B10G10R10A2_UINT },
GL_TRUE }, /* at least one format must be supported */
- { { o(EXT_framebuffer_sRGB) },
+ { { o(EXT_sRGB) },
{ PIPE_FORMAT_A8B8G8R8_SRGB,
PIPE_FORMAT_B8G8R8A8_SRGB,
PIPE_FORMAT_R8G8B8A8_SRGB },
@@ -1327,6 +1327,10 @@ void st_init_extensions(struct pipe_screen *screen,
extensions->ARB_texture_buffer_object_rgb32 &&
extensions->ARB_shader_image_load_store;
+ extensions->EXT_framebuffer_sRGB =
+ screen->get_param(screen, PIPE_CAP_DEST_SURFACE_SRGB_CONTROL) &&
+ extensions->EXT_sRGB;
+
/* Unpacking a varying in the fragment shader costs 1 texture indirection.
* If the number of available texture indirections is very limited, then we
* prefer to disable varying packing rather than run the risk of varying