diff options
author | Marek Olšák <maraeo@gmail.com> | 2013-06-06 13:45:24 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2013-06-30 22:14:37 +0200 |
commit | f83e220d360776dae0fbb61df3741501c2dd4d96 (patch) | |
tree | d3ebef3308990f71d0ef7b449073611a8d1d5b6d /src/gallium/auxiliary/util/u_format.c | |
parent | adf8afa168fe9fe2e4a2b35afc3003040d05273f (diff) | |
download | external_mesa3d-f83e220d360776dae0fbb61df3741501c2dd4d96.zip external_mesa3d-f83e220d360776dae0fbb61df3741501c2dd4d96.tar.gz external_mesa3d-f83e220d360776dae0fbb61df3741501c2dd4d96.tar.bz2 |
st/mesa: handle SNORM formats in generic CopyPixels path
v2: check desc->is_mixed in util_format_is_snorm
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_format.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 9bdc2ea..686ca8a 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -131,6 +131,26 @@ util_format_is_pure_uint(enum pipe_format format) return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && 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_luminance_alpha(enum pipe_format format) |