wined3d: Use explicit flushing in wined3d_context_gl_unmap_bo_address().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2bc6941ab0
commit
c2f0ae50b4
|
@ -4599,8 +4599,8 @@ static void *adapter_gl_map_bo_address(struct wined3d_context *context,
|
|||
return wined3d_context_gl_map_bo_address(context_gl, data, size, binding, map_flags);
|
||||
}
|
||||
|
||||
static void adapter_gl_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, uint32_t bind_flags)
|
||||
static void adapter_gl_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
||||
uint32_t bind_flags, unsigned int range_count, const struct wined3d_map_range *ranges)
|
||||
{
|
||||
struct wined3d_context_gl *context_gl;
|
||||
GLenum binding;
|
||||
|
@ -4608,7 +4608,7 @@ static void adapter_gl_unmap_bo_address(struct wined3d_context *context,
|
|||
context_gl = wined3d_context_gl(context);
|
||||
binding = wined3d_buffer_gl_binding_from_bind_flags(context_gl->gl_info, bind_flags);
|
||||
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, data, binding);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, data, binding, range_count, ranges);
|
||||
}
|
||||
|
||||
static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
|
|
|
@ -483,8 +483,8 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
|
|||
return data->addr;
|
||||
}
|
||||
|
||||
static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, uint32_t bind_flags)
|
||||
static void adapter_vk_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
||||
uint32_t bind_flags, unsigned int range_count, const struct wined3d_map_range *ranges)
|
||||
{
|
||||
if (data->buffer_object)
|
||||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
|
|
|
@ -2610,8 +2610,8 @@ void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
|
|||
|
||||
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
|
||||
{
|
||||
GLbitfield map_flags = wined3d_resource_gl_map_flags(flags) & ~GL_MAP_FLUSH_EXPLICIT_BIT;
|
||||
memory = GL_EXTCALL(glMapBufferRange(binding, (INT_PTR)data->addr, size, map_flags));
|
||||
memory = GL_EXTCALL(glMapBufferRange(binding, (INT_PTR)data->addr,
|
||||
size, wined3d_resource_gl_map_flags(flags)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2625,16 +2625,26 @@ void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
|
|||
return memory;
|
||||
}
|
||||
|
||||
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_bo_address *data, GLenum binding)
|
||||
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl, const struct wined3d_bo_address *data,
|
||||
GLenum binding, unsigned int range_count, const struct wined3d_map_range *ranges)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
unsigned int i;
|
||||
|
||||
if (!data->buffer_object)
|
||||
return;
|
||||
|
||||
gl_info = context_gl->gl_info;
|
||||
wined3d_context_gl_bind_bo(context_gl, binding, data->buffer_object);
|
||||
|
||||
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
|
||||
{
|
||||
for (i = 0; i < range_count; ++i)
|
||||
{
|
||||
GL_EXTCALL(glFlushMappedBufferRange(binding, (UINT_PTR)data->addr + ranges[i].offset, ranges[i].size));
|
||||
}
|
||||
}
|
||||
|
||||
GL_EXTCALL(glUnmapBuffer(binding));
|
||||
wined3d_context_gl_bind_bo(context_gl, binding, 0);
|
||||
checkGLcall("Unmap buffer object");
|
||||
|
@ -2645,6 +2655,7 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
|
|||
const struct wined3d_bo_address *src, GLenum src_binding, size_t size)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_map_range range;
|
||||
BYTE *dst_ptr, *src_ptr;
|
||||
|
||||
gl_info = context_gl->gl_info;
|
||||
|
@ -2666,8 +2677,10 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
|
|||
|
||||
memcpy(dst_ptr, src_ptr, size);
|
||||
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, dst, dst_binding);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, src, src_binding);
|
||||
range.offset = 0;
|
||||
range.size = size;
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, dst, dst_binding, 1, &range);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, src, src_binding, 0, NULL);
|
||||
}
|
||||
}
|
||||
else if (!dst->buffer_object && src->buffer_object)
|
||||
|
|
|
@ -2365,8 +2365,8 @@ static void *adapter_no3d_map_bo_address(struct wined3d_context *context,
|
|||
return data->addr;
|
||||
}
|
||||
|
||||
static void adapter_no3d_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, uint32_t bind_flags)
|
||||
static void adapter_no3d_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
||||
uint32_t bind_flags, unsigned int range_count, const struct wined3d_map_range *ranges)
|
||||
{
|
||||
if (data->buffer_object)
|
||||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
|
|
|
@ -648,6 +648,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
{
|
||||
unsigned int dst_row_pitch, dst_slice_pitch;
|
||||
struct wined3d_bo_address dst_data;
|
||||
struct wined3d_map_range range;
|
||||
const BYTE *src;
|
||||
BYTE *dst;
|
||||
|
||||
|
@ -664,9 +665,11 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
|
||||
conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
|
||||
|
||||
range.offset = 0;
|
||||
range.size = dst_texture->sub_resources[0].size;
|
||||
wined3d_texture_invalidate_location(dst_texture, 0, ~map_binding);
|
||||
wined3d_context_unmap_bo_address(context, &dst_data, 0);
|
||||
wined3d_context_unmap_bo_address(context, &src_data, 0);
|
||||
wined3d_context_unmap_bo_address(context, &dst_data, 0, 1, &range);
|
||||
wined3d_context_unmap_bo_address(context, &src_data, 0, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1634,6 +1637,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
unsigned int src_fmt_flags, dst_fmt_flags;
|
||||
struct wined3d_map_desc dst_map, src_map;
|
||||
unsigned int x, sx, xinc, y, sy, yinc;
|
||||
struct wined3d_map_range dst_range;
|
||||
struct wined3d_context *context;
|
||||
unsigned int texture_level;
|
||||
HRESULT hr = WINED3D_OK;
|
||||
|
@ -1650,6 +1654,8 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
dst_range.offset = 0;
|
||||
dst_range.size = dst_texture->sub_resources[dst_sub_resource_idx].size;
|
||||
if (src_texture == dst_texture && src_sub_resource_idx == dst_sub_resource_idx)
|
||||
{
|
||||
same_sub_resource = TRUE;
|
||||
|
@ -2083,9 +2089,9 @@ error:
|
|||
FIXME(" Unsupported flags %#x.\n", flags);
|
||||
|
||||
release:
|
||||
wined3d_context_unmap_bo_address(context, &dst_data, 0);
|
||||
wined3d_context_unmap_bo_address(context, &dst_data, 0, 1, &dst_range);
|
||||
if (!same_sub_resource)
|
||||
wined3d_context_unmap_bo_address(context, &src_data, 0);
|
||||
wined3d_context_unmap_bo_address(context, &src_data, 0, 0, NULL);
|
||||
if (SUCCEEDED(hr) && dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
|
||||
{
|
||||
SetRect(&dst_texture->swapchain->front_buffer_update,
|
||||
|
@ -2107,6 +2113,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
struct wined3d_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_bo_address data;
|
||||
struct wined3d_map_range range;
|
||||
struct wined3d_map_desc map;
|
||||
DWORD map_binding;
|
||||
uint8_t *dst;
|
||||
|
@ -2161,6 +2168,8 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
+ (box->front * map.slice_pitch)
|
||||
+ ((box->top / view->format->block_height) * map.row_pitch)
|
||||
+ ((box->left / view->format->block_width) * view->format->block_byte_count);
|
||||
range.offset = 0;
|
||||
range.size = texture->sub_resources[view->sub_resource_idx].size;
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
|
@ -2216,7 +2225,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
memcpy(dst, map.data, w * h * bpp);
|
||||
}
|
||||
|
||||
wined3d_context_unmap_bo_address(context, &data, 0);
|
||||
wined3d_context_unmap_bo_address(context, &data, 0, 1, &range);
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -789,6 +789,7 @@ static void wined3d_texture_destroy_dc(void *object)
|
|||
struct wined3d_texture *texture;
|
||||
struct wined3d_dc_info *dc_info;
|
||||
struct wined3d_bo_address data;
|
||||
struct wined3d_map_range range;
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_device *device;
|
||||
NTSTATUS status;
|
||||
|
@ -817,7 +818,9 @@ static void wined3d_texture_destroy_dc(void *object)
|
|||
if (data.buffer_object)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
wined3d_context_unmap_bo_address(context, &data, 0);
|
||||
range.offset = 0;
|
||||
range.size = texture->sub_resources[sub_resource_idx].size;
|
||||
wined3d_context_unmap_bo_address(context, &data, 0, 1, &range);
|
||||
context_release(context);
|
||||
}
|
||||
}
|
||||
|
@ -1964,7 +1967,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
|
|||
else
|
||||
src_format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
|
||||
dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &bo, GL_PIXEL_UNPACK_BUFFER);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &bo, GL_PIXEL_UNPACK_BUFFER, 0, NULL);
|
||||
|
||||
bo.buffer_object = 0;
|
||||
bo.addr = converted_mem;
|
||||
|
@ -2701,7 +2704,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
|
|||
width, height, &texture_gl->t.async.gl_color_key);
|
||||
src_row_pitch = dst_row_pitch;
|
||||
src_slice_pitch = dst_slice_pitch;
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER, 0, NULL);
|
||||
|
||||
data.buffer_object = 0;
|
||||
data.addr = dst_mem;
|
||||
|
@ -2962,6 +2965,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
|||
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, resource->map_binding);
|
||||
base_memory = wined3d_context_map_bo_address(context, &data, sub_resource->size, 0, flags);
|
||||
sub_resource->map_flags = flags;
|
||||
TRACE("Base memory pointer %p.\n", base_memory);
|
||||
|
||||
context_release(context);
|
||||
|
@ -3027,6 +3031,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
|
|||
struct wined3d_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_bo_address data;
|
||||
struct wined3d_map_range range;
|
||||
|
||||
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
|
||||
|
||||
|
@ -3045,7 +3050,9 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
|
|||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
|
||||
wined3d_context_unmap_bo_address(context, &data, 0);
|
||||
range.offset = 0;
|
||||
range.size = sub_resource->size;
|
||||
wined3d_context_unmap_bo_address(context, &data, 0, !!(sub_resource->map_flags & WINED3D_MAP_WRITE), &range);
|
||||
|
||||
context_release(context);
|
||||
|
||||
|
|
|
@ -1899,6 +1899,12 @@ struct wined3d_gl_view
|
|||
GLuint name;
|
||||
};
|
||||
|
||||
struct wined3d_map_range
|
||||
{
|
||||
unsigned int offset;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
struct wined3d_rendertarget_info
|
||||
{
|
||||
struct wined3d_gl_view gl_view;
|
||||
|
@ -2150,8 +2156,8 @@ void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl *context_gl, G
|
|||
void wined3d_context_gl_texture_update(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_texture_gl *texture_gl) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_unload_tex_coords(const struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_bo_address *data, GLenum binding) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl, const struct wined3d_bo_address *data,
|
||||
GLenum binding, unsigned int range_count, const struct wined3d_map_range *ranges) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_state *state) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -2813,8 +2819,8 @@ struct wined3d_adapter_ops
|
|||
void (*adapter_uninit_3d)(struct wined3d_device *device);
|
||||
void *(*adapter_map_bo_address)(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, size_t size, uint32_t bind_flags, uint32_t map_flags);
|
||||
void (*adapter_unmap_bo_address)(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, uint32_t bind_flags);
|
||||
void (*adapter_unmap_bo_address)(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
||||
uint32_t bind_flags, unsigned int range_count, const struct wined3d_map_range *ranges);
|
||||
HRESULT (*adapter_create_swapchain)(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
|
||||
void (*adapter_destroy_swapchain)(struct wined3d_swapchain *swapchain);
|
||||
|
@ -3595,6 +3601,7 @@ struct wined3d_texture
|
|||
unsigned int size;
|
||||
|
||||
unsigned int map_count;
|
||||
uint32_t map_flags;
|
||||
DWORD locations;
|
||||
GLuint buffer_object;
|
||||
} *sub_resources;
|
||||
|
@ -4150,12 +4157,6 @@ enum wined3d_buffer_conversion_type
|
|||
CONV_POSITIONT,
|
||||
};
|
||||
|
||||
struct wined3d_map_range
|
||||
{
|
||||
UINT offset;
|
||||
UINT size;
|
||||
};
|
||||
|
||||
struct wined3d_buffer_ops
|
||||
{
|
||||
BOOL (*buffer_prepare_location)(struct wined3d_buffer *buffer,
|
||||
|
@ -5258,9 +5259,10 @@ static inline void *wined3d_context_map_bo_address(struct wined3d_context *conte
|
|||
}
|
||||
|
||||
static inline void wined3d_context_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, uint32_t bind_flags)
|
||||
const struct wined3d_bo_address *data, uint32_t bind_flags,
|
||||
unsigned int range_count, const struct wined3d_map_range *ranges)
|
||||
{
|
||||
context->device->adapter->adapter_ops->adapter_unmap_bo_address(context, data, bind_flags);
|
||||
context->device->adapter->adapter_ops->adapter_unmap_bo_address(context, data, bind_flags, range_count, ranges);
|
||||
}
|
||||
|
||||
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
|
||||
|
|
Loading…
Reference in New Issue