diff options
author | Marek Olšák <marek.olsak@amd.com> | 2024-01-08 02:04:55 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-02-23 18:03:58 +0000 |
commit | 1388be4d39714c46f03af2d784272a0cde818690 (patch) | |
tree | e02bb471bb12dcbb843016b0002d3d692affda8c /src/mapi/glapi | |
parent | 13a8efcb2c3b5715e5fa74e54a42d2e78c992f87 (diff) |
glthread: pack "size" in Pointer calls as 16 bits
The only legal values are {1, 2, 3, 4, GL_BGRA}.
We need GLpacked16i to be unsigned, not signed, because GL_BGRA is
greater than 0x8000.
This decreases the size of 1 frame by 10% in Viewperf2020/Catia1.
It decreases the size of many Pointer calls by 8 bytes.
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/glapi')
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/marshal_XML.py | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 4aec2d438f5..1458c33fc76 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -229,6 +229,8 @@ class PrintCode(gl_XML.gl_print_base): out('cmd->{0} = MIN2({0}, 0xffff); /* clamped to 0xffff (invalid enum) */'.format(p.name)) elif type == 'GLclamped16i': out('cmd->{0} = CLAMP({0}, INT16_MIN, INT16_MAX);'.format(p.name)) + elif type == 'GLpacked16i': + out('cmd->{0} = {0} < 0 ? UINT16_MAX : MIN2({0}, UINT16_MAX);'.format(p.name)) else: out('cmd->{0} = {0};'.format(p.name)) if variable_params: diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index 8c52df6a379..9aa99d19682 100644 --- a/src/mapi/glapi/gen/marshal_XML.py +++ b/src/mapi/glapi/gen/marshal_XML.py @@ -43,6 +43,9 @@ def get_marshal_type(func_name, param): if (type, param.name) == ('GLsizei', 'stride'): return 'GLclamped16i' + if (type, param.name) == ('GLint', 'size'): + return 'GLpacked16i' + return type def get_type_size(func_name, param): @@ -60,6 +63,7 @@ def get_type_size(func_name, param): 'GLushort': 2, 'GLhalfNV': 2, 'GLclamped16i': 2, # clamped by glthread + 'GLpacked16i': 2, # clamped by glthread 'GLint': 4, 'GLuint': 4, 'GLbitfield': 4, |