X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fvarray.h;h=4e4bd5f80a7c6d8baeaaad12148180a9279eca7c;hb=b8939fd3d1544f9dd24404a4f768797f99e5efc1;hp=3b9f39a61df9b974051479e8174ed40e74635f58;hpb=5f22f3207e298f53aaf8c965a39f758578a28600;p=mesa.git diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 3b9f39a61df..4e4bd5f80a7 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -34,39 +34,6 @@ struct gl_client_array; struct gl_context; - -/** - * Compute the index of the last array element that can be safely accessed in - * a vertex array. We can really only do this when the array lives in a VBO. - * The array->_MaxElement field will be updated. - * Later in glDrawArrays/Elements/etc we can do some bounds checking. - */ -static inline void -_mesa_update_array_max_element(struct gl_client_array *array) -{ - assert(array->Enabled); - - if (array->BufferObj->Name) { - GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr; - GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size; - - if (offset < bufSize) { - const GLuint stride = array->StrideB ? - array->StrideB : array->_ElementSize; - array->_MaxElement = (bufSize - offset + stride - - array->_ElementSize) / stride; - } - else { - array->_MaxElement = 0; - } - } - else { - /* user-space array, no idea how big it is */ - array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ - } -} - - /** * Returns a pointer to the vertex attribute data in a client array, * or the offset into the vertex buffer for an array that resides in @@ -106,16 +73,26 @@ _mesa_update_client_array(struct gl_context *ctx, _mesa_reference_buffer_object(ctx, &dst->BufferObj, binding->BufferObj); } +static inline bool +_mesa_attr_zero_aliases_vertex(struct gl_context *ctx) +{ + const bool is_forward_compatible_context = + ctx->Const.ContextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; + + /* In OpenGL 3.1 attribute 0 becomes non-magic, just like in OpenGL ES + * 2.0. Note that we cannot just check for API_OPENGL_COMPAT here because + * that will erroneously allow this usage in a 3.0 forward-compatible + * context too. + */ + return (ctx->API == API_OPENGLES + || (ctx->API == API_OPENGL_COMPAT + && !is_forward_compatible_context)); +} + extern void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); -extern void GLAPIENTRY -_mesa_UnlockArraysEXT( void ); - -extern void GLAPIENTRY -_mesa_LockArraysEXT(GLint first, GLsizei count); - extern void GLAPIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr); @@ -261,6 +238,10 @@ _mesa_UnlockArraysEXT( void ); extern void GLAPIENTRY _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count); +extern void GLAPIENTRY +_mesa_DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, + GLsizei primcount); + extern void GLAPIENTRY _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); @@ -296,6 +277,10 @@ extern void GLAPIENTRY _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, GLsizei stride); +extern void GLAPIENTRY +_mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, + const GLintptr *offsets, const GLsizei *strides); + extern void GLAPIENTRY _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLuint relativeOffset);