glthread: work around GL_INVALID_OPERATION with OpenGL ES 1.x draws
authorMarek Olšák <marek.olsak@amd.com>
Tue, 23 Aug 2022 20:59:18 +0000 (16:59 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 21 Sep 2022 14:54:50 +0000 (14:54 +0000)
GLES1 only has (Multi)Draw{Array,Elements}, but glthread converts them
to the more complicated versions and then calls them through the dispatch,
which generated GL_INVALID_OPERATION.

Luckily, we can export them with the Internal prefix, so they are unlikely
to be used by apps by accident.

Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18223>

src/mapi/glapi/gen/gl_API.xml

index 1d21f3a..35bbac8 100644 (file)
 </category>
 
 <category name="GL_MESA_internal_functions">
+    <!-- These functions exist because glthread converts all draws to these
+         and then calls them through the dispatch table, so this is a workaround
+         for the GL_INVALID_OPERATION errors with OpenGL ES 1.x. -->
+    <function name="InternalDrawArraysInstancedBaseInstance" es1="1.0"
+              alias="DrawArraysInstancedBaseInstance">
+        <param name="mode" type="GLenum"/>
+        <param name="first" type="GLint"/>
+        <param name="count" type="GLsizei"/>
+        <param name="instancecount" type="GLsizei"/>
+        <param name="baseinstance" type="GLuint"/>
+    </function>
+
+    <function name="InternalDrawElementsInstancedBaseVertexBaseInstance" es1="1.0"
+              alias="DrawElementsInstancedBaseVertexBaseInstance">
+        <param name="mode" type="GLenum"/>
+        <param name="count" type="GLsizei"/>
+        <param name="type" type="GLenum"/>
+        <param name="indices" type="const GLvoid *"/>
+        <param name="instancecount" type="GLsizei"/>
+        <param name="basevertex" type="GLint"/>
+        <param name="baseinstance" type="GLuint"/>
+    </function>
+
+    <function name="InternalDrawRangeElementsBaseVertex" es1="1.0"
+              alias="DrawRangeElementsBaseVertex">
+        <param name="mode" type="GLenum"/>
+        <param name="start" type="GLuint"/>
+        <param name="end" type="GLuint"/>
+        <param name="count" type="GLsizei"/>
+        <param name="type" type="GLenum"/>
+        <param name="indices" type="const GLvoid *"/>
+        <param name="basevertex" type="GLint"/>
+    </function>
+
+    <function name="InternalMultiDrawElementsBaseVertex" es1="1.0"
+              alias="MultiDrawElementsBaseVertex">
+        <param name="mode" type="GLenum"/>
+        <param name="count" type="const GLsizei *"/>
+        <param name="type" type="GLenum"/>
+        <param name="indices" type="const GLvoid * const *"/>
+        <param name="primcount" type="GLsizei"/>
+        <param name="basevertex" type="const GLint *"/>
+    </function>
+
     <!-- Internal function for glthread to implement BufferSubData as a GPU copy. -->
     <function name="InternalBufferSubDataCopyMESA" es2="2.0">
         <param name="srcBuffer" type="GLintptr"/> <!-- "struct gl_buffer_object *" really -->