[Mesa-dev] [PATCH 15/18] mesa: add KHR_no_error support to copy buffer subdata functions
Timothy Arceri
tarceri at itsqueeze.com
Thu May 4 07:41:40 UTC 2017
---
src/mapi/glapi/gen/ARB_copy_buffer.xml | 2 +-
src/mapi/glapi/gen/ARB_direct_state_access.xml | 2 +-
src/mesa/main/bufferobj.c | 33 ++++++++++++++++++++++++++
src/mesa/main/bufferobj.h | 9 ++++++-
4 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_copy_buffer.xml b/src/mapi/glapi/gen/ARB_copy_buffer.xml
index d1c6f1f..12e0c19 100644
--- a/src/mapi/glapi/gen/ARB_copy_buffer.xml
+++ b/src/mapi/glapi/gen/ARB_copy_buffer.xml
@@ -4,21 +4,21 @@
<!-- Note: no GLX protocol info yet. -->
<OpenGLAPI>
<category name="GL_ARB_copy_buffer" number="59">
<enum name="COPY_READ_BUFFER" value="0x8F36"/>
<enum name="COPY_WRITE_BUFFER" value="0x8F37"/>
- <function name="CopyBufferSubData" es2="3.0">
+ <function name="CopyBufferSubData" es2="3.0" no_error="true">
<param name="readTarget" type="GLenum"/>
<param name="writeTarget" type="GLenum"/>
<param name="readOffset" type="GLintptr"/>
<param name="writeOffset" type="GLintptr"/>
<param name="size" type="GLsizeiptr"/>
</function>
</category>
</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 03f6c8b..3cb486e 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -68,21 +68,21 @@
<param name="usage" type="GLenum" />
</function>
<function name="NamedBufferSubData">
<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">
+ <function name="CopyNamedBufferSubData" no_error="true">
<param name="readBuffer" type="GLuint" />
<param name="writeBuffer" type="GLuint" />
<param name="readOffset" type="GLintptr" />
<param name="writeOffset" type="GLintptr" />
<param name="size" type="GLsizeiptr" />
</function>
<function name="ClearNamedBufferData">
<param name="buffer" type="GLuint" />
<param name="internalformat" type="GLenum" />
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 6825030..f4597ed 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2311,20 +2311,38 @@ copy_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *src,
return;
}
}
dst->MinMaxCacheDirty = true;
ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset, size);
}
void GLAPIENTRY
+_mesa_CopyBufferSubData_no_error(GLenum readTarget, GLenum writeTarget,
+ GLintptr readOffset, GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_buffer_object **src_ptr = get_buffer_target(ctx, readTarget);
+ struct gl_buffer_object *src = *src_ptr;
+
+ struct gl_buffer_object **dst_ptr = get_buffer_target(ctx, writeTarget);
+ struct gl_buffer_object *dst = *dst_ptr;
+
+ dst->MinMaxCacheDirty = true;
+ ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset,
+ size);
+}
+
+void GLAPIENTRY
_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *src, *dst;
src = get_buffer(ctx, "glCopyBufferSubData", readTarget,
GL_INVALID_OPERATION);
if (!src)
@@ -2333,20 +2351,35 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
dst = get_buffer(ctx, "glCopyBufferSubData", writeTarget,
GL_INVALID_OPERATION);
if (!dst)
return;
copy_buffer_sub_data(ctx, src, dst, readOffset, writeOffset, size,
"glCopyBufferSubData");
}
void GLAPIENTRY
+_mesa_CopyNamedBufferSubData_no_error(GLuint readBuffer, GLuint writeBuffer,
+ GLintptr readOffset,
+ GLintptr writeOffset, GLsizeiptr size)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_buffer_object *src = _mesa_lookup_bufferobj(ctx, readBuffer);
+ struct gl_buffer_object *dst = _mesa_lookup_bufferobj(ctx, writeBuffer);
+
+ dst->MinMaxCacheDirty = true;
+ ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset,
+ size);
+}
+
+void GLAPIENTRY
_mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *src, *dst;
src = _mesa_lookup_bufferobj_err(ctx, readBuffer,
"glCopyNamedBufferSubData");
if (!src)
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 606582e..797ebe0 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -244,27 +244,34 @@ _mesa_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);
void GLAPIENTRY
_mesa_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname,
GLint64 *params);
void GLAPIENTRY
_mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params);
void GLAPIENTRY
_mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params);
-
+void GLAPIENTRY
+_mesa_CopyBufferSubData_no_error(GLenum readTarget, GLenum writeTarget,
+ GLintptr readOffset, GLintptr writeOffset,
+ GLsizeiptr size);
void GLAPIENTRY
_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
void GLAPIENTRY
+_mesa_CopyNamedBufferSubData_no_error(GLuint readBuffer, GLuint writeBuffer,
+ GLintptr readOffset,
+ GLintptr writeOffset, GLsizeiptr size);
+void GLAPIENTRY
_mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
void * GLAPIENTRY
_mesa_MapBufferRange_no_error(GLenum target, GLintptr offset,
GLsizeiptr length, GLbitfield access);
void * GLAPIENTRY
_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
GLbitfield access);
--
2.9.3
More information about the mesa-dev
mailing list