[Mesa-dev] [PATCH 03/30] intel/isl: Add a helper for determining if a color is 0/1
Chad Versace
chadversary at chromium.org
Fri Jun 2 20:09:24 UTC 2017
On Fri 26 May 2017, Jason Ekstrand wrote:
> ---
> src/intel/isl/isl.c | 19 +++++++++++++++++++
> src/intel/isl/isl.h | 4 ++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
> index 321850e..4eec2fd 100644
> --- a/src/intel/isl/isl.c
> +++ b/src/intel/isl/isl.c
> @@ -267,6 +267,25 @@ isl_tiling_get_info(const struct isl_device *dev,
> return true;
> }
>
> +bool
> +isl_color_value_is_zero_one(union isl_color_value value,
> + enum isl_format format)
> +{
> + if (isl_format_has_int_channel(format)) {
> + for (unsigned i = 0; i < 4; i++) {
This patch assumes the all four channels of isl_color_value are
initialized, even if the isl_format has fewer than four channels.
This smells like the seed of a hard-to-reproduce bug.
Since it's not possible today to query the number of channels in an
isl_format, please at least add a scary comment on the function about
this.
More information about the mesa-dev
mailing list