From 71ac9551c49387813fcf3e6e88778081bf7306fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 7 Feb 2010 11:36:00 +0100 Subject: [PATCH] r300g: fix texture formats: A4R4G4B4_UNORM, A1R5G5B5_UNORM, R5G6B5_UNORM --- src/gallium/drivers/r300/r300_screen.c | 6 +++--- src/gallium/drivers/r300/r300_state_inlines.h | 8 ++++++-- src/gallium/drivers/r300/r300_texture.h | 8 ++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 1668cae2f43..8e9f51aba2d 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -216,9 +216,6 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, switch (format) { /* Supported formats. */ /* Colorbuffer */ - case PIPE_FORMAT_A4R4G4B4_UNORM: - case PIPE_FORMAT_R5G6B5_UNORM: - case PIPE_FORMAT_A1R5G5B5_UNORM: case PIPE_FORMAT_A8_UNORM: case PIPE_FORMAT_L8_UNORM: retval = usage & @@ -242,6 +239,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, break; /* Colorbuffer or texture */ + case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_A1R5G5B5_UNORM: + case PIPE_FORMAT_A4R4G4B4_UNORM: case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_R8G8B8A8_UNORM: diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 08d8d2e97ff..b7676e1715c 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -403,10 +403,14 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format) static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) { switch (format) { + case PIPE_FORMAT_R5G6B5_UNORM: + /* C_5_6_5 is missing in US_OUT_FMT, but C4_8 works just fine. */ + case PIPE_FORMAT_A1R5G5B5_UNORM: + /* C_1_5_5_5 is missing in US_OUT_FMT, but C4_8 works just fine. */ + case PIPE_FORMAT_A4R4G4B4_UNORM: + /* C4_4 is missing in US_OUT_FMT, but C4_8 works just fine. */ case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: - /* XXX */ - case PIPE_FORMAT_Z24S8_UNORM: return R300_US_OUT_FMT_C4_8 | R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A; diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 0c5ac48a24c..1d2382da06d 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -60,12 +60,20 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) return R300_EASY_TX_FORMAT(X, X, X, ONE, X8) | R300_TX_FORMAT_GAMMA; /* X16 */ + case PIPE_FORMAT_A4R4G4B4_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4); case PIPE_FORMAT_R16_UNORM: case PIPE_FORMAT_Z16_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, X16); case PIPE_FORMAT_R16_SNORM: return R300_EASY_TX_FORMAT(X, X, X, X, X16) | R300_TX_FORMAT_SIGNED; + /* Z5Y6X5 */ + case PIPE_FORMAT_R5G6B5_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); + /* W1Z5Y5X5*/ + case PIPE_FORMAT_A1R5G5B5_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5); /* Y8X8 */ case PIPE_FORMAT_A8L8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8); -- 2.30.2