summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-04-27 00:01:03 +0200
committerMarek Olšák <[email protected]>2010-04-27 00:01:03 +0200
commit83b76657b3dbf5e00d73bc03cc102317c4af6eca (patch)
tree1b480aaafa7314269d2b46a75e3173c1757a04cd
parent52f145a186b8e47439fb4a96d04a099d439477b7 (diff)
r300g: set undefined vertex swizzles to (0,0,0,1) respectively
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h9
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);
}