Commit 948ac631 authored by Jose Fonseca's avatar Jose Fonseca
Browse files

util: is_array/mixed/etc is only meaningful for plain formats.

parent 350bbc94
...@@ -138,6 +138,8 @@ class Format: ...@@ -138,6 +138,8 @@ class Format:
return nr_channels return nr_channels
def is_array(self): def is_array(self):
if self.layout != PLAIN:
return False
ref_channel = self.channels[0] ref_channel = self.channels[0]
for channel in self.channels[1:]: for channel in self.channels[1:]:
if channel.size and (channel.size != ref_channel.size or channel.size % 8): if channel.size and (channel.size != ref_channel.size or channel.size % 8):
...@@ -145,6 +147,8 @@ class Format: ...@@ -145,6 +147,8 @@ class Format:
return True return True
def is_mixed(self): def is_mixed(self):
if self.layout != PLAIN:
return False
ref_channel = self.channels[0] ref_channel = self.channels[0]
if ref_channel.type == VOID: if ref_channel.type == VOID:
ref_channel = self.channels[1] ref_channel = self.channels[1]
...@@ -160,18 +164,24 @@ class Format: ...@@ -160,18 +164,24 @@ class Format:
return is_pot(self.block_size()) return is_pot(self.block_size())
def is_int(self): def is_int(self):
if self.layout != PLAIN:
return False
for channel in self.channels: for channel in self.channels:
if channel.type not in (VOID, UNSIGNED, SIGNED): if channel.type not in (VOID, UNSIGNED, SIGNED):
return False return False
return True return True
def is_float(self): def is_float(self):
if self.layout != PLAIN:
return False
for channel in self.channels: for channel in self.channels:
if channel.type not in (VOID, FLOAT): if channel.type not in (VOID, FLOAT):
return False return False
return True return True
def is_bitmask(self): def is_bitmask(self):
if self.layout != PLAIN:
return False
if self.block_size() not in (8, 16, 32): if self.block_size() not in (8, 16, 32):
return False return False
for channel in self.channels: for channel in self.channels:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment