wined3d: Explicitly synchronise in wined3d_context_gl_map_bo_address().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5333cd0612
commit
d52a75a795
|
@ -741,7 +741,6 @@ void * CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer)
|
|||
static void wined3d_buffer_gl_sync_apple(struct wined3d_buffer_gl *buffer_gl,
|
||||
uint32_t flags, struct wined3d_context_gl *context_gl)
|
||||
{
|
||||
struct wined3d_device_gl *device_gl = wined3d_device_gl(buffer_gl->b.resource.device);
|
||||
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
struct wined3d_bo_gl *bo = &buffer_gl->bo;
|
||||
|
||||
|
@ -759,12 +758,6 @@ static void wined3d_buffer_gl_sync_apple(struct wined3d_buffer_gl *buffer_gl,
|
|||
bo->command_fence_id = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE("Synchronizing buffer %p.\n", buffer_gl);
|
||||
|
||||
if (bo->command_fence_id == device_gl->current_fence_id)
|
||||
wined3d_context_gl_submit_command_fence(context_gl);
|
||||
wined3d_context_gl_wait_command_fence(context_gl, bo->command_fence_id);
|
||||
}
|
||||
|
||||
static void buffer_mark_used(struct wined3d_buffer *buffer)
|
||||
|
|
|
@ -2653,6 +2653,7 @@ void wined3d_context_gl_submit_command_fence(struct wined3d_context_gl *context_
|
|||
void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_bo_address *data, size_t size, uint32_t flags)
|
||||
{
|
||||
struct wined3d_device_gl *device_gl = wined3d_device_gl(context_gl->c.device);
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_bo_gl *bo;
|
||||
BYTE *memory;
|
||||
|
@ -2660,6 +2661,14 @@ void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
|
|||
if (!(bo = (struct wined3d_bo_gl *)data->buffer_object))
|
||||
return data->addr;
|
||||
|
||||
if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
||||
goto map;
|
||||
|
||||
if (bo->command_fence_id == device_gl->current_fence_id)
|
||||
wined3d_context_gl_submit_command_fence(context_gl);
|
||||
wined3d_context_gl_wait_command_fence(context_gl, bo->command_fence_id);
|
||||
|
||||
map:
|
||||
gl_info = context_gl->gl_info;
|
||||
wined3d_context_gl_bind_bo(context_gl, bo->binding, bo->id);
|
||||
|
||||
|
|
|
@ -451,11 +451,11 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
|
|||
ret |= GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
|
||||
if (d3d_flags & WINED3D_MAP_READ)
|
||||
ret |= GL_MAP_READ_BIT;
|
||||
else if (!(d3d_flags & WINED3D_MAP_DISCARD))
|
||||
ret |= GL_MAP_UNSYNCHRONIZED_BIT;
|
||||
|
||||
if (d3d_flags & WINED3D_MAP_DISCARD)
|
||||
ret |= GL_MAP_INVALIDATE_BUFFER_BIT;
|
||||
if (d3d_flags & WINED3D_MAP_NOOVERWRITE)
|
||||
ret |= GL_MAP_UNSYNCHRONIZED_BIT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue