mesa: add KHR_no_error support for glBufferStorage()
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 12 May 2017 06:51:24 +0000 (16:51 +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/gl_API.xml
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h

index 1a3b306c03cf2742c0efe2fcb039e3e18a34a9e5..8afd5ec5138a81d975b7adb09a68ccd377c10123 100644 (file)
     <enum name="BUFFER_STORAGE_FLAGS" value="0x8220" />
     <enum name="CLIENT_MAPPED_BUFFER_BARRIER_BIT" value="0x4000" />
 
-    <function name="BufferStorage">
+    <function name="BufferStorage" no_error="true">
         <param name="target" type="GLenum"/>
         <param name="size" type="GLsizeiptr"/>
         <param name="data" type="const GLvoid *"/>
index 09ef233a8359dfd3811570f52e3b7475df96943e..674ff630cd68b7f990aa59b262b0819b9414ae1a 100644 (file)
@@ -1609,9 +1609,14 @@ inlined_buffer_storage(GLenum target, GLuint buffer, GLsizeiptr size,
             return;
       }
    } else {
-      bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION);
-      if (!bufObj)
-         return;
+      if (no_error) {
+         struct gl_buffer_object **bufObjPtr = get_buffer_target(ctx, target);
+         bufObj = *bufObjPtr;
+      } else {
+         bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION);
+         if (!bufObj)
+            return;
+      }
    }
 
    if (no_error || validate_buffer_storage(ctx, bufObj, size, flags, func))
@@ -1619,6 +1624,15 @@ inlined_buffer_storage(GLenum target, GLuint buffer, GLsizeiptr size,
 }
 
 
+void GLAPIENTRY
+_mesa_BufferStorage_no_error(GLenum target, GLsizeiptr size,
+                             const GLvoid *data, GLbitfield flags)
+{
+   inlined_buffer_storage(target, 0, size, data, flags, false, true,
+                          "glBufferStorage");
+}
+
+
 void GLAPIENTRY
 _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
                     GLbitfield flags)
index a06a0e470bd5cd4520c964cecf3eae6dcbd3abb9..024d07daaf8352a85e8f393d67028a580973f88e 100644 (file)
@@ -171,6 +171,9 @@ _mesa_CreateBuffers(GLsizei n, GLuint *buffers);
 GLboolean GLAPIENTRY
 _mesa_IsBuffer(GLuint buffer);
 
+void GLAPIENTRY
+_mesa_BufferStorage_no_error(GLenum target, GLsizeiptr size,
+                             const GLvoid *data, GLbitfield flags);
 void GLAPIENTRY
 _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
                     GLbitfield flags);