Commit 6abb1b49 authored by Anuj Phogat's avatar Anuj Phogat
Browse files

mesa: Add block depth field in struct gl_format_info



This will be later required for 3D ASTC formats.
Signed-off-by: Anuj Phogat's avatarAnuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent c4a0cd46
......@@ -185,8 +185,9 @@ for fmat in formats:
print ' {0:d},'.format(fmat.colorspace == 'srgb')
print ' {0}, {1}, {2},'.format(fmat.block_width, fmat.block_height,
int(fmat.block_size() / 8))
print ' {0}, {1}, {2}, {3},'.format(fmat.block_width, fmat.block_height,
fmat.block_depth,
int(fmat.block_size() / 8))
print ' {{ {0} }},'.format(', '.join(map(str, fmat.swizzle)))
if fmat.is_array():
......
......@@ -227,7 +227,7 @@ class Swizzle:
class Format:
"""Describes a pixel format."""
def __init__(self, name, layout, block_width, block_height, channels, swizzle, colorspace):
def __init__(self, name, layout, block_width, block_height, block_depth, channels, swizzle, colorspace):
"""Constructs a Format from some metadata and a list of channels.
The channel objects must be unique to this Format and should not be
......@@ -241,6 +241,7 @@ class Format:
layout -- One of 'array', 'packed' 'other', or a compressed layout
block_width -- The block width if the format is compressed, 1 otherwise
block_height -- The block height if the format is compressed, 1 otherwise
block_depth -- The block depth if the format is compressed, 1 otherwise
channels -- A list of Channel objects
swizzle -- A Swizzle from this format to rgba
colorspace -- one of 'rgb', 'srgb', 'yuv', or 'zs'
......@@ -249,6 +250,7 @@ class Format:
self.layout = layout
self.block_width = block_width
self.block_height = block_height
self.block_depth = block_depth
self.channels = channels
assert isinstance(swizzle, Swizzle)
self.swizzle = swizzle
......@@ -361,7 +363,7 @@ class Format:
def is_compressed(self):
"""Returns true if this is a compressed format."""
return self.block_width != 1 or self.block_height != 1
return self.block_width != 1 or self.block_height != 1 or self.block_depth != 1
def is_int(self):
"""Returns true if this format is an integer format.
......@@ -555,12 +557,13 @@ def parse(filename):
layout = fields[1]
block_width = int(fields[2])
block_height = int(fields[3])
colorspace = fields[9]
block_depth = int(fields[4])
colorspace = fields[10]
try:
swizzle = Swizzle(fields[8])
swizzle = Swizzle(fields[9])
except:
sys.exit("error parsing swizzle for format " + name)
channels = _parse_channels(fields[4:8], layout, colorspace, swizzle)
channels = _parse_channels(fields[5:9], layout, colorspace, swizzle)
yield Format(name, layout, block_width, block_height, channels, swizzle, colorspace)
yield Format(name, layout, block_width, block_height, block_depth, channels, swizzle, colorspace)
......@@ -68,9 +68,9 @@ struct gl_format_info
bool IsSRGBFormat;
/**
* To describe compressed formats. If not compressed, Width=Height=1.
* To describe compressed formats. If not compressed, Width=Height=Depth=1.
*/
GLubyte BlockWidth, BlockHeight;
GLubyte BlockWidth, BlockHeight, BlockDepth;
GLubyte BytesPerBlock;
uint8_t Swizzle[4];
......
This diff is collapsed.
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