diff options
author | Marek Olšák <[email protected]> | 2010-04-11 04:43:23 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-04-11 06:40:46 +0200 |
commit | e1208bbeaeefd12a445cef84cbd12b7dc346531f (patch) | |
tree | aa83c34523e70890b81565fd32398401de68b031 /src/gallium | |
parent | 93a6db077906d6896101a8151ca3508afba2da55 (diff) |
r300g: support some exotic sampler formats
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r300/r300_reg.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 23 |
2 files changed, 17 insertions, 8 deletions
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) { |