aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state_inlines.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-01-04 23:53:23 +0100
committerMarek Olšák <[email protected]>2015-01-04 23:54:47 +0100
commit3793a1b42149112f543d33a622a163a5057ecc3d (patch)
tree84080fc5971282a16be9de729291093c70f736eb /src/gallium/drivers/r300/r300_state_inlines.h
parent48094d0e6554a9df36bf00fc2793ade46cf92406 (diff)
r300g: handle vertex format PIPE_FORMAT_NONE
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_inlines.h')
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 62c03b3909b..97619dbd2ba 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -343,6 +343,9 @@ r300_translate_vertex_data_type(enum pipe_format format) {
const struct util_format_description *desc;
unsigned i;
+ if (!format)
+ format = PIPE_FORMAT_R32_FLOAT;
+
desc = util_format_description(format);
if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
@@ -410,10 +413,16 @@ 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);
+ const struct util_format_description *desc;
unsigned i, swizzle = 0;
- assert(format);
+ if (!format)
+ return (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_X_SHIFT) |
+ (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Y_SHIFT) |
+ (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) |
+ (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT);
+
+ desc = util_format_description(format);
if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
fprintf(stderr, "r300: Bad format %s in %s:%d\n",