diff options
-rw-r--r-- | src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml | 5 | ||||
-rw-r--r-- | src/mapi/glapi/gen/EXT_direct_state_access.xml | 35 | ||||
-rw-r--r-- | src/mapi/glapi/gen/GL3x.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/es_EXT.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_API.xml | 30 | ||||
-rw-r--r-- | src/mesa/main/glthread.h | 15 | ||||
-rw-r--r-- | src/mesa/main/glthread_varray.c | 56 |
7 files changed, 102 insertions, 43 deletions
diff --git a/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml b/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml index fcbb1673971..90144944715 100644 --- a/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml +++ b/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml @@ -52,7 +52,7 @@ </function> <function name="VertexAttribLPointer" no_error="true" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index));"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index), size, type, stride, pointer);"> <param name="index" type="GLuint"/> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> @@ -66,7 +66,8 @@ <param name="params" type="GLdouble *"/> </function> - <function name="VertexArrayVertexAttribLOffsetEXT"> + <function name="VertexArrayVertexAttribLOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_GENERIC(index), size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="index" type="GLuint" /> diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 5c52573a172..d570f688e53 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -658,7 +658,7 @@ </function> <function name="MultiTexCoordPointerEXT" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(texunit - GL_TEXTURE0));"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(texunit - GL_TEXTURE0), size, type, stride, pointer);"> <param name="texunit" type="GLenum" /> <param name="size" type="GLint" /> <param name="type" type="GLenum" /> @@ -1055,7 +1055,8 @@ <param name="size" type="GLsizeiptr" /> </function> - <function name="VertexArrayVertexOffsetEXT"> + <function name="VertexArrayVertexOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_POS, size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="size" type="GLint" /> @@ -1064,7 +1065,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayColorOffsetEXT"> + <function name="VertexArrayColorOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_COLOR0, size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="size" type="GLint" /> @@ -1073,14 +1075,16 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayEdgeFlagOffsetEXT"> + <function name="VertexArrayEdgeFlagOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_EDGEFLAG, 1, GL_UNSIGNED_BYTE, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="stride" type="GLsizei" /> <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayIndexOffsetEXT"> + <function name="VertexArrayIndexOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_COLOR_INDEX, 1, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="type" type="GLenum" /> @@ -1088,7 +1092,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayNormalOffsetEXT"> + <function name="VertexArrayNormalOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_NORMAL, 3, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="type" type="GLenum" /> @@ -1096,7 +1101,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayTexCoordOffsetEXT"> + <function name="VertexArrayTexCoordOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture), size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="size" type="GLint" /> @@ -1105,7 +1111,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayMultiTexCoordOffsetEXT"> + <function name="VertexArrayMultiTexCoordOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_TEX(texunit - GL_TEXTURE0), size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="texunit" type="GLenum" /> @@ -1115,7 +1122,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayFogCoordOffsetEXT"> + <function name="VertexArrayFogCoordOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_FOG, 1, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="type" type="GLenum" /> @@ -1123,7 +1131,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArraySecondaryColorOffsetEXT"> + <function name="VertexArraySecondaryColorOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_COLOR1, size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="size" type="GLint" /> @@ -1132,7 +1141,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayVertexAttribOffsetEXT"> + <function name="VertexArrayVertexAttribOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_GENERIC(index), size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="index" type="GLuint" /> @@ -1143,7 +1153,8 @@ <param name="offset" type="GLintptr" /> </function> - <function name="VertexArrayVertexAttribIOffsetEXT"> + <function name="VertexArrayVertexAttribIOffsetEXT" + marshal_call_after="if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_GENERIC(index), size, type, stride, offset);"> <param name="vaobj" type="GLuint" /> <param name="buffer" type="GLuint" /> <param name="index" type="GLuint" /> diff --git a/src/mapi/glapi/gen/GL3x.xml b/src/mapi/glapi/gen/GL3x.xml index 19875bc9505..ced4e10f101 100644 --- a/src/mapi/glapi/gen/GL3x.xml +++ b/src/mapi/glapi/gen/GL3x.xml @@ -258,7 +258,7 @@ <function name="VertexAttribIPointer" es2="3.0" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index));"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index), size, type, stride, pointer);"> <param name="index" type="GLuint"/> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml index de3c14dafed..dd987b8dc8f 100644 --- a/src/mapi/glapi/gen/es_EXT.xml +++ b/src/mapi/glapi/gen/es_EXT.xml @@ -320,7 +320,7 @@ <function name="PointSizePointerOES" es1="1.0" desktop="false" no_error="true" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POINT_SIZE);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POINT_SIZE, 1, type, stride, pointer);"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 4477f5833e3..74aeb2f1c31 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -3166,7 +3166,7 @@ <function name="ColorPointer" es1="1.0" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR0);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR0, size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> @@ -3199,7 +3199,7 @@ <function name="EdgeFlagPointer" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_EDGEFLAG);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_EDGEFLAG, 1, GL_UNSIGNED_BYTE, stride, pointer);"> <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> <glx handcode="true"/> @@ -3219,7 +3219,7 @@ <function name="IndexPointer" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR_INDEX);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR_INDEX, 1, type, stride, pointer);"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> @@ -3235,7 +3235,7 @@ <function name="NormalPointer" es1="1.0" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_NORMAL);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_NORMAL, 3, type, stride, pointer);"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> @@ -3244,7 +3244,7 @@ <function name="TexCoordPointer" es1="1.0" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture));"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture), size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> @@ -3254,7 +3254,7 @@ <function name="VertexPointer" es1="1.0" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POS);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POS, size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> @@ -4751,7 +4751,7 @@ <function name="FogCoordPointer" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_FOG);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_FOG, 1, type, stride, pointer);"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> @@ -4892,7 +4892,7 @@ <function name="SecondaryColorPointer" deprecated="3.1" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR1);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR1, size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> @@ -5853,7 +5853,7 @@ <function name="VertexAttribPointer" es2="2.0" marshal="async" no_error="true" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index));"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index), size, type, stride, pointer);"> <param name="index" type="GLuint"/> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> @@ -9251,7 +9251,7 @@ </function> <function name="ColorPointerEXT" deprecated="3.1" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR0);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR0, size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> @@ -9267,7 +9267,7 @@ </function> <function name="EdgeFlagPointerEXT" deprecated="3.1" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_EDGEFLAG);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_EDGEFLAG, 1, GL_UNSIGNED_BYTE, stride, pointer);"> <param name="stride" type="GLsizei"/> <param name="count" type="GLsizei"/> <param name="pointer" type="const GLboolean *"/> @@ -9280,7 +9280,7 @@ </function> <function name="IndexPointerEXT" deprecated="3.1" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR_INDEX);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR_INDEX, 1, type, stride, pointer);"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="count" type="GLsizei"/> @@ -9289,7 +9289,7 @@ </function> <function name="NormalPointerEXT" deprecated="3.1" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_NORMAL);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_NORMAL, 3, type, stride, pointer);"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="count" type="GLsizei"/> @@ -9298,7 +9298,7 @@ </function> <function name="TexCoordPointerEXT" deprecated="3.1" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture));"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture), size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> @@ -9308,7 +9308,7 @@ </function> <function name="VertexPointerEXT" deprecated="3.1" marshal="async" - marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POS);"> + marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POS, size, type, stride, pointer);"> <param name="size" type="GLint"/> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 64b82ac1317..c1117872dc8 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -64,6 +64,12 @@ struct glthread_vao { GLuint CurrentElementBufferName; GLbitfield Enabled; GLbitfield UserPointerMask; + + struct { + GLuint ElementSize; + GLsizei Stride; + const void *Pointer; + } Attrib[VERT_ATTRIB_MAX]; }; /** A single batch of commands queued up for execution. */ @@ -156,7 +162,12 @@ void _mesa_glthread_GenVertexArrays(struct gl_context *ctx, GLsizei n, GLuint *arrays); void _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj, gl_vert_attrib attrib, bool enable); -void _mesa_glthread_AttribPointer(struct gl_context *ctx, - gl_vert_attrib attrib); +void _mesa_glthread_AttribPointer(struct gl_context *ctx, gl_vert_attrib attrib, + GLint size, GLenum type, GLsizei stride, + const void *pointer); +void _mesa_glthread_DSAAttribPointer(struct gl_context *ctx, GLuint vao, + GLuint buffer, gl_vert_attrib attrib, + GLint size, GLenum type, GLsizei stride, + GLintptr offset); #endif /* _GLTHREAD_H*/ diff --git a/src/mesa/main/glthread_varray.c b/src/mesa/main/glthread_varray.c index fbd08f41e5a..53a973600a6 100644 --- a/src/mesa/main/glthread_varray.c +++ b/src/mesa/main/glthread_varray.c @@ -27,16 +27,14 @@ */ #include "main/glthread.h" +#include "main/glformats.h" #include "main/mtypes.h" #include "main/hash.h" #include "main/dispatch.h" /* TODO: - * - Implement better tracking of user pointers - * - These can unbind user pointers: - * ARB_vertex_attrib_binding - * ARB_direct_state_access - * EXT_direct_state_access + * - Handle GL_ARB_instanced_arrays (incl. EXT_dsa) + * - Handle ARB_vertex_attrib_binding (incl. EXT_dsa and ARB_dsa) */ static struct glthread_vao * @@ -157,14 +155,52 @@ _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj, vao->Enabled &= ~(1u << attrib); } -void -_mesa_glthread_AttribPointer(struct gl_context *ctx, gl_vert_attrib attrib) +static void +attrib_pointer(struct glthread_state *glthread, struct glthread_vao *vao, + GLuint buffer, gl_vert_attrib attrib, + GLint size, GLenum type, GLsizei stride, + const void *pointer) { - struct glthread_state *glthread = &ctx->GLThread; - struct glthread_vao *vao = glthread->CurrentVAO; + if (attrib >= VERT_ATTRIB_MAX) + return; + + unsigned elem_size = _mesa_bytes_per_vertex_attrib(size, type); + + vao->Attrib[attrib].ElementSize = elem_size; + vao->Attrib[attrib].Stride = stride ? stride : elem_size; + vao->Attrib[attrib].Pointer = pointer; - if (glthread->CurrentArrayBufferName != 0) + if (buffer != 0) vao->UserPointerMask &= ~(1u << attrib); else vao->UserPointerMask |= 1u << attrib; } + +void +_mesa_glthread_AttribPointer(struct gl_context *ctx, gl_vert_attrib attrib, + GLint size, GLenum type, GLsizei stride, + const void *pointer) +{ + struct glthread_state *glthread = &ctx->GLThread; + + attrib_pointer(glthread, glthread->CurrentVAO, + glthread->CurrentArrayBufferName, + attrib, size, type, stride, pointer); +} + +void +_mesa_glthread_DSAAttribPointer(struct gl_context *ctx, GLuint vaobj, + GLuint buffer, gl_vert_attrib attrib, + GLint size, GLenum type, GLsizei stride, + GLintptr offset) +{ + struct glthread_state *glthread = &ctx->GLThread; + struct glthread_vao *vao; + + vao = lookup_vao(ctx, vaobj); + if (!vao) + return; + + attrib_pointer(glthread, vao, buffer, attrib, size, type, stride, + (const void*)offset); +} |