diff options
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_state_inlines.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index c2bff67ccb6..fcbdb91b67e 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -453,10 +453,17 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) { return 0; } - for (i = 0; i < 4; i++) { + for (i = 0; i < desc->nr_channels; i++) { swizzle |= MIN2(desc->swizzle[i], R300_SWIZZLE_SELECT_FP_ONE) << (3*i); } + /* Set (0,0,0,1) in unused components. */ + for (; i < 3; i++) { + swizzle |= R300_SWIZZLE_SELECT_FP_ZERO << (3*i); + } + for (; i < 4; i++) { + swizzle |= R300_SWIZZLE_SELECT_FP_ONE << (3*i); + } return swizzle | (0xf << R300_WRITE_ENA_SHIFT); } |