From: Marek Olšák Date: Sun, 11 Apr 2010 02:43:23 +0000 (+0200) Subject: r300g: support some exotic sampler formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1208bbeaeefd12a445cef84cbd12b7dc346531f;p=mesa.git r300g: support some exotic sampler formats --- diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index bb87cc7eae7..239f91443f2 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1543,7 +1543,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_DXT1 0xF # define R300_TX_FORMAT_DXT3 0x10 # define R300_TX_FORMAT_DXT5 0x11 -# define R300_TX_FORMAT_Y8 0x12 +# define R300_TX_FORMAT_CxV8U8 0x12 # define R300_TX_FORMAT_AVYU444 0x13 # define R300_TX_FORMAT_VYUY422 0x14 # define R300_TX_FORMAT_YVYU422 0x15 diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 4f1562ddc73..8ed28eb11a6 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -99,12 +99,6 @@ uint32_t r300_translate_texformat(enum pipe_format format, R300_TX_FORMAT_SIGNED_W, }; - /* This is truly a special format. - * It stores R8G8 and B is computed using sqrt(1 - R^2 - G^2). */ - if (format == PIPE_FORMAT_R8G8Bx_SNORM) { - return ~0; /* Unsupported. */ - } - desc = util_format_description(format); /* Colorspace (return non-RGB formats directly). */ @@ -139,7 +133,15 @@ uint32_t r300_translate_texformat(enum pipe_format format, result |= R300_TX_FORMAT_GAMMA; break; - default:; + default: + switch (format) { + /* Same as YUV but without the YUR->RGB conversion. */ + case PIPE_FORMAT_R8G8_B8G8_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, YVYU422) | result; + case PIPE_FORMAT_G8R8_G8B8_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, VYUY422) | result; + default:; + } } /* Add swizzle. */ @@ -213,6 +215,13 @@ uint32_t r300_translate_texformat(enum pipe_format format, } } + /* This is truly a special format. + * It stores R8G8 and B is computed using sqrt(1 - R^2 - G^2) + * in the sampler unit. Also known as D3DFMT_CxV8U8. */ + if (format == PIPE_FORMAT_R8G8Bx_SNORM) { + return R300_TX_FORMAT_CxV8U8 | result; + } + /* RGTC formats. */ if (desc->layout == UTIL_FORMAT_LAYOUT_RGTC) { switch (format) {