diff options
author | Marek Olšák <[email protected]> | 2010-04-01 02:14:52 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-04-01 02:14:52 +0200 |
commit | 3252651fb291d7e6e4af5fed8ab461f603574cd6 (patch) | |
tree | f5e7f6c743e15eb3047d7b409d6e4e3f3b88fe10 /src/gallium/drivers/r300/r300_texture.c | |
parent | 39e116e3a0dce1a13dbb4395585cd3873e5ed073 (diff) |
r300g: add RGTC texture support
The CS checker already knows about this.
Diffstat (limited to 'src/gallium/drivers/r300/r300_texture.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 92c29b53fd8..d4a64092c70 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -158,7 +158,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format) } } - /* Compressed formats. */ + /* S3TC formats. */ if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { switch (format) { case PIPE_FORMAT_DXT1_RGB: @@ -184,6 +184,20 @@ static uint32_t r300_translate_texformat(enum pipe_format format) } } + /* RGTC formats. */ + if (desc->layout == UTIL_FORMAT_LAYOUT_RGTC) { + switch (format) { + case PIPE_FORMAT_RGTC1_UNORM: + case PIPE_FORMAT_RGTC1_SNORM: + return R500_TX_FORMAT_ATI1N | result; + case PIPE_FORMAT_RGTC2_UNORM: + case PIPE_FORMAT_RGTC2_SNORM: + return R400_TX_FORMAT_ATI2N | result; + default: + return ~0; /* Unsupported/unknown. */ + } + } + /* See whether the components are of the same size. */ for (i = 1; i < desc->nr_channels; i++) { uniform = uniform && desc->channel[0].size == desc->channel[i].size; @@ -295,6 +309,17 @@ static uint32_t r300_translate_texformat(enum pipe_format format) return ~0; /* Unsupported/unknown. */ } +static uint32_t r500_tx_format_msb_bit(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_RGTC1_UNORM: + case PIPE_FORMAT_RGTC1_SNORM: + return R500_TXFORMAT_MSB; + default: + return 0; + } +} + /* Buffer formats. */ /* Colorbuffer formats. This is the unswizzled format of the RB3D block's @@ -520,6 +545,7 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex if (pt->height0 > 2048) { state->format2 |= R500_TXHEIGHT_BIT11; } + state->format2 |= r500_tx_format_msb_bit(pt->format); } SCREEN_DBG(screen, DBG_TEX, "r300: Set texture state (%dx%d, %d levels)\n", |