From abb7c520fc533a94160ebc0902b3574d6ec96d9e Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 26 Oct 2018 10:45:43 +0200 Subject: [PATCH] formats: Add support for EXT_texture_sRGB_R8 if host supports it. This is a GLES only extension and the format is also only supported on a GLES host. Enables and passes on a host that supports it: dEQP-GLES31.functional.texture.filtering.cube_array.formats.sr8* dEQP-GLES31.functional.srgb_texture_decode.skip_decode.sr8.* Closes: #49 Reviewed-by: Gurchetan Singh Signed-off-by: Gert Wollny Signed-off-by: Jakob Bornecrantz --- src/gallium/auxiliary/util/u_format.csv | 1 + src/gallium/include/pipe/p_format.h | 2 ++ src/virgl_hw.h | 2 ++ src/vrend_formats.c | 6 ++++++ 4 files changed, 11 insertions(+) diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index e985d87..a20ecb3 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -112,6 +112,7 @@ PIPE_FORMAT_I32_FLOAT , plain, 1, 1, f32 , , , , xxxx, r # SRGB formats PIPE_FORMAT_L8_SRGB , plain, 1, 1, un8 , , , , xxx1, srgb +PIPE_FORMAT_R8_SRGB , plain, 1, 1, un8 , , , , x001, srgb PIPE_FORMAT_L8A8_SRGB , plain, 1, 1, un8 , un8 , , , xxxy, srgb PIPE_FORMAT_R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , , xyz1, srgb PIPE_FORMAT_R8G8B8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 5739980..6fb9122 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -396,6 +396,8 @@ enum pipe_format { PIPE_FORMAT_X1B5G5R5_UNORM = 310, PIPE_FORMAT_A4B4G4R4_UNORM = 311, + PIPE_FORMAT_R8_SRGB = 312, + PIPE_FORMAT_COUNT }; diff --git a/src/virgl_hw.h b/src/virgl_hw.h index 5d3731d..6357927 100644 --- a/src/virgl_hw.h +++ b/src/virgl_hw.h @@ -214,6 +214,8 @@ enum virgl_formats { VIRGL_FORMAT_R10G10B10X2_UNORM = 308, VIRGL_FORMAT_A4B4G4R4_UNORM = 311, + + VIRGL_FORMAT_R8_SRGB = 312, VIRGL_FORMAT_MAX, }; diff --git a/src/vrend_formats.c b/src/vrend_formats.c index 571e53f..2db06fa 100644 --- a/src/vrend_formats.c +++ b/src/vrend_formats.c @@ -258,6 +258,11 @@ static struct vrend_format_table gl_srgb_formats[] = { VIRGL_FORMAT_B8G8R8A8_SRGB, GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, NO_SWIZZLE }, }; +static struct vrend_format_table gles_srgb_r8_format[] = +{ + { VIRGL_FORMAT_R8_SRGB, GL_SR8_EXT, GL_RED, GL_UNSIGNED_BYTE, NO_SWIZZLE }, +}; + static struct vrend_format_table bit10_formats[] = { { VIRGL_FORMAT_B10G10R10X2_UNORM, GL_RGB10_A2, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, RGB1_SWIZZLE }, { VIRGL_FORMAT_B10G10R10A2_UNORM, GL_RGB10_A2, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, NO_SWIZZLE }, @@ -467,6 +472,7 @@ void vrend_build_format_list_gles(void) */ add_formats(gles_bgra_formats); + add_formats(gles_srgb_r8_format); /* The Z32 format is required, but OpenGL ES does not support * using it as a depth buffer. We just fake support with Z24