From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f264494cb5f..498e2075875 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1080,7 +1080,7 @@ static struct wined3d_allocator_block *wined3d_device_gl_allocate_memory(struct *id = wined3d_allocator_chunk_gl(block->chunk)->gl_buffer;
wined3d_device_gl_allocator_unlock(device_gl); - TRACE("Allocated offset %Iu from buffer object %u.\n", block->offset, *id); + TRACE("Allocated offset %#Ix from chunk %p.\n", block->offset, block->chunk); return block; }
From: Zebediah Figura zfigura@codeweavers.com
If we subsequently try to destroy it we will decrease the chunk map_count again, which is a reference counting error. --- dlls/wined3d/context_gl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 5292297bb85..52a75c3d5ea 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2949,8 +2949,7 @@ static void wined3d_bo_gl_unmap(struct wined3d_bo_gl *bo, struct wined3d_context struct wined3d_allocator_chunk_gl *chunk_gl = wined3d_allocator_chunk_gl(bo->memory->chunk);
wined3d_allocator_chunk_gl_unmap(chunk_gl, context_gl); - if (!chunk_gl->c.map_ptr) - bo->b.map_ptr = NULL; + bo->b.map_ptr = NULL; return; }
From: Zebediah Figura zfigura@codeweavers.com
I believe this was a mistake introduced by 831ff102008e2ba93a403344646b5ed67258eaeb.
This fixes GL errors with multiple applications, including Ragnarok Online and Bloodrayne: Terminal Cut. --- dlls/wined3d/context_gl.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 52a75c3d5ea..0d80aa8596f 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2944,15 +2944,6 @@ static void wined3d_bo_gl_unmap(struct wined3d_bo_gl *bo, struct wined3d_context return; }
- if (bo->memory) - { - struct wined3d_allocator_chunk_gl *chunk_gl = wined3d_allocator_chunk_gl(bo->memory->chunk); - - wined3d_allocator_chunk_gl_unmap(chunk_gl, context_gl); - bo->b.map_ptr = NULL; - return; - } - wined3d_device_bo_map_lock(context_gl->c.device); /* The mapping is still in use by the client (viz. for an accelerated * NOOVERWRITE map). The client will trigger another unmap request when the @@ -2967,6 +2958,14 @@ static void wined3d_bo_gl_unmap(struct wined3d_bo_gl *bo, struct wined3d_context bo->b.map_ptr = NULL; wined3d_device_bo_map_unlock(context_gl->c.device);
+ if (bo->memory) + { + struct wined3d_allocator_chunk_gl *chunk_gl = wined3d_allocator_chunk_gl(bo->memory->chunk); + + wined3d_allocator_chunk_gl_unmap(chunk_gl, context_gl); + return; + } + wined3d_context_gl_bind_bo(context_gl, bo->binding, bo->id); GL_EXTCALL(glUnmapBuffer(bo->binding)); wined3d_context_gl_bind_bo(context_gl, bo->binding, 0);