diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-22 10:50:50 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-22 10:50:50 +0000 |
commit | 9130ec005fbc78a62420643414d8354d0929ca50 (patch) | |
tree | 6762777acdd2d4eee17ef87290e80dc7afe2b73d /lib/mesa/src/intel/isl/gen_format_layout.py | |
parent | ca11beabae33eb59fb981b8adf50b1d47a2a98f0 (diff) |
Merge Mesa 21.1.5
Diffstat (limited to 'lib/mesa/src/intel/isl/gen_format_layout.py')
-rw-r--r-- | lib/mesa/src/intel/isl/gen_format_layout.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/mesa/src/intel/isl/gen_format_layout.py b/lib/mesa/src/intel/isl/gen_format_layout.py index c1f22707f..b1c4df257 100644 --- a/lib/mesa/src/intel/isl/gen_format_layout.py +++ b/lib/mesa/src/intel/isl/gen_format_layout.py @@ -81,6 +81,7 @@ isl_format_layouts[] = { % endif % endfor }, + .uniform_channel_type = ISL_${format.uniform_channel_type}, .colorspace = ISL_COLORSPACE_${format.colorspace}, .txc = ISL_TXC_${format.txc}, }, @@ -179,6 +180,23 @@ class Format(object): chan.start = bit bit = bit + chan.size + # Set the uniform channel type, if the format has one. + # + # Iterate over all channels, not just those in self.order, because + # some formats have an empty 'order' field in the CSV (such as + # YCRCB_NORMAL). + self.uniform_channel_type = 'VOID' + for chan in self.channels: + if chan.type in (None, 'VOID'): + pass + elif self.uniform_channel_type == 'VOID': + self.uniform_channel_type = chan.type + elif self.uniform_channel_type == chan.type: + pass + else: + self.uniform_channel_type = 'VOID' + break + # alpha doesn't have a colorspace of it's own. self.colorspace = line[13].strip().upper() if self.colorspace in ['']: @@ -188,6 +206,17 @@ class Format(object): self.txc = line[14].strip().upper() or 'NONE' + @property + def channels(self): + yield self.r + yield self.g + yield self.b + yield self.a + yield self.l + yield self.i + yield self.p + + def reader(csvfile): """Wrapper around csv.reader that skips comments and blanks.""" # csv.reader actually reads the file one line at a time (it was designed to |