boolean util_format_is_pure_uint(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); int i; i = util_format_get_first_non_void_channel(format); if (i == -1) return FALSE; return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE; }
boolean util_format_is_pure_integer(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); int i; /* Find the first non-void channel. */ i = util_format_get_first_non_void_channel(format); if (i == -1) return FALSE; return desc->channel[i].pure_integer ? TRUE : FALSE; }
/** * Returns true if all non-void channels are normalized signed. */ boolean util_format_is_snorm(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); int i; if (desc->is_mixed) return FALSE; i = util_format_get_first_non_void_channel(format); if (i == -1) return FALSE; return desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED && !desc->channel[i].pure_integer && desc->channel[i].normalized; }
boolean util_format_is_float(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); unsigned i; assert(desc); if (!desc) { return FALSE; } i = util_format_get_first_non_void_channel(format); if (i == -1) { return FALSE; } return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE; }
static bool r300_is_blending_supported(struct r300_screen *rscreen, enum pipe_format format) { int c; const struct util_format_description *desc = util_format_description(format); if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) return false; c = util_format_get_first_non_void_channel(format); /* RGBA16F */ if (rscreen->caps.is_r500 && desc->nr_channels == 4 && desc->channel[c].size == 16 && desc->channel[c].type == UTIL_FORMAT_TYPE_FLOAT) return true; if (desc->channel[c].normalized && desc->channel[c].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[c].size >= 4 && desc->channel[c].size <= 10) { /* RGB10_A2, RGBA8, RGB5_A1, RGBA4, RGB565 */ if (desc->nr_channels >= 3) return true; if (format == PIPE_FORMAT_R8G8_UNORM) return true; /* R8, I8, L8, A8 */ if (desc->nr_channels == 1) return true; } return false; }