diff options
author | Marek Olšák <marek.olsak@amd.com> | 2024-01-07 13:43:26 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-02-23 18:03:58 +0000 |
commit | 138804fdfce719ccb1e1f5b0a448e4e19c414bdc (patch) | |
tree | 55827a8ceea97b9630ea38c8f7076f1029619a58 /src/mapi | |
parent | c52e1f916a7753ef4adc11a4c9232685803d9499 (diff) |
glthread: add no_error variants of glDrawElements*
The main motivation is that no_error allows us to drop count==0 draws
at the beginning of the marshal function, instead of forwarding them
to the frontend thread. Such draws are plentiful with Viewperf.
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/ARB_base_instance.xml | 5 | ||||
-rw-r--r-- | src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml | 8 | ||||
-rw-r--r-- | src/mapi/glapi/gen/ARB_draw_instanced.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_API.dtd | 3 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_API.xml | 6 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 12 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal_h.py | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/marshal_XML.py | 1 |
8 files changed, 29 insertions, 10 deletions
diff --git a/src/mapi/glapi/gen/ARB_base_instance.xml b/src/mapi/glapi/gen/ARB_base_instance.xml index 5dbf895a4dd..d6c17c155b9 100644 --- a/src/mapi/glapi/gen/ARB_base_instance.xml +++ b/src/mapi/glapi/gen/ARB_base_instance.xml @@ -17,7 +17,8 @@ <param name="baseinstance" type="GLuint"/> </function> - <function name="DrawElementsInstancedBaseInstance" marshal="custom" exec="dlist"> + <function name="DrawElementsInstancedBaseInstance" marshal="custom" exec="dlist" + marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="count" type="GLsizei"/> <param name="type" type="GLenum"/> @@ -27,7 +28,7 @@ </function> <function name="DrawElementsInstancedBaseVertexBaseInstance" marshal="custom" exec="dlist" - marshal_struct="public"> + marshal_struct="public" marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="count" type="GLsizei"/> <param name="type" type="GLenum"/> diff --git a/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml b/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml index 736eda82e4a..a7353c544ff 100644 --- a/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml +++ b/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml @@ -9,7 +9,7 @@ <category name="GL_ARB_draw_elements_base_vertex" number="62"> <function name="DrawElementsBaseVertex" es2="3.2" marshal="custom" exec="dlist" - marshal_struct="public"> + marshal_struct="public" marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="count" type="GLsizei"/> <param name="type" type="GLenum"/> @@ -17,7 +17,8 @@ <param name="basevertex" type="GLint"/> </function> - <function name="DrawRangeElementsBaseVertex" es2="3.2" marshal="custom" exec="dlist"> + <function name="DrawRangeElementsBaseVertex" es2="3.2" marshal="custom" exec="dlist" + marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="start" type="GLuint"/> <param name="end" type="GLuint"/> @@ -36,7 +37,8 @@ <param name="basevertex" type="const GLint *" count="primcount"/> </function> - <function name="DrawElementsInstancedBaseVertex" es2="2.0" marshal="custom" exec="dlist"> + <function name="DrawElementsInstancedBaseVertex" es2="2.0" marshal="custom" exec="dlist" + marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="count" type="GLsizei"/> <param name="type" type="GLenum"/> diff --git a/src/mapi/glapi/gen/ARB_draw_instanced.xml b/src/mapi/glapi/gen/ARB_draw_instanced.xml index 9ff2a56cc0a..5418fd62917 100644 --- a/src/mapi/glapi/gen/ARB_draw_instanced.xml +++ b/src/mapi/glapi/gen/ARB_draw_instanced.xml @@ -16,7 +16,7 @@ </function> <function name="DrawElementsInstanced" marshal="custom" exec="dlist" es2="2.0" - marshal_struct="public"> + marshal_struct="public" marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="count" type="GLsizei"/> <param name="type" type="GLenum"/> diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd index a5aae816c48..0358dc9609d 100644 --- a/src/mapi/glapi/gen/gl_API.dtd +++ b/src/mapi/glapi/gen/gl_API.dtd @@ -45,6 +45,7 @@ marshal_call_before CDATA #IMPLIED> marshal_call_after CDATA #IMPLIED> marshal_struct CDATA #IMPLIED> + marshal_no_error CDATA #IMPLIED> <!ATTLIST size name NMTOKEN #REQUIRED count NMTOKEN #IMPLIED mode (get | set) "set"> @@ -143,6 +144,8 @@ param: header file instead of the C file. It's done even with marshal="custom", in which case you don't have to define the structure manually. + marshal_no_error - indicate that a no_error marshal function will be + generated, only useful with marshal="custom" glx: rop - Opcode value for "render" commands diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 91549c214cb..6f5d68f6cf3 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -3218,7 +3218,8 @@ <glx rop="193" handcode="true"/> </function> - <function name="DrawElements" es1="1.0" es2="2.0" marshal="custom" exec="dlist"> + <function name="DrawElements" es1="1.0" es2="2.0" marshal="custom" exec="dlist" + marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="count" type="GLsizei"/> <param name="type" type="GLenum"/> @@ -3791,7 +3792,8 @@ <glx rop="4097"/> </function> - <function name="DrawRangeElements" es2="3.0" marshal="custom" exec="dlist"> + <function name="DrawRangeElements" es2="3.0" marshal="custom" exec="dlist" + marshal_no_error="true"> <param name="mode" type="GLenum"/> <param name="start" type="GLuint"/> <param name="end" type="GLuint"/> diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index d571f047532..233a60d5db0 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -279,8 +279,16 @@ class PrintCode(gl_XML.gl_print_base): if not condition: continue - settings_by_condition[condition].append( - 'SET_{0}(table, _mesa_marshal_{0});'.format(func.name)) + if func.marshal_no_error: + no_error_condition = '_mesa_is_no_error_enabled(ctx) && ({0})'.format(condition) + error_condition = '!_mesa_is_no_error_enabled(ctx) && ({0})'.format(condition) + settings_by_condition[no_error_condition].append( + 'SET_{0}(table, _mesa_marshal_{0}_no_error);'.format(func.name)) + settings_by_condition[error_condition].append( + 'SET_{0}(table, _mesa_marshal_{0});'.format(func.name)) + else: + settings_by_condition[condition].append( + 'SET_{0}(table, _mesa_marshal_{0});'.format(func.name)) # Print out an if statement for each unique condition, with # the SET_* calls nested inside it. diff --git a/src/mapi/glapi/gen/gl_marshal_h.py b/src/mapi/glapi/gen/gl_marshal_h.py index d155d233340..4dd8acc3dfd 100644 --- a/src/mapi/glapi/gen/gl_marshal_h.py +++ b/src/mapi/glapi/gen/gl_marshal_h.py @@ -76,6 +76,8 @@ class PrintCode(gl_XML.gl_print_base): if flavor in ('custom', 'async', 'sync') and not func.marshal_is_static(): print('{0} GLAPIENTRY _mesa_marshal_{1}({2});'.format(func.return_type, func.name, func.get_parameter_string())) + if func.marshal_no_error: + print('{0} GLAPIENTRY _mesa_marshal_{1}_no_error({2});'.format(func.return_type, func.name, func.get_parameter_string())) def show_usage(): diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index 49314fd14bb..ffaeb1498a9 100644 --- a/src/mapi/glapi/gen/marshal_XML.py +++ b/src/mapi/glapi/gen/marshal_XML.py @@ -116,6 +116,7 @@ class marshal_function(gl_XML.gl_function): self.marshal_call_before = element.get('marshal_call_before') self.marshal_call_after = element.get('marshal_call_after') self.marshal_struct = element.get('marshal_struct') + self.marshal_no_error = gl_XML.is_attr_true(element, 'marshal_no_error') def marshal_flavor(self): """Find out how this function should be marshalled between |