summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-06 21:11:59 -0700
committerKenneth Graunke <[email protected]>2017-10-10 15:06:17 -0700
commit51e7879544728e22bed74ea46437638856c8eb55 (patch)
tree1ec7d6be43d42ee699acc4c19fe56d618f403a1a
parent96f80c8d4d97771b5450d6d15ddb3b172c7d69cf (diff)
mesa: Make _mesa_get_format_bytes handle array formats.
This is easier than making callers handle a bunch of special cases. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/main/formats.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 34450003572..c1d8641116e 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -109,6 +109,11 @@ _mesa_get_format_name(mesa_format format)
GLint
_mesa_get_format_bytes(mesa_format format)
{
+ if (_mesa_format_is_mesa_array_format(format)) {
+ return _mesa_array_format_get_type_size(format) *
+ _mesa_array_format_get_num_channels(format);
+ }
+
const struct gl_format_info *info = _mesa_get_format_info(format);
assert(info->BytesPerBlock);
assert(info->BytesPerBlock <= MAX_PIXEL_BYTES ||