From e295b4e800a0595f96d775ebd383b8a358f8fdbc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 28 Jul 2015 15:57:23 -0600 Subject: st/mesa: tweak surface format mapping table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Try to choose R8G8B8A8 unorm/srgb formats before others in an effort to try to match component ordering for UINT/SINT/etc. 2. If we can't get a format such as PIPE_FORMAT_A16_UNORM, try PIPE_FORMAT_R16G16B16A16_UNORM before shallower formats. Reviewed-by: Marek Olšák Reviewed-by: Charmaine Lee --- src/mesa/state_tracker/st_format.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/mesa/state_tracker/st_format.c') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 9a280fc004b..acb7725ab69 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -1062,23 +1062,23 @@ struct format_mapping #define DEFAULT_RGBA_FORMATS \ - PIPE_FORMAT_B8G8R8A8_UNORM, \ PIPE_FORMAT_R8G8B8A8_UNORM, \ + PIPE_FORMAT_B8G8R8A8_UNORM, \ PIPE_FORMAT_A8R8G8B8_UNORM, \ PIPE_FORMAT_A8B8G8R8_UNORM, \ 0 #define DEFAULT_RGB_FORMATS \ - PIPE_FORMAT_B8G8R8X8_UNORM, \ PIPE_FORMAT_R8G8B8X8_UNORM, \ + PIPE_FORMAT_B8G8R8X8_UNORM, \ PIPE_FORMAT_X8R8G8B8_UNORM, \ PIPE_FORMAT_X8B8G8R8_UNORM, \ PIPE_FORMAT_B5G6R5_UNORM, \ DEFAULT_RGBA_FORMATS #define DEFAULT_SRGBA_FORMATS \ - PIPE_FORMAT_B8G8R8A8_SRGB, \ PIPE_FORMAT_R8G8B8A8_SRGB, \ + PIPE_FORMAT_B8G8R8A8_SRGB, \ PIPE_FORMAT_A8R8G8B8_SRGB, \ PIPE_FORMAT_A8B8G8R8_SRGB, \ 0 @@ -1169,8 +1169,8 @@ static const struct format_mapping format_map[] = { /* basic Alpha formats */ { { GL_ALPHA12, GL_ALPHA16, 0 }, - { PIPE_FORMAT_A16_UNORM, PIPE_FORMAT_A8_UNORM, - DEFAULT_RGBA_FORMATS } + { PIPE_FORMAT_A16_UNORM, PIPE_FORMAT_R16G16B16A16_UNORM, + PIPE_FORMAT_A8_UNORM, DEFAULT_RGBA_FORMATS } }, { { GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_COMPRESSED_ALPHA, 0 }, @@ -1180,7 +1180,8 @@ static const struct format_mapping format_map[] = { /* basic Luminance formats */ { { GL_LUMINANCE12, GL_LUMINANCE16, 0 }, - { PIPE_FORMAT_L16_UNORM, PIPE_FORMAT_L8_UNORM, DEFAULT_RGB_FORMATS } + { PIPE_FORMAT_L16_UNORM, PIPE_FORMAT_R16G16B16A16_UNORM, + PIPE_FORMAT_L8_UNORM, DEFAULT_RGB_FORMATS } }, { { 1, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, 0 }, @@ -1191,8 +1192,8 @@ static const struct format_mapping format_map[] = { { { GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, 0}, - { PIPE_FORMAT_L16A16_UNORM, PIPE_FORMAT_L8A8_UNORM, - DEFAULT_RGBA_FORMATS } + { PIPE_FORMAT_L16A16_UNORM, PIPE_FORMAT_R16G16B16A16_UNORM, + PIPE_FORMAT_L8A8_UNORM, DEFAULT_RGBA_FORMATS } }, { { 2, GL_LUMINANCE_ALPHA, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, 0 }, @@ -1207,7 +1208,8 @@ static const struct format_mapping format_map[] = { /* basic Intensity formats */ { { GL_INTENSITY12, GL_INTENSITY16, 0 }, - { PIPE_FORMAT_I16_UNORM, PIPE_FORMAT_I8_UNORM, DEFAULT_RGBA_FORMATS } + { PIPE_FORMAT_I16_UNORM, PIPE_FORMAT_R16G16B16A16_UNORM, + PIPE_FORMAT_I8_UNORM, DEFAULT_RGBA_FORMATS } }, { { GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, -- cgit v1.2.3