mesa: add KHR_no_error support for glNamedBufferStorage()
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 12 May 2017 06:43:30 +0000 (16:43 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 17 May 2017 00:12:03 +0000 (10:12 +1000)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h

index 43e4e05b10f5ef3faf0b5c295822fac3f588ef8c..fa375e0e7a22cdd3ef7ce1b7b9b86e63b14f7f59 100644 (file)
@@ -54,7 +54,7 @@
       <param name="buffers" type="GLuint *" />
    </function>
 
-   <function name="NamedBufferStorage">
+   <function name="NamedBufferStorage" no_error="true">
       <param name="buffer" type="GLuint" />
       <param name="size" type="GLsizeiptr" />
       <param name="data" type="const GLvoid *" />
index 4afa2ee67798f705039c20755adbc266aaa9c3f6..09ef233a8359dfd3811570f52e3b7475df96943e 100644 (file)
@@ -1595,22 +1595,26 @@ buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,
 static ALWAYS_INLINE void
 inlined_buffer_storage(GLenum target, GLuint buffer, GLsizeiptr size,
                        const GLvoid *data, GLbitfield flags, bool dsa,
-                       const char *func)
+                       bool no_error, const char *func)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_buffer_object *bufObj;
 
    if (dsa) {
-      bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
-      if (!bufObj)
-         return;
+      if (no_error) {
+         bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+      } else {
+         bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
+         if (!bufObj)
+            return;
+      }
    } else {
       bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION);
       if (!bufObj)
          return;
    }
 
-   if (validate_buffer_storage(ctx, bufObj, size, flags, func))
+   if (no_error || validate_buffer_storage(ctx, bufObj, size, flags, func))
       buffer_storage(ctx, bufObj, target, size, data, flags, func);
 }
 
@@ -1619,10 +1623,23 @@ void GLAPIENTRY
 _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
                     GLbitfield flags)
 {
-   inlined_buffer_storage(target, 0, size, data, flags, false,
+   inlined_buffer_storage(target, 0, size, data, flags, false, false,
                           "glBufferStorage");
 }
 
+
+void GLAPIENTRY
+_mesa_NamedBufferStorage_no_error(GLuint buffer, GLsizeiptr size,
+                                  const GLvoid *data, GLbitfield flags)
+{
+   /* In direct state access, buffer objects have an unspecified target
+    * since they are not required to be bound.
+    */
+   inlined_buffer_storage(GL_NONE, buffer, size, data, flags, true, true,
+                          "glNamedBufferStorage");
+}
+
+
 void GLAPIENTRY
 _mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid *data,
                          GLbitfield flags)
@@ -1630,7 +1647,7 @@ _mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid *data,
    /* In direct state access, buffer objects have an unspecified target
     * since they are not required to be bound.
     */
-   inlined_buffer_storage(GL_NONE, buffer, size, data, flags, true,
+   inlined_buffer_storage(GL_NONE, buffer, size, data, flags, true, false,
                           "glNamedBufferStorage");
 }
 
index 926ffb4faf2b57a94fa027ec6b3812f36f200cd3..a06a0e470bd5cd4520c964cecf3eae6dcbd3abb9 100644 (file)
@@ -176,6 +176,9 @@ _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
                     GLbitfield flags);
 
 void GLAPIENTRY
+_mesa_NamedBufferStorage_no_error(GLuint buffer, GLsizeiptr size,
+                                  const GLvoid *data, GLbitfield flags);
+void GLAPIENTRY
 _mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid *data,
                          GLbitfield flags);