diff options
author | Marek Olšák <marek.olsak@amd.com> | 2024-01-07 20:42:14 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-02-23 18:03:58 +0000 |
commit | 15bc7e1d6258fca2c970384463726ab08aaecba0 (patch) | |
tree | f3ef8d17881a30ae32894b55eef34ec44c9abc54 /src/mapi | |
parent | 39edcd695ab5820ffad3d4a070dafa6578c1b448 (diff) |
glthread: pack the primitive type to 8 bits
The maximum valid enum is only 14.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27350>
Diffstat (limited to 'src/mapi')
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/marshal_XML.py | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 1458c33fc76..69a5b1d4a08 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -225,6 +225,8 @@ class PrintCode(gl_XML.gl_print_base): if p.count: out('memcpy(cmd->{0}, {0}, {1});'.format( p.name, p.size_string())) + elif type == 'GLenum8': + out('cmd->{0} = MIN2({0}, 0xff); /* clamped to 0xff (invalid enum) */'.format(p.name)) elif type == 'GLenum16': out('cmd->{0} = MIN2({0}, 0xffff); /* clamped to 0xffff (invalid enum) */'.format(p.name)) elif type == 'GLclamped16i': diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index 9aa99d19682..165c0b73a1a 100644 --- a/src/mapi/glapi/gen/marshal_XML.py +++ b/src/mapi/glapi/gen/marshal_XML.py @@ -30,6 +30,13 @@ import gl_XML def get_marshal_type(func_name, param): type = param.type_string() + if ('Draw' in func_name and + ('Arrays' in func_name or + 'Elements' in func_name or + 'TransformFeedback' in func_name)): + if (type, param.name) == ('GLenum', 'mode'): + return 'GLenum8' + if type == 'GLenum': return 'GLenum16' # clamped to 0xffff (always invalid enum) @@ -58,6 +65,7 @@ def get_type_size(func_name, param): 'GLboolean': 1, 'GLbyte': 1, 'GLubyte': 1, + 'GLenum8': 1, # clamped by glthread 'GLenum16': 2, # clamped by glthread 'GLshort': 2, 'GLushort': 2, |