From acd2968005168c8af9f9365cd41eca391a4c736e Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 1 Nov 2018 12:59:26 +0100 Subject: [PATCH] mesa/st: Add support for EXT_texture_sRGB_R8 This only adds support on the Gallium core level, for the drivers it is likely that additional changes are needed to support the new texture format and thereby enabling the extension. Enables on softpipe and makes pass: dEQP-GLES31.functional.srgb_texture_decode.skip_decode.sr8.* v2: - add include for getting GL_SR8_EXT v4: - since the extension is not required don't bother providing a fallback (Ilia Mirkin) - split patch (2/2) to separate Gallium and mesa/st parts (Roland Scheidegger) - trim commit message to only contain the history of the patch relevant to this part v5: - don't include GLES headers (required enum has been added to glheader.h) (Ilia Mirkin) Signed-off-by: Gert Wollny Reviewed-by: Ilia Mirkin --- src/mesa/state_tracker/st_extensions.c | 4 ++++ src/mesa/state_tracker/st_format.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 798ee60875a..16889074f66 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -889,6 +889,10 @@ void st_init_extensions(struct pipe_screen *screen, PIPE_FORMAT_R8G8B8A8_SRGB}, GL_TRUE }, /* at least one format must be supported */ + { { o(EXT_texture_sRGB_R8) }, + { PIPE_FORMAT_R8_SRGB }, + GL_TRUE }, + { { o(EXT_texture_type_2_10_10_10_REV) }, { PIPE_FORMAT_R10G10B10A2_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM }, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 16a18c272dc..caddd76c5da 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -169,6 +169,8 @@ st_mesa_format_to_pipe_format(const struct st_context *st, return PIPE_FORMAT_AL88_SRGB; case MESA_FORMAT_L_SRGB8: return PIPE_FORMAT_L8_SRGB; + case MESA_FORMAT_R_SRGB8: + return PIPE_FORMAT_R8_SRGB; case MESA_FORMAT_BGR_SRGB8: return PIPE_FORMAT_R8G8B8_SRGB; case MESA_FORMAT_A8B8G8R8_SRGB: @@ -719,6 +721,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_A8L8_SRGB; case PIPE_FORMAT_L8_SRGB: return MESA_FORMAT_L_SRGB8; + case PIPE_FORMAT_R8_SRGB: + return MESA_FORMAT_R_SRGB8; case PIPE_FORMAT_R8G8B8_SRGB: return MESA_FORMAT_BGR_SRGB8; case PIPE_FORMAT_ABGR8888_SRGB: @@ -1423,6 +1427,10 @@ static const struct format_mapping format_map[] = { 0 }, { PIPE_FORMAT_L8_SRGB, DEFAULT_SRGBA_FORMATS } }, + { + { GL_SR8_EXT, 0 }, + { PIPE_FORMAT_R8_SRGB, 0 } + }, /* 16-bit float formats */ { -- 2.30.2