summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_info.py
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-09-18 14:01:29 -0700
committerEric Anholt <[email protected]>2019-10-17 21:07:29 +0000
commitd77c77936b3956e8925504ad980acbff74422e7c (patch)
tree76f40b3200a97e2d8e4a6a11b64e49b8a3759d4f /src/mesa/main/format_info.py
parent4f4fc7535787e4a1006051611f573dc6d5eae741 (diff)
mesa: Add support for array formats of depth and stencil.
In desktop GL, you can specify things like GL_DEPTH_COMPONENT/GL_BYTE as a ReadPixels format, and we need to be able to represent that to see if we have proper MESA_FORMATs for them. That's exactly what the mesa_array_format enum is for. v2: Drop _mesa from static fn. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/format_info.py')
-rw-r--r--src/mesa/main/format_info.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index 432578f4e19..d3ec486f155 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -176,6 +176,10 @@ static const struct mesa_format_info format_info[MESA_FORMAT_COUNT] =
def format_channel_bits(fmat, tuple_list):
return ['.%s = %s' % (field, str(get_channel_bits(fmat, name))) for (field, name) in tuple_list]
+bf_map = {
+ "GL_DEPTH_COMPONENT" : "MESA_ARRAY_FORMAT_BASE_FORMAT_DEPTH",
+ "GL_STENCIL_INDEX" : "MESA_ARRAY_FORMAT_BASE_FORMAT_STENCIL",
+}
for fmat in formats:
print(' {')
@@ -200,6 +204,7 @@ for fmat in formats:
chan = fmat.array_element()
norm = chan.norm or chan.type == parser.FLOAT
print(' .ArrayFormat = MESA_ARRAY_FORMAT({0}),'.format(', '.join([
+ bf_map.get(get_gl_base_format(fmat), "MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS"),
str(chan.size // 8),
str(int(chan.sign)),
str(int(chan.type == parser.FLOAT)),