wined3d: Map/unmap bo addresses through the adapter.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
75ee0aa9b9
commit
400a0dcc8b
|
@ -4653,6 +4653,18 @@ static void adapter_gl_uninit_3d(struct wined3d_device *device)
|
|||
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
|
||||
}
|
||||
|
||||
static void *adapter_gl_map_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
|
||||
{
|
||||
return wined3d_context_gl_map_bo_address(wined3d_context_gl(context), data, size, binding, flags);
|
||||
}
|
||||
|
||||
static void adapter_gl_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, GLenum binding)
|
||||
{
|
||||
return wined3d_context_gl_unmap_bo_address(wined3d_context_gl(context), data, binding);
|
||||
}
|
||||
|
||||
static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||
{
|
||||
|
@ -5126,6 +5138,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
|
|||
adapter_gl_check_format,
|
||||
adapter_gl_init_3d,
|
||||
adapter_gl_uninit_3d,
|
||||
adapter_gl_map_bo_address,
|
||||
adapter_gl_unmap_bo_address,
|
||||
adapter_gl_create_swapchain,
|
||||
adapter_gl_destroy_swapchain,
|
||||
adapter_gl_create_buffer,
|
||||
|
|
|
@ -466,6 +466,25 @@ static void adapter_vk_uninit_3d(struct wined3d_device *device)
|
|||
wined3d_context_vk_cleanup(context_vk);
|
||||
}
|
||||
|
||||
static void *adapter_vk_map_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
|
||||
{
|
||||
if (data->buffer_object)
|
||||
{
|
||||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return data->addr;
|
||||
}
|
||||
|
||||
static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, GLenum binding)
|
||||
{
|
||||
if (data->buffer_object)
|
||||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
}
|
||||
|
||||
static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||
{
|
||||
|
@ -789,6 +808,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
|
|||
adapter_vk_check_format,
|
||||
adapter_vk_init_3d,
|
||||
adapter_vk_uninit_3d,
|
||||
adapter_vk_map_bo_address,
|
||||
adapter_vk_unmap_bo_address,
|
||||
adapter_vk_create_swapchain,
|
||||
adapter_vk_destroy_swapchain,
|
||||
adapter_vk_create_buffer,
|
||||
|
|
|
@ -2352,6 +2352,25 @@ static void adapter_no3d_uninit_3d(struct wined3d_device *device)
|
|||
wined3d_context_cleanup(context_no3d);
|
||||
}
|
||||
|
||||
static void *adapter_no3d_map_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
|
||||
{
|
||||
if (data->buffer_object)
|
||||
{
|
||||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return data->addr;
|
||||
}
|
||||
|
||||
static void adapter_no3d_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, GLenum binding)
|
||||
{
|
||||
if (data->buffer_object)
|
||||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
}
|
||||
|
||||
static HRESULT adapter_no3d_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||
{
|
||||
|
@ -2598,6 +2617,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
|
|||
adapter_no3d_check_format,
|
||||
adapter_no3d_init_3d,
|
||||
adapter_no3d_uninit_3d,
|
||||
adapter_no3d_map_bo_address,
|
||||
adapter_no3d_unmap_bo_address,
|
||||
adapter_no3d_create_swapchain,
|
||||
adapter_no3d_destroy_swapchain,
|
||||
adapter_no3d_create_buffer,
|
||||
|
|
|
@ -600,12 +600,11 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
const struct wined3d_format *src_format = src_texture->resource.format;
|
||||
struct wined3d_device *device = src_texture->resource.device;
|
||||
const struct d3dfmt_converter_desc *conv = NULL;
|
||||
struct wined3d_context_gl *context_gl = NULL;
|
||||
unsigned int src_row_pitch, src_slice_pitch;
|
||||
struct wined3d_context *context = NULL;
|
||||
struct wined3d_texture *dst_texture;
|
||||
struct wined3d_bo_address src_data;
|
||||
struct wined3d_resource_desc desc;
|
||||
struct wined3d_context *context;
|
||||
DWORD map_binding;
|
||||
|
||||
if (!(conv = find_converter(src_format->id, dst_format->id)) && (!device->d3d_initialized
|
||||
|
@ -637,11 +636,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_gl = wined3d_context_gl(context);
|
||||
}
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
map_binding = src_texture->resource.map_binding;
|
||||
if (!wined3d_texture_load_location(src_texture, sub_resource_idx, context, map_binding))
|
||||
|
@ -662,16 +657,16 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
wined3d_texture_get_pitch(dst_texture, 0, &dst_row_pitch, &dst_slice_pitch);
|
||||
wined3d_texture_get_memory(dst_texture, 0, &dst_data, map_binding);
|
||||
|
||||
src = wined3d_context_gl_map_bo_address(context_gl, &src_data,
|
||||
src = wined3d_context_map_bo_address(context, &src_data,
|
||||
src_texture->sub_resources[sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
|
||||
dst = wined3d_context_gl_map_bo_address(context_gl, &dst_data,
|
||||
dst = wined3d_context_map_bo_address(context, &dst_data,
|
||||
dst_texture->sub_resources[0].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
|
||||
|
||||
conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
|
||||
|
||||
wined3d_texture_invalidate_location(dst_texture, 0, ~map_binding);
|
||||
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);
|
||||
wined3d_context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
|
||||
wined3d_context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -688,8 +683,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
wined3d_texture_invalidate_location(dst_texture, 0, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
}
|
||||
|
||||
if (context)
|
||||
context_release(context);
|
||||
context_release(context);
|
||||
|
||||
return dst_texture;
|
||||
}
|
||||
|
@ -1638,11 +1632,10 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
const struct wined3d_format *src_format, *dst_format;
|
||||
struct wined3d_texture *converted_texture = NULL;
|
||||
struct wined3d_bo_address src_data, dst_data;
|
||||
struct wined3d_context_gl *context_gl = NULL;
|
||||
unsigned int src_fmt_flags, dst_fmt_flags;
|
||||
struct wined3d_map_desc dst_map, src_map;
|
||||
struct wined3d_context *context = NULL;
|
||||
unsigned int x, sx, xinc, y, sy, yinc;
|
||||
struct wined3d_context *context;
|
||||
unsigned int texture_level;
|
||||
HRESULT hr = WINED3D_OK;
|
||||
BOOL same_sub_resource;
|
||||
|
@ -1656,11 +1649,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
dst_texture, dst_sub_resource_idx, debug_box(dst_box), src_texture,
|
||||
src_sub_resource_idx, debug_box(src_box), flags, fx, debug_d3dtexturefiltertype(filter));
|
||||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_gl = wined3d_context_gl(context);
|
||||
}
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
if (src_texture == dst_texture && src_sub_resource_idx == dst_sub_resource_idx)
|
||||
{
|
||||
|
@ -1673,7 +1662,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
|
||||
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
|
||||
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
|
||||
dst_map.data = wined3d_context_gl_map_bo_address(context_gl, &dst_data,
|
||||
dst_map.data = wined3d_context_map_bo_address(context, &dst_data,
|
||||
dst_texture->sub_resources[dst_sub_resource_idx].size,
|
||||
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||
|
||||
|
@ -1694,8 +1683,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
{
|
||||
FIXME("Cannot convert %s to %s.\n", debug_d3dformat(src_texture->resource.format->id),
|
||||
debug_d3dformat(dst_texture->resource.format->id));
|
||||
if (context)
|
||||
context_release(context);
|
||||
context_release(context);
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
src_texture = converted_texture;
|
||||
|
@ -1710,7 +1698,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(map_binding));
|
||||
wined3d_texture_get_pitch(src_texture, texture_level, &src_map.row_pitch, &src_map.slice_pitch);
|
||||
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_data, map_binding);
|
||||
src_map.data = wined3d_context_gl_map_bo_address(context_gl, &src_data,
|
||||
src_map.data = wined3d_context_map_bo_address(context, &src_data,
|
||||
src_texture->sub_resources[src_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
|
||||
|
||||
map_binding = dst_texture->resource.map_binding;
|
||||
|
@ -1720,7 +1708,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
|||
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
|
||||
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
|
||||
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
|
||||
dst_map.data = wined3d_context_gl_map_bo_address(context_gl, &dst_data,
|
||||
dst_map.data = wined3d_context_map_bo_address(context, &dst_data,
|
||||
dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
|
||||
}
|
||||
flags &= ~WINED3D_BLT_RAW;
|
||||
|
@ -2097,9 +2085,9 @@ error:
|
|||
FIXME(" Unsupported flags %#x.\n", flags);
|
||||
|
||||
release:
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &dst_data, GL_PIXEL_UNPACK_BUFFER);
|
||||
wined3d_context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
|
||||
if (!same_sub_resource)
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &src_data, GL_PIXEL_UNPACK_BUFFER);
|
||||
wined3d_context_unmap_bo_address(context, &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,
|
||||
|
@ -2108,8 +2096,7 @@ release:
|
|||
}
|
||||
if (converted_texture)
|
||||
wined3d_texture_decref(converted_texture);
|
||||
if (context)
|
||||
context_release(context);
|
||||
context_release(context);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -2118,9 +2105,8 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
const struct wined3d_box *box, const struct wined3d_color *colour)
|
||||
{
|
||||
struct wined3d_device *device = view->resource->device;
|
||||
struct wined3d_context_gl *context_gl = NULL;
|
||||
unsigned int x, y, z, w, h, d, bpp, level;
|
||||
struct wined3d_context *context = NULL;
|
||||
struct wined3d_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_bo_address data;
|
||||
struct wined3d_map_desc map;
|
||||
|
@ -2146,11 +2132,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
return;
|
||||
}
|
||||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_gl = wined3d_context_gl(context);
|
||||
}
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
texture = texture_from_resource(view->resource);
|
||||
level = view->sub_resource_idx % texture->level_count;
|
||||
|
@ -2175,7 +2157,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
wined3d_texture_invalidate_location(texture, view->sub_resource_idx, ~map_binding);
|
||||
wined3d_texture_get_pitch(texture, level, &map.row_pitch, &map.slice_pitch);
|
||||
wined3d_texture_get_memory(texture, view->sub_resource_idx, &data, map_binding);
|
||||
map.data = wined3d_context_gl_map_bo_address(context_gl, &data,
|
||||
map.data = wined3d_context_map_bo_address(context, &data,
|
||||
texture->sub_resources[view->sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
|
||||
map.data = (BYTE *)map.data
|
||||
+ (box->front * map.slice_pitch)
|
||||
|
@ -2236,9 +2218,8 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
|||
memcpy(dst, map.data, w * h * bpp);
|
||||
}
|
||||
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
if (context)
|
||||
context_release(context);
|
||||
wined3d_context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
static void cpu_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
|
||||
|
|
|
@ -700,7 +700,6 @@ void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *texture)
|
|||
static void wined3d_texture_create_dc(void *object)
|
||||
{
|
||||
const struct wined3d_texture_idx *idx = object;
|
||||
struct wined3d_context_gl *context_gl = NULL;
|
||||
struct wined3d_context *context = NULL;
|
||||
unsigned int sub_resource_idx, level;
|
||||
const struct wined3d_format *format;
|
||||
|
@ -737,19 +736,26 @@ static void wined3d_texture_create_dc(void *object)
|
|||
}
|
||||
}
|
||||
|
||||
if (device->d3d_initialized)
|
||||
if (!(texture->sub_resources[sub_resource_idx].locations & texture->resource.map_binding))
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_gl = wined3d_context_gl(context);
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding);
|
||||
}
|
||||
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding);
|
||||
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
|
||||
wined3d_texture_get_pitch(texture, level, &row_pitch, &slice_pitch);
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
|
||||
desc.pMemory = wined3d_context_gl_map_bo_address(context_gl, &data,
|
||||
texture->sub_resources[sub_resource_idx].size,
|
||||
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||
if (data.buffer_object)
|
||||
{
|
||||
if (!context)
|
||||
context = context_acquire(device, NULL, 0);
|
||||
desc.pMemory = wined3d_context_map_bo_address(context, &data,
|
||||
texture->sub_resources[sub_resource_idx].size,
|
||||
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
desc.pMemory = data.addr;
|
||||
}
|
||||
|
||||
if (context)
|
||||
context_release(context);
|
||||
|
@ -779,9 +785,8 @@ 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_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_dc_info *dc_info;
|
||||
struct wined3d_bo_address data;
|
||||
|
@ -809,17 +814,13 @@ static void wined3d_texture_destroy_dc(void *object)
|
|||
dc_info->dc = NULL;
|
||||
dc_info->bitmap = NULL;
|
||||
|
||||
if (device->d3d_initialized)
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
|
||||
if (data.buffer_object)
|
||||
{
|
||||
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);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
if (context)
|
||||
wined3d_context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
context_release(context);
|
||||
}
|
||||
}
|
||||
|
||||
void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain)
|
||||
|
@ -2906,8 +2907,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
|||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
struct wined3d_device *device = resource->device;
|
||||
unsigned int fmt_flags = resource->format_flags;
|
||||
struct wined3d_context_gl *context_gl = NULL;
|
||||
struct wined3d_context *context = NULL;
|
||||
struct wined3d_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_bo_address data;
|
||||
unsigned int texture_level;
|
||||
|
@ -2942,11 +2942,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_gl = wined3d_context_gl(context);
|
||||
}
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
if (flags & WINED3D_MAP_DISCARD)
|
||||
{
|
||||
|
@ -2974,12 +2970,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
|||
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~resource->map_binding);
|
||||
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, resource->map_binding);
|
||||
base_memory = wined3d_context_gl_map_bo_address(context_gl, &data,
|
||||
base_memory = wined3d_context_map_bo_address(context, &data,
|
||||
sub_resource->size, GL_PIXEL_UNPACK_BUFFER, flags);
|
||||
TRACE("Base memory pointer %p.\n", base_memory);
|
||||
|
||||
if (context)
|
||||
context_release(context);
|
||||
context_release(context);
|
||||
|
||||
if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
|
||||
{
|
||||
|
@ -3039,8 +3034,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_context *context;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_bo_address data;
|
||||
|
||||
|
@ -3058,17 +3052,12 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
|
|||
return WINEDDERR_NOTLOCKED;
|
||||
}
|
||||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_gl = wined3d_context_gl(context);
|
||||
}
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
|
||||
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
wined3d_context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
if (context)
|
||||
context_release(context);
|
||||
context_release(context);
|
||||
|
||||
if (texture->swapchain && texture->swapchain->front_buffer == texture)
|
||||
{
|
||||
|
|
|
@ -2787,6 +2787,10 @@ struct wined3d_adapter_ops
|
|||
const struct wined3d_format *ds_format);
|
||||
HRESULT (*adapter_init_3d)(struct wined3d_device *device);
|
||||
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, GLenum binding, uint32_t flags);
|
||||
void (*adapter_unmap_bo_address)(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, GLenum binding);
|
||||
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);
|
||||
|
@ -5215,6 +5219,18 @@ static inline float wined3d_get_float_state(const struct wined3d_state *state, e
|
|||
return tmpvalue.f;
|
||||
}
|
||||
|
||||
static inline void *wined3d_context_map_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
|
||||
{
|
||||
return context->device->adapter->adapter_ops->adapter_map_bo_address(context, data, size, binding, flags);
|
||||
}
|
||||
|
||||
static inline void wined3d_context_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, GLenum binding)
|
||||
{
|
||||
return context->device->adapter->adapter_ops->adapter_unmap_bo_address(context, data, binding);
|
||||
}
|
||||
|
||||
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
|
||||
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
|
||||
|
||||
|
|
Loading…
Reference in New Issue