mesa: add KHR_no_error support for glBindVertexBuffer()
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 22 May 2017 05:46:54 +0000 (15:46 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 29 May 2017 22:03:32 +0000 (08:03 +1000)
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
src/mesa/main/varray.c
src/mesa/main/varray.h

index ba9ca57bb54216531ade0cb886de1a4643036d37..101c23c53b5b2181e974fd89fb48651d1ae7102b 100644 (file)
@@ -7,7 +7,7 @@
 
 <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"/>
index f33f3022061dcaa1cf6a8c498731758382d0c16e..df14a8b765cbaf7433a3943d42283d18418c050d 100644 (file)
@@ -1953,7 +1953,7 @@ 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 ==
@@ -1962,7 +1962,7 @@ vertex_array_vertex_buffer(struct gl_context *ctx,
    } 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;
       }
@@ -2043,7 +2043,18 @@ vertex_array_vertex_buffer_err(struct gl_context *ctx,
    }
 
    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");
 }
 
 
index 2d184adf8bc0c8f380193c106bd55b79b1b140bb..c3cd5d207c438935af3559943edd02423ddb3054 100644 (file)
@@ -360,6 +360,9 @@ _mesa_primitive_restart_index(const struct gl_context *ctx,
    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);