}
for (chan = 0; chan < desc->nr_channels; ++chan) {
- if (desc->swizzle[chan] != chan)
+ if (desc->channel[chan].size != desc->channel[0].size)
return FALSE;
+ if (desc->channel[chan].type == UTIL_FORMAT_TYPE_VOID && (chan + 1) == desc->nr_channels)
+ continue;
+
if (desc->channel[chan].type != desc->channel[0].type)
return FALSE;
if (desc->channel[chan].pure_integer != desc->channel[0].pure_integer)
return FALSE;
+ }
- if (desc->channel[chan].size != desc->channel[0].size)
+ if (desc->nr_channels == 4) {
+ if (desc->swizzle[3] < 3)
return FALSE;
+ } else {
+ for (chan = 0; chan < desc->nr_channels; ++chan) {
+ if (desc->swizzle[chan] != chan)
+ return FALSE;
+ }
}
return TRUE;
/**
* Whether the format is a simple array format where all channels
- * are of the same type and can be loaded from memory as a vector
+ * are of the same type and can be loaded from memory as a vector.
+ *
+ * If format is 4 channel it can be swizzled (eg BGRA) as long
+ * as the alpha is the 3rd channel.
*/
boolean
util_format_is_array(const struct util_format_description *desc);