Commit 8c4061a7 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Pass a wined3d_device_context to wined3d_device_copy_sub_resource_region().

parent f65fafe3
...@@ -1210,7 +1210,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion(ID3D ...@@ -1210,7 +1210,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion(ID3D
ID3D11Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z, ID3D11Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
ID3D11Resource *src_resource, UINT src_subresource_idx, const D3D11_BOX *src_box) ID3D11Resource *src_resource, UINT src_subresource_idx, const D3D11_BOX *src_box)
{ {
struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
struct wined3d_resource *wined3d_dst_resource, *wined3d_src_resource; struct wined3d_resource *wined3d_dst_resource, *wined3d_src_resource;
struct wined3d_box wined3d_src_box; struct wined3d_box wined3d_src_box;
...@@ -1229,7 +1229,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion(ID3D ...@@ -1229,7 +1229,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion(ID3D
wined3d_dst_resource = wined3d_resource_from_d3d11_resource(dst_resource); wined3d_dst_resource = wined3d_resource_from_d3d11_resource(dst_resource);
wined3d_src_resource = wined3d_resource_from_d3d11_resource(src_resource); wined3d_src_resource = wined3d_resource_from_d3d11_resource(src_resource);
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_device_copy_sub_resource_region(device->wined3d_device, wined3d_dst_resource, dst_subresource_idx, wined3d_device_context_copy_sub_resource_region(context->wined3d_context, wined3d_dst_resource, dst_subresource_idx,
dst_x, dst_y, dst_z, wined3d_src_resource, src_subresource_idx, src_box ? &wined3d_src_box : NULL, 0); dst_x, dst_y, dst_z, wined3d_src_resource, src_subresource_idx, src_box ? &wined3d_src_box : NULL, 0);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
} }
...@@ -2675,7 +2675,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3 ...@@ -2675,7 +2675,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3
ID3D11Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z, ID3D11Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
ID3D11Resource *src_resource, UINT src_subresource_idx, const D3D11_BOX *src_box, UINT flags) ID3D11Resource *src_resource, UINT src_subresource_idx, const D3D11_BOX *src_box, UINT flags)
{ {
struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
struct wined3d_resource *wined3d_dst_resource, *wined3d_src_resource; struct wined3d_resource *wined3d_dst_resource, *wined3d_src_resource;
struct wined3d_box wined3d_src_box; struct wined3d_box wined3d_src_box;
...@@ -2694,7 +2694,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3 ...@@ -2694,7 +2694,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3
wined3d_dst_resource = wined3d_resource_from_d3d11_resource(dst_resource); wined3d_dst_resource = wined3d_resource_from_d3d11_resource(dst_resource);
wined3d_src_resource = wined3d_resource_from_d3d11_resource(src_resource); wined3d_src_resource = wined3d_resource_from_d3d11_resource(src_resource);
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_device_copy_sub_resource_region(device->wined3d_device, wined3d_dst_resource, dst_subresource_idx, wined3d_device_context_copy_sub_resource_region(context->wined3d_context, wined3d_dst_resource, dst_subresource_idx,
dst_x, dst_y, dst_z, wined3d_src_resource, src_subresource_idx, src_box ? &wined3d_src_box : NULL, flags); dst_x, dst_y, dst_z, wined3d_src_resource, src_subresource_idx, src_box ? &wined3d_src_box : NULL, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
} }
...@@ -4880,8 +4880,9 @@ static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device1 * ...@@ -4880,8 +4880,9 @@ static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device1 *
wined3d_dst_resource = wined3d_resource_from_d3d10_resource(dst_resource); wined3d_dst_resource = wined3d_resource_from_d3d10_resource(dst_resource);
wined3d_src_resource = wined3d_resource_from_d3d10_resource(src_resource); wined3d_src_resource = wined3d_resource_from_d3d10_resource(src_resource);
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_device_copy_sub_resource_region(device->wined3d_device, wined3d_dst_resource, dst_subresource_idx, wined3d_device_context_copy_sub_resource_region(device->immediate_context.wined3d_context,
dst_x, dst_y, dst_z, wined3d_src_resource, src_subresource_idx, src_box ? &wined3d_src_box : NULL, 0); wined3d_dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
wined3d_src_resource, src_subresource_idx, src_box ? &wined3d_src_box : NULL, 0);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
} }
......
...@@ -2453,7 +2453,7 @@ static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device, ...@@ -2453,7 +2453,7 @@ static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device,
wined3d_resource_get_desc(dst_resource, &desc); wined3d_resource_get_desc(dst_resource, &desc);
box.left = stream->offset + start_vertex * stride; box.left = stream->offset + start_vertex * stride;
box.right = min(box.left + vertex_count * stride, desc.size); box.right = min(box.left + vertex_count * stride, desc.size);
if (FAILED(hr = wined3d_device_copy_sub_resource_region(device->wined3d_device, if (FAILED(hr = wined3d_device_context_copy_sub_resource_region(device->immediate_context,
dst_resource, 0, box.left, 0, 0, dst_resource, 0, box.left, 0, 0,
wined3d_buffer_get_resource(d3d8_buffer->wined3d_buffer), 0, &box, 0))) wined3d_buffer_get_resource(d3d8_buffer->wined3d_buffer), 0, &box, 0)))
ERR("Failed to update buffer.\n"); ERR("Failed to update buffer.\n");
...@@ -2484,7 +2484,7 @@ static void d3d8_device_upload_sysmem_index_buffer(struct d3d8_device *device, ...@@ -2484,7 +2484,7 @@ static void d3d8_device_upload_sysmem_index_buffer(struct d3d8_device *device,
idx_size = format == WINED3DFMT_R16_UINT ? 2 : 4; idx_size = format == WINED3DFMT_R16_UINT ? 2 : 4;
box.left = start_idx * idx_size; box.left = start_idx * idx_size;
box.right = min(box.left + idx_count * idx_size, desc.size); box.right = min(box.left + idx_count * idx_size, desc.size);
if (FAILED(hr = wined3d_device_copy_sub_resource_region(device->wined3d_device, if (FAILED(hr = wined3d_device_context_copy_sub_resource_region(device->immediate_context,
dst_resource, 0, box.left, 0, 0, dst_resource, 0, box.left, 0, 0,
wined3d_buffer_get_resource(d3d8_buffer->wined3d_buffer), 0, &box, 0))) wined3d_buffer_get_resource(d3d8_buffer->wined3d_buffer), 0, &box, 0)))
ERR("Failed to update buffer.\n"); ERR("Failed to update buffer.\n");
......
...@@ -1710,7 +1710,7 @@ static HRESULT WINAPI d3d9_device_UpdateSurface(IDirect3DDevice9Ex *iface, ...@@ -1710,7 +1710,7 @@ static HRESULT WINAPI d3d9_device_UpdateSurface(IDirect3DDevice9Ex *iface,
else else
wined3d_box_set(&src_box, 0, 0, src_desc.width, src_desc.height, 0, 1); wined3d_box_set(&src_box, 0, 0, src_desc.width, src_desc.height, 0, 1);
hr = wined3d_device_copy_sub_resource_region(device->wined3d_device, hr = wined3d_device_context_copy_sub_resource_region(device->immediate_context,
wined3d_texture_get_resource(dst->wined3d_texture), dst->sub_resource_idx, dst_point ? dst_point->x : 0, wined3d_texture_get_resource(dst->wined3d_texture), dst->sub_resource_idx, dst_point ? dst_point->x : 0,
dst_point ? dst_point->y : 0, 0, wined3d_texture_get_resource(src->wined3d_texture), dst_point ? dst_point->y : 0, 0, wined3d_texture_get_resource(src->wined3d_texture),
src->sub_resource_idx, &src_box, 0); src->sub_resource_idx, &src_box, 0);
...@@ -2976,7 +2976,7 @@ static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device, ...@@ -2976,7 +2976,7 @@ static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device,
wined3d_resource_get_desc(dst_resource, &desc); wined3d_resource_get_desc(dst_resource, &desc);
box.left = stream->offset + start_vertex * stride; box.left = stream->offset + start_vertex * stride;
box.right = min(box.left + vertex_count * stride, desc.size); box.right = min(box.left + vertex_count * stride, desc.size);
if (FAILED(hr = wined3d_device_copy_sub_resource_region(device->wined3d_device, if (FAILED(hr = wined3d_device_context_copy_sub_resource_region(device->immediate_context,
dst_resource, 0, box.left, 0, 0, dst_resource, 0, box.left, 0, 0,
wined3d_buffer_get_resource(d3d9_buffer->wined3d_buffer), 0, &box, 0))) wined3d_buffer_get_resource(d3d9_buffer->wined3d_buffer), 0, &box, 0)))
ERR("Failed to update buffer.\n"); ERR("Failed to update buffer.\n");
...@@ -3007,7 +3007,7 @@ static void d3d9_device_upload_sysmem_index_buffer(struct d3d9_device *device, ...@@ -3007,7 +3007,7 @@ static void d3d9_device_upload_sysmem_index_buffer(struct d3d9_device *device,
idx_size = format == WINED3DFMT_R16_UINT ? 2 : 4; idx_size = format == WINED3DFMT_R16_UINT ? 2 : 4;
box.left = start_idx * idx_size; box.left = start_idx * idx_size;
box.right = min(box.left + idx_count * idx_size, desc.size); box.right = min(box.left + idx_count * idx_size, desc.size);
if (FAILED(hr = wined3d_device_copy_sub_resource_region(device->wined3d_device, if (FAILED(hr = wined3d_device_context_copy_sub_resource_region(device->immediate_context,
dst_resource, 0, box.left, 0, 0, dst_resource, 0, box.left, 0, 0,
wined3d_buffer_get_resource(d3d9_buffer->wined3d_buffer), 0, &box, 0))) wined3d_buffer_get_resource(d3d9_buffer->wined3d_buffer), 0, &box, 0)))
ERR("Failed to update buffer.\n"); ERR("Failed to update buffer.\n");
......
...@@ -670,7 +670,7 @@ static inline struct wined3d_texture *ddraw_surface_get_default_texture(struct d ...@@ -670,7 +670,7 @@ static inline struct wined3d_texture *ddraw_surface_get_default_texture(struct d
{ {
if (flags & DDRAW_SURFACE_READ && !(surface->texture_location & DDRAW_SURFACE_LOCATION_DEFAULT)) if (flags & DDRAW_SURFACE_READ && !(surface->texture_location & DDRAW_SURFACE_LOCATION_DEFAULT))
{ {
wined3d_device_copy_sub_resource_region(surface->ddraw->wined3d_device, wined3d_device_context_copy_sub_resource_region(surface->ddraw->immediate_context,
wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx, 0, 0, 0, wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx, 0, 0, 0,
wined3d_texture_get_resource(surface->draw_texture), surface->sub_resource_idx, NULL, 0); wined3d_texture_get_resource(surface->draw_texture), surface->sub_resource_idx, NULL, 0);
surface->texture_location |= DDRAW_SURFACE_LOCATION_DEFAULT; surface->texture_location |= DDRAW_SURFACE_LOCATION_DEFAULT;
...@@ -689,7 +689,7 @@ static inline struct wined3d_texture *ddraw_surface_get_draw_texture(struct ddra ...@@ -689,7 +689,7 @@ static inline struct wined3d_texture *ddraw_surface_get_draw_texture(struct ddra
if (flags & DDRAW_SURFACE_READ && !(surface->texture_location & DDRAW_SURFACE_LOCATION_DRAW)) if (flags & DDRAW_SURFACE_READ && !(surface->texture_location & DDRAW_SURFACE_LOCATION_DRAW))
{ {
wined3d_device_copy_sub_resource_region(surface->ddraw->wined3d_device, wined3d_device_context_copy_sub_resource_region(surface->ddraw->immediate_context,
wined3d_texture_get_resource(surface->draw_texture), surface->sub_resource_idx, 0, 0, 0, wined3d_texture_get_resource(surface->draw_texture), surface->sub_resource_idx, 0, 0, 0,
wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx, NULL, 0); wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx, NULL, 0);
surface->texture_location |= DDRAW_SURFACE_LOCATION_DRAW; surface->texture_location |= DDRAW_SURFACE_LOCATION_DRAW;
......
...@@ -322,7 +322,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d ...@@ -322,7 +322,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d
box.right = box.left + ci->dwCount * sizeof(D3DTLVERTEX); box.right = box.left + ci->dwCount * sizeof(D3DTLVERTEX);
box.top = box.front = 0; box.top = box.front = 0;
box.bottom = box.back = 1; box.bottom = box.back = 1;
wined3d_device_copy_sub_resource_region(device->wined3d_device, wined3d_device_context_copy_sub_resource_region(device->immediate_context,
wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0, wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0,
ci->wDest * sizeof(D3DTLVERTEX), 0, 0, ci->wDest * sizeof(D3DTLVERTEX), 0, 0,
wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0, &box, 0); wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0, &box, 0);
......
...@@ -4924,16 +4924,16 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c ...@@ -4924,16 +4924,16 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
} }
} }
HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device, HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context,
struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x,
unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource, unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags) unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags)
{ {
struct wined3d_box dst_box, b; struct wined3d_box dst_box, b;
TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " TRACE("context %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
"src_resource %p, src_sub_resource_idx %u, src_box %s, flags %#x.\n", "src_resource %p, src_sub_resource_idx %u, src_box %s, flags %#x.\n",
device, dst_resource, dst_sub_resource_idx, dst_x, dst_y, dst_z, context, dst_resource, dst_sub_resource_idx, dst_x, dst_y, dst_z,
src_resource, src_sub_resource_idx, debug_box(src_box), flags); src_resource, src_sub_resource_idx, debug_box(src_box), flags);
if (flags) if (flags)
...@@ -5079,7 +5079,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev ...@@ -5079,7 +5079,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
} }
} }
wined3d_device_context_emit_blt_sub_resource(&device->cs->c, dst_resource, dst_sub_resource_idx, &dst_box, wined3d_device_context_emit_blt_sub_resource(context, dst_resource, dst_sub_resource_idx, &dst_box,
src_resource, src_sub_resource_idx, src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT); src_resource, src_sub_resource_idx, src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
return WINED3D_OK; return WINED3D_OK;
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
@ cdecl wined3d_device_clear(ptr long ptr long ptr float long) @ cdecl wined3d_device_clear(ptr long ptr long ptr float long)
@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long) @ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long)
@ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr) @ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr)
@ cdecl wined3d_device_copy_sub_resource_region(ptr ptr long long long long ptr long ptr long)
@ cdecl wined3d_device_create(ptr ptr long ptr long long ptr long ptr ptr) @ cdecl wined3d_device_create(ptr ptr long ptr long long ptr long ptr ptr)
@ cdecl wined3d_device_decref(ptr) @ cdecl wined3d_device_decref(ptr)
@ cdecl wined3d_device_dispatch_compute(ptr long long long) @ cdecl wined3d_device_dispatch_compute(ptr long long long)
...@@ -165,6 +164,7 @@ ...@@ -165,6 +164,7 @@
@ cdecl wined3d_device_validate_device(ptr ptr) @ cdecl wined3d_device_validate_device(ptr ptr)
@ cdecl wined3d_device_context_copy_resource(ptr ptr ptr) @ cdecl wined3d_device_context_copy_resource(ptr ptr ptr)
@ cdecl wined3d_device_context_copy_sub_resource_region(ptr ptr long long long long ptr long ptr long)
@ cdecl wined3d_device_context_copy_uav_counter(ptr ptr long ptr) @ cdecl wined3d_device_context_copy_uav_counter(ptr ptr long ptr)
@ cdecl wined3d_device_context_draw(ptr long long long long) @ cdecl wined3d_device_context_draw(ptr long long long long)
@ cdecl wined3d_device_context_draw_indexed(ptr long long long long long) @ cdecl wined3d_device_context_draw_indexed(ptr long long long long long)
......
...@@ -2357,10 +2357,6 @@ HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *de ...@@ -2357,10 +2357,6 @@ HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *de
const struct wined3d_color *color, float depth, DWORD stencil); const struct wined3d_color *color, float depth, DWORD stencil);
void __cdecl wined3d_device_clear_unordered_access_view_uint(struct wined3d_device *device, void __cdecl wined3d_device_clear_unordered_access_view_uint(struct wined3d_device *device,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value); struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value);
HRESULT __cdecl wined3d_device_copy_sub_resource_region(struct wined3d_device *device,
struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x,
unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags);
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, struct wined3d_adapter *adapter, HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, struct wined3d_adapter *adapter,
enum wined3d_device_type device_type, HWND focus_window, DWORD behaviour_flags, BYTE surface_alignment, enum wined3d_device_type device_type, HWND focus_window, DWORD behaviour_flags, BYTE surface_alignment,
const enum wined3d_feature_level *feature_levels, unsigned int feature_level_count, const enum wined3d_feature_level *feature_levels, unsigned int feature_level_count,
...@@ -2555,6 +2551,10 @@ HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *devi ...@@ -2555,6 +2551,10 @@ HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *devi
void __cdecl wined3d_device_context_copy_resource(struct wined3d_device_context *context, void __cdecl wined3d_device_context_copy_resource(struct wined3d_device_context *context,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource); struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource);
HRESULT __cdecl wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context,
struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x,
unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags);
void __cdecl wined3d_device_context_copy_uav_counter(struct wined3d_device_context *context, void __cdecl wined3d_device_context_copy_uav_counter(struct wined3d_device_context *context,
struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav); struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav);
void __cdecl wined3d_device_context_dispatch(struct wined3d_device_context *context, void __cdecl wined3d_device_context_dispatch(struct wined3d_device_context *context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment