[Mesa-dev] [PATCH 3/9] st/mesa: tweak surface format mapping table
Brian Paul
brianp at vmware.com
Thu Aug 27 16:47:55 PDT 2015
1. Try to choose R8G8B8A8 unorm/srgb formats before other orders 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 <marek.olsak at amd.com>
---
src/mesa/state_tracker/st_format.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index db7b5b7..a8fa6b1 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -943,23 +943,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
@@ -1050,8 +1050,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 },
@@ -1061,7 +1061,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 },
@@ -1072,8 +1073,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 },
@@ -1088,7 +1089,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,
--
1.9.1
More information about the mesa-dev
mailing list