Commit 69a73009 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Write into a mapped BO when replacing the entire destination in…

wined3d: Write into a mapped BO when replacing the entire destination in wined3d_context_gl_copy_bo_address(). Instead of using glBufferSubData(). In practice, this means that we will either discard and rename the BO (if it's still in use) or write directly into it (if not). This improves performance drastically on NVidia GL drivers. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53408
parent 19c3e1d4
......@@ -3118,14 +3118,23 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
}
else if (dst_bo && !src_bo)
{
wined3d_context_gl_bind_bo(context_gl, dst_bo->binding, dst_bo->id);
for (i = 0; i < range_count; ++i)
GL_EXTCALL(glBufferSubData(dst_bo->binding,
dst_bo->b.buffer_offset + (GLintptr)dst->addr + ranges[i].offset,
ranges[i].size, src->addr + ranges[i].offset));
checkGLcall("buffer upload");
if ((map_flags & WINED3D_MAP_DISCARD) && (dst_bo->flags & GL_MAP_WRITE_BIT))
{
dst_ptr = wined3d_context_gl_map_bo_address(context_gl, dst, dst_bo->size, map_flags);
memcpy(dst_ptr, src->addr, dst_bo->size);
wined3d_context_gl_unmap_bo_address(context_gl, dst, range_count, ranges);
}
else
{
wined3d_context_gl_bind_bo(context_gl, dst_bo->binding, dst_bo->id);
for (i = 0; i < range_count; ++i)
GL_EXTCALL(glBufferSubData(dst_bo->binding,
dst_bo->b.buffer_offset + (GLintptr)dst->addr + ranges[i].offset,
ranges[i].size, src->addr + ranges[i].offset));
checkGLcall("buffer upload");
wined3d_context_gl_reference_bo(context_gl, dst_bo);
wined3d_context_gl_reference_bo(context_gl, dst_bo);
}
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment