[Mesa-dev] [PATCH 30/35] i965: Port gen6+ emit vertices code to genxml.

Kenneth Graunke kenneth at whitecape.org
Thu Apr 20 06:38:23 UTC 2017


On Wednesday, April 19, 2017 4:56:23 PM PDT Rafael Antognolli wrote:
[snip]
> +#ifndef NDEBUG
> +static bool
> +is_passthru_format(uint32_t format)

Wrapping this in ifndef NDEBUG breaks release builds - for example,
genX(uploads_needed) uses it outside of an assertion.  If you want to
shut up warnings about the unused function, you can declare it as
"UNUSED static bool".

> +{
> +   switch (format) {
> +   case ISL_FORMAT_R64_PASSTHRU:
> +   case ISL_FORMAT_R64G64_PASSTHRU:
> +   case ISL_FORMAT_R64G64B64_PASSTHRU:
> +   case ISL_FORMAT_R64G64B64A64_PASSTHRU:
> +      return true;
> +   default:
> +      return false;
> +   }
> +}
> +#endif
> +
> +#if GEN_GEN < 8
> +static int
> +genX(uploads_needed)(uint32_t format)
> +{
> +   if (!is_passthru_format(format))
> +      return 1;
> +
> +   switch (format) {
> +   case ISL_FORMAT_R64_PASSTHRU:
> +   case ISL_FORMAT_R64G64_PASSTHRU:
> +      return 1;
> +   case ISL_FORMAT_R64G64B64_PASSTHRU:
> +   case ISL_FORMAT_R64G64B64A64_PASSTHRU:
> +      return 2;
> +   default:
> +      unreachable("not reached");
> +   }
> +}
> +
> +/*
> + * Returns the format that we are finally going to use when upload a vertex
> + * element. It will only change if we are using *64*PASSTHRU formats, as for
> + * gen < 8 they need to be splitted on two *32*FLOAT formats.
> + *
> + * @upload points in which upload we are. Valid values are [0,1]
> + */
> +static uint32_t
> +downsize_format_if_needed(uint32_t format,
> +                          int upload)
> +{
> +   assert(upload == 0 || upload == 1);
> +
> +   if (!is_passthru_format(format))
> +      return format;
> +
> +   switch (format) {
> +   case ISL_FORMAT_R64_PASSTHRU:
> +      return ISL_FORMAT_R32G32_FLOAT;
> +   case ISL_FORMAT_R64G64_PASSTHRU:
> +      return ISL_FORMAT_R32G32B32A32_FLOAT;
> +   case ISL_FORMAT_R64G64B64_PASSTHRU:
> +      return !upload ? ISL_FORMAT_R32G32B32A32_FLOAT
> +                     : ISL_FORMAT_R32G32_FLOAT;
> +   case ISL_FORMAT_R64G64B64A64_PASSTHRU:
> +      return ISL_FORMAT_R32G32B32A32_FLOAT;
> +   default:
> +      unreachable("not reached");
> +   }
> +}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170419/56cbf5fa/attachment.sig>


More information about the mesa-dev mailing list