</function>
</category>
+<category name="GL_MESA_internal_functions">
+ <!-- Internal function for glthread to implement BufferSubData as a GPU copy. -->
+ <function name="InternalBufferSubDataCopyMESA" es2="2.0">
+ <param name="srcBuffer" type="GLintptr"/> <!-- "struct gl_buffer_object *" really -->
+ <param name="srcOffset" type="GLuint"/>
+ <param name="dstTargetOrName" type="GLuint"/>
+ <param name="dstOffset" type="GLintptr"/>
+ <param name="size" type="GLsizeiptr"/>
+ <param name="named" type="GLboolean"/>
+ <param name="ext_dsa" type="GLboolean"/>
+ </function>
+</category>
+
<xi:include href="OES_EGL_image.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="EXT_EGL_image_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
header = """
#include "api_exec.h"
#include "glthread_marshal.h"
+#include "bufferobj.h"
#include "dispatch.h"
#define COMPAT (ctx->API != API_OPENGL_CORE)
"CopyImageSubDataNV": 1607,
"ViewportSwizzleNV": 1608,
"AlphaToCoverageDitherControlNV": 1609,
+ "InternalBufferSubDataCopyMESA": 1610,
}
functions = [
"glCopyNamedBufferSubData");
}
+void GLAPIENTRY
+_mesa_InternalBufferSubDataCopyMESA(GLintptr srcBuffer, GLuint srcOffset,
+ GLuint dstTargetOrName, GLintptr dstOffset,
+ GLsizeiptr size, GLboolean named,
+ GLboolean ext_dsa)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *src = (struct gl_buffer_object *)srcBuffer;
+ struct gl_buffer_object *dst;
+ const char *func;
+
+ /* Handle behavior for all 3 variants. */
+ if (named && ext_dsa) {
+ func = "glNamedBufferSubDataEXT";
+ dst = _mesa_lookup_bufferobj(ctx, dstTargetOrName);
+ if (!_mesa_handle_bind_buffer_gen(ctx, dstTargetOrName, &dst, func))
+ goto done;
+ } else if (named) {
+ func = "glNamedBufferSubData";
+ dst = _mesa_lookup_bufferobj_err(ctx, dstTargetOrName, func);
+ if (!dst)
+ goto done;
+ } else {
+ assert(!ext_dsa);
+ func = "glBufferSubData";
+ dst = get_buffer(ctx, func, dstTargetOrName, GL_INVALID_OPERATION);
+ if (!dst)
+ goto done;
+ }
+
+ if (!validate_buffer_sub_data(ctx, dst, dstOffset, size, func))
+ goto done; /* the error is already set */
+
+ dst->MinMaxCacheDirty = true;
+ ctx->Driver.CopyBufferSubData(ctx, src, dst, srcOffset, dstOffset, size);
+
+done:
+ /* The caller passes the reference to this function, so unreference it. */
+ _mesa_reference_buffer_object(ctx, &src, NULL);
+}
+
static bool
validate_map_buffer_range(struct gl_context *ctx,
struct gl_buffer_object *bufObj, GLintptr offset,
_mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
+void GLAPIENTRY
+_mesa_InternalBufferSubDataCopyMESA(GLintptr srcBuffer, GLuint srcOffset,
+ GLuint dstTargetOrName, GLintptr dstOffset,
+ GLsizeiptr size, GLboolean named,
+ GLboolean ext_dsa);
void * GLAPIENTRY
_mesa_MapBufferRange_no_error(GLenum target, GLintptr offset,
/* GL_NV_viewport_swizzle */
{ "glViewportSwizzleNV", 11, -1 },
+ { "glInternalBufferSubDataCopyMESA", 11, -1 },
+
{ NULL, 0, -1 }
};
/* GL_KHR_parallel_shader_compile */
{ "glMaxShaderCompilerThreadsKHR", 20, -1 },
+ { "glInternalBufferSubDataCopyMESA", 20, -1 },
+
{ NULL, 0, -1 }
};
/* buffer should not already be mapped */
assert(!_mesa_check_disallowed_mapping(src));
- assert(!_mesa_check_disallowed_mapping(dst));
+ /* dst can be mapped, just not the same range as the target range */
u_box_1d(readOffset, size, &box);