mesa: add glInternalBufferSubDataCopyMESA for glthread

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4314>
This commit is contained in:
Marek Olšák
2020-03-06 20:19:11 -05:00
committed by Marge Bot
parent 3707cef4fb
commit a82889e537
7 changed files with 66 additions and 1 deletions
+13
View File
@@ -13286,6 +13286,19 @@
</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"/>
+1
View File
@@ -32,6 +32,7 @@ import sys
header = """
#include "api_exec.h"
#include "glthread_marshal.h"
#include "bufferobj.h"
#include "dispatch.h"
#define COMPAT (ctx->API != API_OPENGL_CORE)
+1
View File
@@ -1643,6 +1643,7 @@ offsets = {
"CopyImageSubDataNV": 1607,
"ViewportSwizzleNV": 1608,
"AlphaToCoverageDitherControlNV": 1609,
"InternalBufferSubDataCopyMESA": 1610,
}
functions = [
+41
View File
@@ -3159,6 +3159,47 @@ _mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
"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,
+5
View File
@@ -359,6 +359,11 @@ void GLAPIENTRY
_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,
+4
View File
@@ -1442,6 +1442,8 @@ const struct function common_desktop_functions_possible[] = {
/* GL_NV_viewport_swizzle */
{ "glViewportSwizzleNV", 11, -1 },
{ "glInternalBufferSubDataCopyMESA", 11, -1 },
{ NULL, 0, -1 }
};
@@ -2457,6 +2459,8 @@ const struct function gles2_functions_possible[] = {
/* GL_KHR_parallel_shader_compile */
{ "glMaxShaderCompilerThreadsKHR", 20, -1 },
{ "glInternalBufferSubDataCopyMESA", 20, -1 },
{ NULL, 0, -1 }
};
+1 -1
View File
@@ -605,7 +605,7 @@ st_copy_buffer_subdata(struct gl_context *ctx,
/* 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);