[Mesa-dev] [PATCH 02/10] mesa: add KHR_no_error support for glBindVertexBuffer()
Timothy Arceri
tarceri at itsqueeze.com
Mon May 22 05:46:54 UTC 2017
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml | 2 +-
src/mesa/main/varray.c | 17 ++++++++++++++---
src/mesa/main/varray.h | 3 +++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml b/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
index ba9ca57..101c23c 100644
--- a/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
+++ b/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
@@ -1,20 +1,20 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
<!-- Note: no GLX protocol info yet. -->
<OpenGLAPI>
<category name="GL_ARB_vertex_attrib_binding" number="125">
- <function name="BindVertexBuffer" es2="3.1">
+ <function name="BindVertexBuffer" es2="3.1" no_error="true">
<param name="bindingindex" type="GLuint"/>
<param name="buffer" type="GLuint"/>
<param name="offset" type="GLintptr"/>
<param name="stride" type="GLsizei"/>
</function>
<function name="VertexAttribFormat" es2="3.1">
<param name="attribindex" type="GLuint"/>
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index f33f302..df14a8b 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1946,30 +1946,30 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
*/
vertex_attrib_binding(ctx, vao, genericIndex, genericIndex);
vertex_binding_divisor(ctx, vao, genericIndex, divisor);
}
static ALWAYS_INLINE void
vertex_array_vertex_buffer(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint bindingIndex, GLuint buffer, GLintptr offset,
- GLsizei stride, const char *func)
+ GLsizei stride, bool no_error, const char *func)
{
struct gl_buffer_object *vbo;
if (buffer ==
vao->BufferBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) {
vbo = vao->BufferBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj;
} else if (buffer != 0) {
vbo = _mesa_lookup_bufferobj(ctx, buffer);
- if (!vbo && _mesa_is_gles31(ctx)) {
+ if (!no_error && !vbo && _mesa_is_gles31(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", func);
return;
}
/* From the GL_ARB_vertex_attrib_array spec:
*
* "[Core profile only:]
* An INVALID_OPERATION error is generated if buffer is not zero or a
* name returned from a previous call to GenBuffers, or if such a name
* has since been deleted with DeleteBuffers.
*
@@ -2036,21 +2036,32 @@ vertex_array_vertex_buffer_err(struct gl_context *ctx,
}
if (((ctx->API == API_OPENGL_CORE && ctx->Version >= 44) || _mesa_is_gles31(ctx)) &&
stride > ctx->Const.MaxVertexAttribStride) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(stride=%d > "
"GL_MAX_VERTEX_ATTRIB_STRIDE)", func, stride);
return;
}
vertex_array_vertex_buffer(ctx, vao, bindingIndex, buffer, offset,
- stride, func);
+ stride, false, func);
+}
+
+
+void GLAPIENTRY
+_mesa_BindVertexBuffer_no_error(GLuint bindingIndex, GLuint buffer,
+ GLintptr offset, GLsizei stride)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ vertex_array_vertex_buffer(ctx, ctx->Array.VAO, bindingIndex,
+ buffer, offset, stride, true,
+ "glBindVertexBuffer");
}
void GLAPIENTRY
_mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
GLsizei stride)
{
GET_CURRENT_CONTEXT(ctx);
/* The ARB_vertex_attrib_binding spec says:
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 2d184ad..c3cd5d2 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -354,20 +354,23 @@ _mesa_primitive_restart_index(const struct gl_context *ctx,
*/
if (ctx->Array.PrimitiveRestartFixedIndex) {
/* 1 -> 0xff, 2 -> 0xffff, 4 -> 0xffffffff */
return 0xffffffffu >> 8 * (4 - index_size);
}
return ctx->Array.RestartIndex;
}
extern void GLAPIENTRY
+_mesa_BindVertexBuffer_no_error(GLuint bindingIndex, GLuint buffer,
+ GLintptr offset, GLsizei stride);
+extern void GLAPIENTRY
_mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
GLsizei stride);
extern void GLAPIENTRY
_mesa_VertexArrayVertexBuffer(GLuint vaobj, 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);
--
2.9.4
More information about the mesa-dev
mailing list