r300g: support some exotic sampler formats

This commit is contained in:
Marek Olšák 2010-04-11 04:43:23 +02:00
parent 93a6db0779
commit e1208bbeae
2 changed files with 17 additions and 8 deletions

View File

@ -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

View File

@ -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) {