[Mesa-dev] [PATCH v2] mesa/format_info: Add support for the BPTC layout

Jason Ekstrand jason at jlekstrand.net
Tue Aug 12 10:04:57 PDT 2014


Sorry, I didn't mean to make that much of a stink.  Either's fine with me
as long as we're not doing 32 for half-float.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>


On Tue, Aug 12, 2014 at 8:09 AM, Neil Roberts <neil at linux.intel.com> wrote:

> I'm not sure if we came to a decision about what to do with the
> channel bits. I guess it's not really that important because probably
> nothing uses it for compressed formats except to check for the
> existence of the channels. Here is a v2 patch which picks 8/8/8/8 for
> the RGBA formats and 16/16/16 for the half-float formats. Would that
> be ok?
>
> I guess we should pick a policy and make it consistent for the other
> formats too but perhaps we can leave that to a later patch. It looks
> like the NVidia approach might be to return a number of bits that you
> would need to create a texture to represent the possible generated
> values from the decompressor. However that doesn't quite add up for
> the half-float formats because in that case you could accurately
> represent the values with a half-float texture and only 16 bits.
>
> If we wanted to pick that policy we would also have to change what we
> return for the S3TC formats because they can also return 8 bits of
> variance. The ETC2 formats already return 8.
>
> - Neil
>
> ------- >8 --------------- (use git am --scissors to automatically chop
> here)
>
> Adds the ‘bptc’ layout to get_channel_bits. The channel bits for BPTC
> depend
> on the mode but as it only has to be an approximation this sets it to 8 for
> the two UNORM formats and 16 for the two half-float formats. These
> represent
> the minimum number of bits of variation that can be generated by the
> interpolation of the two formats.
>
> This doesn't quite match what we do for S3TC which only returns 4 even
> though
> it can similarly generate 8 bits from the interpolation. However it does
> match
> what we return for ETC2. For reference, NVidia seems to return 8 bits for
> the
> UNORM formats and 32 bits for the half-float formats.
>
> v2: Change the number of bits to 8/8/8/8 for the UNORM formats and 16/16/16
>     for the half-float formats.
> ---
>  src/mesa/main/format_info.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
> index a0eecd3..7424fe0 100644
> --- a/src/mesa/main/format_info.py
> +++ b/src/mesa/main/format_info.py
> @@ -127,6 +127,9 @@ def get_channel_bits(fmat, chan_name):
>
>           bits = 11 if fmat.name.endswith('11_EAC') else 8
>           return bits if fmat.has_channel(chan_name) else 0
> +      elif fmat.layout == 'bptc':
> +         bits = 16 if fmat.name.endswith('_FLOAT') else 8
> +         return bits if fmat.has_channel(chan_name) else 0
>        else:
>           assert False
>     else:
> --
> 1.9.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140812/725f26bb/attachment.html>


More information about the mesa-dev mailing list