diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-01-17 04:41:51 +0100 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2010-01-17 01:10:32 -0800 |
commit | 7d3090f0fe41757582729bb5a580ad5b9a03f765 (patch) | |
tree | 4ca24db9fa628ff79658b9e231e33e3f1dd12612 /src/gallium/drivers/r300/r300_state_inlines.h | |
parent | c4a2f13a5c59f3527e4e04cb2d8f55e639e1fd46 (diff) | |
download | external_mesa3d-7d3090f0fe41757582729bb5a580ad5b9a03f765.zip external_mesa3d-7d3090f0fe41757582729bb5a580ad5b9a03f765.tar.gz external_mesa3d-7d3090f0fe41757582729bb5a580ad5b9a03f765.tar.bz2 |
r300g: fix vertex colors with 8 bits per channel
The piglit BGRA tests pass now.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_inlines.h')
-rw-r--r-- | src/gallium/drivers/r300/r300_state_inlines.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 35be00e..a9ee0a2 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -537,6 +537,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { static INLINE uint16_t r300_translate_vertex_data_swizzle(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); + unsigned swizzle[4], i; assert(format); @@ -547,11 +548,22 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) { return 0; } - return ((desc->swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) | - (desc->swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) | - (desc->swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) | - (desc->swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT) | - (0xf << R300_WRITE_ENA_SHIFT)); + /* Swizzles for 8bits formats are in the reversed order, not sure why. */ + if (desc->channel[0].size == 8) { + for (i = 0; i < 4; i++) { + swizzle[i] = 3 - desc->swizzle[i]; + } + } else { + for (i = 0; i < 4; i++) { + swizzle[i] = desc->swizzle[i]; + } + } + + return ((swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) | + (swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) | + (swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) | + (swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT) | + (0xf << R300_WRITE_ENA_SHIFT)); } #endif /* R300_STATE_INLINES_H */ |