[Mesa-dev] [PATCH 07/17] mesa: add KHR_no_error support for glNamedBufferSubData()
Timothy Arceri
tarceri at itsqueeze.com
Mon May 15 06:19:16 UTC 2017
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 2 +-
src/mesa/main/bufferobj.c | 27 +++++++++++++++++++-------
src/mesa/main/bufferobj.h | 3 +++
3 files changed, 24 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 fa375e0..b8780f7 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -61,21 +61,21 @@
<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 *" />
<param name="usage" type="GLenum" />
</function>
- <function name="NamedBufferSubData">
+ <function name="NamedBufferSubData" no_error="true">
<param name="buffer" type="GLuint" />
<param name="offset" type="GLintptr" />
<param name="size" type="GLsizeiptr" />
<param name="data" type="const GLvoid *" />
</function>
<function name="CopyNamedBufferSubData" no_error="true">
<param name="readBuffer" type="GLuint" />
<param name="writeBuffer" type="GLuint" />
<param name="readOffset" type="GLintptr" />
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e53adb3..3e903cb 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1851,52 +1851,65 @@ _mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
bufObj->MinMaxCacheDirty = true;
assert(ctx->Driver.BufferSubData);
ctx->Driver.BufferSubData(ctx, offset, size, data, bufObj);
}
static ALWAYS_INLINE void
buffer_sub_data(GLenum target, GLuint buffer, GLintptr offset,
GLsizeiptr size, const GLvoid *data,
- bool dsa, const char *func)
+ bool dsa, 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_sub_data(ctx, bufObj, offset, size, func))
+ if (no_error || validate_buffer_sub_data(ctx, bufObj, offset, size, func))
_mesa_buffer_sub_data(ctx, bufObj, offset, size, data);
}
void GLAPIENTRY
_mesa_BufferSubData(GLenum target, GLintptr offset,
GLsizeiptr size, const GLvoid *data)
{
- buffer_sub_data(target, 0, offset, size, data, false, "glBufferSubData");
+ buffer_sub_data(target, 0, offset, size, data, false, false,
+ "glBufferSubData");
+}
+
+void GLAPIENTRY
+_mesa_NamedBufferSubData_no_error(GLuint buffer, GLintptr offset,
+ GLsizeiptr size, const GLvoid *data)
+{
+ buffer_sub_data(0, buffer, offset, size, data, true, true,
+ "glNamedBufferSubData");
}
void GLAPIENTRY
_mesa_NamedBufferSubData(GLuint buffer, GLintptr offset,
GLsizeiptr size, const GLvoid *data)
{
- buffer_sub_data(0, buffer, offset, size, data, true,
+ buffer_sub_data(0, buffer, offset, size, data, true, false,
"glNamedBufferSubData");
}
void GLAPIENTRY
_mesa_GetBufferSubData(GLenum target, GLintptr offset,
GLsizeiptr size, GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index a7a9673..b3cfcc0 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -190,20 +190,23 @@ _mesa_BufferData(GLenum target, GLsizeiptr size,
void GLAPIENTRY
_mesa_NamedBufferData(GLuint buffer, GLsizeiptr size,
const GLvoid *data, GLenum usage);
void GLAPIENTRY
_mesa_BufferSubData(GLenum target, GLintptr offset,
GLsizeiptr size, const GLvoid *data);
void GLAPIENTRY
+_mesa_NamedBufferSubData_no_error(GLuint buffer, GLintptr offset,
+ GLsizeiptr size, const GLvoid *data);
+void GLAPIENTRY
_mesa_NamedBufferSubData(GLuint buffer, GLintptr offset,
GLsizeiptr size, const GLvoid *data);
void GLAPIENTRY
_mesa_GetBufferSubData(GLenum target, GLintptr offset,
GLsizeiptr size, GLvoid *data);
void GLAPIENTRY
_mesa_GetNamedBufferSubData(GLuint buffer, GLintptr offset,
GLsizeiptr size, GLvoid *data);
--
2.9.3
More information about the mesa-dev
mailing list