From 928a5684177fdb6cd013949348aee6078dd305c0 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 27 Jun 2009 11:58:00 -0700 Subject: [PATCH] r300g: YCbCr and sRGB textures. --- src/gallium/drivers/r300/r300_reg.h | 3 ++- src/gallium/drivers/r300/r300_screen.c | 3 +++ src/gallium/drivers/r300/r300_texture.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index e57535fe9e1..79c778f9543 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1565,7 +1565,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_CONST_Z (4<<5) # define R300_TX_FORMAT_CONST_W (8<<5) -# define R300_TX_FORMAT_YUV_MODE 0x00800000 +# define R300_TX_FORMAT_GAMMA (1 << 21) +# define R300_TX_FORMAT_YUV_TO_RGB (1 << 22) #define R300_TX_FORMAT2_0 0x4500 /* obvious missing in gap */ # define R300_TX_PITCHMASK_SHIFT 0 diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 42a7009481a..da1d5ffe2fd 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -196,10 +196,13 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, PIPE_TEXTURE_USAGE_PRIMARY); /* Texture */ + case PIPE_FORMAT_A8R8G8B8_SRGB: + case PIPE_FORMAT_R8G8B8A8_SRGB: case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT5_RGBA: + case PIPE_FORMAT_YCBCR: return usage & PIPE_TEXTURE_USAGE_SAMPLER; /* Colorbuffer or texture */ diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 5511cca48cb..3b56f0307c0 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -44,6 +44,12 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); case PIPE_FORMAT_R8G8B8A8_UNORM: return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8); + case PIPE_FORMAT_A8R8G8B8_SRGB: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8) | + R300_TX_FORMAT_GAMMA; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | + R300_TX_FORMAT_GAMMA; /* DXT1 */ case PIPE_FORMAT_DXT1_RGB: return R300_EASY_TX_FORMAT(X, Y, Z, ONE, DXT1); @@ -55,6 +61,10 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* DXT5 */ case PIPE_FORMAT_DXT5_RGBA: return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5); + /* YVYU422 */ + case PIPE_FORMAT_YCBCR: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, YVYU422) | + R300_TX_FORMAT_YUV_TO_RGB; /* W24_FP */ case PIPE_FORMAT_Z24S8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); -- 2.30.2