wined3d: Pass a wined3d_context_gl structure to context_unmap_bo_address().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-06-12 15:59:31 +04:30 committed by Alexandre Julliard
parent 324082a8f3
commit e3d28cd45d
4 changed files with 23 additions and 16 deletions

View File

@ -2618,16 +2618,15 @@ void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
return memory;
}
void context_unmap_bo_address(struct wined3d_context *context,
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *data, GLenum binding)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info;
if (!data->buffer_object)
return;
gl_info = context->gl_info;
gl_info = context_gl->c.gl_info;
wined3d_context_gl_bind_bo(context_gl, binding, data->buffer_object);
GL_EXTCALL(glUnmapBuffer(binding));
wined3d_context_gl_bind_bo(context_gl, binding, 0);
@ -2660,8 +2659,8 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
memcpy(dst_ptr, src_ptr, size);
context_unmap_bo_address(&context_gl->c, dst, dst_binding);
context_unmap_bo_address(&context_gl->c, src, src_binding);
wined3d_context_gl_unmap_bo_address(context_gl, dst, dst_binding);
wined3d_context_gl_unmap_bo_address(context_gl, src, src_binding);
}
}
else if (!dst->buffer_object && src->buffer_object)

View File

@ -684,8 +684,8 @@ 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);
wined3d_texture_invalidate_location(dst_texture, 0, ~map_binding);
context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &dst_data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &src_data, GL_PIXEL_UNPACK_BUFFER);
}
else
{
@ -1660,7 +1660,7 @@ BOOL texture2d_load_texture(struct wined3d_texture *texture, unsigned int sub_re
width, height, &texture->async.gl_color_key);
src_row_pitch = dst_row_pitch;
src_slice_pitch = dst_slice_pitch;
context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
data.buffer_object = 0;
data.addr = dst_mem;
@ -2932,9 +2932,9 @@ error:
FIXME(" Unsupported flags %#x.\n", flags);
release:
context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &dst_data, GL_PIXEL_UNPACK_BUFFER);
if (!same_sub_resource)
context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &src_data, GL_PIXEL_UNPACK_BUFFER);
if (SUCCEEDED(hr) && dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
{
SetRect(&dst_texture->swapchain->front_buffer_update,
@ -3054,7 +3054,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
memcpy(row, map.data, w * bpp);
}
context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
if (context)
context_release(context);
}

View File

@ -774,6 +774,7 @@ static void wined3d_texture_create_dc(void *object)
static void wined3d_texture_destroy_dc(void *object)
{
const struct wined3d_texture_idx *idx = object;
struct wined3d_context_gl *context_gl = NULL;
D3DKMT_DESTROYDCFROMMEMORY destroy_desc;
struct wined3d_context *context = NULL;
struct wined3d_texture *texture;
@ -804,10 +805,13 @@ static void wined3d_texture_destroy_dc(void *object)
dc_info->bitmap = NULL;
if (device->d3d_initialized)
{
context = context_acquire(device, NULL, 0);
context_gl = wined3d_context_gl(context);
}
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
if (context)
context_release(context);
@ -2008,7 +2012,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
else
format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
context_unmap_bo_address(context, &bo, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &bo, GL_PIXEL_UNPACK_BUFFER);
bo.buffer_object = 0;
bo.addr = converted_mem;
@ -2715,6 +2719,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
{
struct wined3d_texture_sub_resource *sub_resource;
struct wined3d_device *device = resource->device;
struct wined3d_context_gl *context_gl = NULL;
struct wined3d_context *context = NULL;
struct wined3d_texture *texture;
struct wined3d_bo_address data;
@ -2734,10 +2739,13 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
}
if (device->d3d_initialized)
{
context = context_acquire(device, NULL, 0);
context_gl = wined3d_context_gl(context);
}
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
if (context)
context_release(context);

View File

@ -2112,6 +2112,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_update_stream_sources(struct wined3d_context_gl *context_gl,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -2269,8 +2271,6 @@ void context_state_drawbuf(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
void context_state_fb(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
void context_unmap_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, GLenum binding) DECLSPEC_HIDDEN;
/*****************************************************************************
* Internal representation of a light