[Mesa-dev] [PATCH 03/17] mesa: add KHR_no_error support for glNamedBufferStorage()
Timothy Arceri
tarceri at itsqueeze.com
Mon May 15 06:19:12 UTC 2017
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 2 +-
src/mesa/main/bufferobj.c | 31 ++++++++++++++++++++------
src/mesa/main/bufferobj.h | 3 +++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 43e4e05..fa375e0 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -47,21 +47,21 @@
<param name="param" type="GLint64 *" />
</function>
<!-- Buffer object functions -->
<function name="CreateBuffers">
<param name="n" type="GLsizei" />
<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 *" />
<param name="flags" type="GLbitfield" />
</function>
<function name="NamedBufferData">
<param name="buffer" type="GLuint" />
<param name="size" type="GLsizeiptr" />
<param name="data" type="const GLvoid *" />
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 4afa2ee..09ef233 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1588,56 +1588,73 @@ buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
}
}
}
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);
}
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)
{
/* 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");
}
void
_mesa_buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
GLenum target, GLsizeiptr size, const GLvoid *data,
GLenum usage, const char *func)
{
bool valid_usage;
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 926ffb4..a06a0e4 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -169,20 +169,23 @@ void GLAPIENTRY
_mesa_CreateBuffers(GLsizei n, GLuint *buffers);
GLboolean GLAPIENTRY
_mesa_IsBuffer(GLuint buffer);
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);
void GLAPIENTRY
_mesa_BufferData(GLenum target, GLsizeiptr size,
const GLvoid *data, GLenum usage);
void GLAPIENTRY
_mesa_NamedBufferData(GLuint buffer, GLsizeiptr size,
const GLvoid *data, GLenum usage);
--
2.9.3
More information about the mesa-dev
mailing list