diff options
author | marha <marha@users.sourceforge.net> | 2014-03-09 22:56:02 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-09 22:56:02 +0100 |
commit | 2112b7dec49833ba872bd3ebcd7288930fec0796 (patch) | |
tree | 407c80c9a70f590af2d4c3e5c14678827e189331 /mesalib/src/mesa/state_tracker/st_format.c | |
parent | 8badbdef38ce843dc443ddee219eda4040ef2cd5 (diff) | |
parent | 3dd4b6420f686b0147d5b8136268cc63196e253b (diff) | |
download | vcxsrv-2112b7dec49833ba872bd3ebcd7288930fec0796.tar.gz vcxsrv-2112b7dec49833ba872bd3ebcd7288930fec0796.tar.bz2 vcxsrv-2112b7dec49833ba872bd3ebcd7288930fec0796.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig mesa xserver git update 9 Mar 2014
Conflicts:
mesalib/src/mapi/glapi/glapi.h
xorg-server/hw/kdrive/ephyr/hostx.c
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_format.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_format.c | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index 5f951eb02..a55ee3079 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -121,6 +121,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; case MESA_FORMAT_YCBCR: return PIPE_FORMAT_UYVY; + case MESA_FORMAT_YCBCR_REV: + return PIPE_FORMAT_YUYV; case MESA_FORMAT_RGB_DXT1: return PIPE_FORMAT_DXT1_RGB; case MESA_FORMAT_RGBA_DXT1: @@ -147,6 +149,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_A8B8G8R8_SRGB; case MESA_FORMAT_B8G8R8A8_SRGB: return PIPE_FORMAT_B8G8R8A8_SRGB; + case MESA_FORMAT_R8G8B8A8_SRGB: + return PIPE_FORMAT_R8G8B8A8_SRGB; case MESA_FORMAT_RGBA_FLOAT32: return PIPE_FORMAT_R32G32B32A32_FLOAT; case MESA_FORMAT_RGBA_FLOAT16: @@ -393,6 +397,9 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) case MESA_FORMAT_RGBX_SINT32: return PIPE_FORMAT_R32G32B32X32_SINT; + case MESA_FORMAT_B8G8R8X8_SRGB: + return PIPE_FORMAT_B8G8R8X8_SRGB; + default: return PIPE_FORMAT_NONE; } @@ -748,14 +755,47 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_R32G32B32X32_SINT: return MESA_FORMAT_RGBX_SINT32; + case PIPE_FORMAT_B8G8R8X8_SRGB: + return MESA_FORMAT_B8G8R8X8_SRGB; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return MESA_FORMAT_R8G8B8A8_SRGB; + default: - assert(0); return MESA_FORMAT_NONE; } } /** + * Debug only: check that the two functions above correctly map + * Mesa formats to Gallium formats and back again. + */ +static void +test_format_conversion(void) +{ + GLuint i; + + /* test all Mesa formats */ + for (i = 1; i < MESA_FORMAT_COUNT; i++) { + enum pipe_format pf = st_mesa_format_to_pipe_format(i); + if (pf != PIPE_FORMAT_NONE) { + mesa_format mf = st_pipe_format_to_mesa_format(pf); + assert(mf == i); + } + } + + /* Test all Gallium formats */ + for (i = 1; i < PIPE_FORMAT_COUNT; i++) { + mesa_format mf = st_pipe_format_to_mesa_format(i); + if (mf != MESA_FORMAT_NONE) { + enum pipe_format pf = st_mesa_format_to_pipe_format(mf); + assert(pf == i); + } + } +} + + +/** * Map GL texture formats to Gallium pipe formats. */ struct format_mapping @@ -1006,7 +1046,8 @@ static const struct format_mapping format_map[] = { /* sRGB formats */ { { GL_SRGB_EXT, GL_SRGB8_EXT, 0 }, - { PIPE_FORMAT_R8G8B8X8_SRGB, DEFAULT_SRGBA_FORMATS } + { PIPE_FORMAT_R8G8B8X8_SRGB, PIPE_FORMAT_B8G8R8X8_SRGB, + DEFAULT_SRGBA_FORMATS } }, { { GL_SRGB_ALPHA_EXT, GL_SRGB8_ALPHA8_EXT, 0 }, @@ -1015,7 +1056,7 @@ static const struct format_mapping format_map[] = { { { GL_COMPRESSED_SRGB_EXT, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 0 }, { PIPE_FORMAT_DXT1_SRGB, PIPE_FORMAT_R8G8B8X8_SRGB, - DEFAULT_SRGBA_FORMATS } + PIPE_FORMAT_B8G8R8X8_SRGB, DEFAULT_SRGBA_FORMATS } }, { { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0 }, @@ -1630,6 +1671,18 @@ st_choose_format(struct st_context *st, GLenum internalFormat, int i, j; enum pipe_format pf; +#ifdef DEBUG + { + static boolean firstCall = TRUE; + if (firstCall) { + test_format_conversion(); + firstCall = FALSE; + } + } +#else + (void) test_format_conversion; +#endif + /* can't render to compressed formats at this time */ if (_mesa_is_compressed_format(st->ctx, internalFormat) && (bindings & ~PIPE_BIND_SAMPLER_VIEW)) { |