Mesa (master): mesa/format_info: Add support for the BPTC layout

Neil Roberts nroberts at kemper.freedesktop.org
Tue Aug 12 17:27:15 UTC 2014


Module: Mesa
Branch: master
Commit: cc9c30b8a746691316ae7757b68cea1b1cd3ea84
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc9c30b8a746691316ae7757b68cea1b1cd3ea84

Author: Neil Roberts <neil at linux.intel.com>
Date:   Wed Aug  6 16:52:14 2014 +0100

mesa/format_info: Add support for the BPTC layout

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.

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

---

 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:




More information about the mesa-commit mailing list