[Mesa-dev] [PATCH 04/17] mesa: add KHR_no_error support for glBufferStorage()
Timothy Arceri
tarceri at itsqueeze.com
Mon May 15 06:19:13 UTC 2017
---
src/mapi/glapi/gen/gl_API.xml | 2 +-
src/mesa/main/bufferobj.c | 20 +++++++++++++++++---
src/mesa/main/bufferobj.h | 3 +++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 1a3b306..8afd5ec 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8255,21 +8255,21 @@
<category name="GL_ARB_buffer_storage" number="144">
<enum name="MAP_PERSISTENT_BIT" value="0x40" />
<enum name="MAP_COHERENT_BIT" value="0x80" />
<enum name="DYNAMIC_STORAGE_BIT" value="0x100" />
<enum name="CLIENT_STORAGE_BIT" value="0x200" />
<enum name="BUFFER_IMMUTABLE_STORAGE" value="0x821F" />
<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 *"/>
<param name="flags" type="GLbitfield"/>
</function>
</category>
<xi:include href="ARB_clear_texture.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- ARB extension #146 -->
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 09ef233..674ff63 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1602,31 +1602,45 @@ inlined_buffer_storage(GLenum target, GLuint buffer, GLsizeiptr size,
if (dsa) {
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 (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))
buffer_storage(ctx, bufObj, target, size, data, flags, func);
}
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)
{
inlined_buffer_storage(target, 0, size, data, flags, false, false,
"glBufferStorage");
}
void GLAPIENTRY
_mesa_NamedBufferStorage_no_error(GLuint buffer, GLsizeiptr size,
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index a06a0e4..024d07d 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -165,20 +165,23 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint * buffer);
void GLAPIENTRY
_mesa_GenBuffers(GLsizei n, GLuint *buffers);
void GLAPIENTRY
_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);
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);
--
2.9.3
More information about the mesa-dev
mailing list