Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/d3d9_private.h | 1 + dlls/d3d9/device.c | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index dc7c4ca3b1c..7bb277c2a75 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -93,6 +93,7 @@ struct d3d9_device struct wined3d_device_parent device_parent; LONG refcount; struct wined3d_device *wined3d_device; + struct wined3d_device_context *immediate_context; unsigned int adapter_ordinal; struct d3d9 *d3d_parent;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index aa216edfcc0..2cd9d73d0d9 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2025,7 +2025,7 @@ static HRESULT WINAPI d3d9_device_SetRenderTarget(IDirect3DDevice9Ex *iface, DWO
wined3d_mutex_lock(); rtv = surface_impl ? d3d9_surface_acquire_rendertarget_view(surface_impl) : NULL; - hr = wined3d_device_set_rendertarget_view(device->wined3d_device, idx, rtv, TRUE); + hr = wined3d_device_context_set_rendertarget_view(device->immediate_context, idx, rtv, TRUE); d3d9_surface_release_rendertarget_view(surface_impl, rtv); if (SUCCEEDED(hr)) { @@ -2086,7 +2086,7 @@ static HRESULT WINAPI d3d9_device_SetDepthStencilSurface(IDirect3DDevice9Ex *ifa
wined3d_mutex_lock(); rtv = ds_impl ? d3d9_surface_acquire_rendertarget_view(ds_impl) : NULL; - hr = wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv); + hr = wined3d_device_context_set_depth_stencil_view(device->immediate_context, rtv); d3d9_surface_release_rendertarget_view(ds_impl, rtv); wined3d_mutex_unlock();
@@ -3018,7 +3018,6 @@ static HRESULT WINAPI d3d9_device_DrawPrimitive(IDirect3DDevice9Ex *iface, { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); unsigned int vertex_count; - HRESULT hr;
TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n", iface, primitive_type, start_vertex, primitive_count); @@ -3035,12 +3034,11 @@ static HRESULT WINAPI d3d9_device_DrawPrimitive(IDirect3DDevice9Ex *iface, d3d9_device_upload_sysmem_vertex_buffers(device, 0, start_vertex, vertex_count); d3d9_generate_auto_mipmaps(device); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); - hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); - if (SUCCEEDED(hr)) - d3d9_rts_flag_auto_gen_mipmap(device); + wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 0); + d3d9_rts_flag_auto_gen_mipmap(device); wined3d_mutex_unlock();
- return hr; + return D3D_OK; }
static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface, @@ -3072,10 +3070,9 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface d3d9_device_upload_sysmem_vertex_buffers(device, base_vertex_idx, min_vertex_idx, vertex_count); d3d9_device_upload_sysmem_index_buffer(device, start_idx, index_count); d3d9_generate_auto_mipmaps(device); - wined3d_stateblock_set_base_vertex_index(device->state, base_vertex_idx); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); - wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count); + wined3d_device_context_draw_indexed(device->immediate_context, base_vertex_idx, start_idx, index_count, 0, 0); d3d9_rts_flag_auto_gen_mipmap(device); wined3d_mutex_unlock();
@@ -3183,10 +3180,9 @@ static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, d3d9_generate_auto_mipmaps(device); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); - hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); + wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vtx_count, 0, 0); wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); - if (SUCCEEDED(hr)) - d3d9_rts_flag_auto_gen_mipmap(device); + d3d9_rts_flag_auto_gen_mipmap(device);
done: wined3d_mutex_unlock(); @@ -3322,11 +3318,11 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa d3d9_generate_auto_mipmaps(device); wined3d_stateblock_set_index_buffer(device->state, device->index_buffer, wined3dformat_from_d3dformat(index_format)); - wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vertex_stride - min_vertex_idx);
wined3d_device_apply_stateblock(device->wined3d_device, device->state); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); - wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); + wined3d_device_context_draw_indexed(device->immediate_context, + vb_pos / vertex_stride - min_vertex_idx, ib_pos / idx_fmt_size, idx_count, 0, 0);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); wined3d_stateblock_set_index_buffer(device->state, NULL, WINED3DFMT_UNKNOWN); @@ -4737,6 +4733,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine return hr; }
+ device->immediate_context = wined3d_device_get_immediate_context(device->wined3d_device); wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &wined3d_caps); d3d9_caps_from_wined3dcaps(parent, adapter, &caps, &wined3d_caps); device->max_user_clip_planes = caps.MaxUserClipPlanes;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/d3d8_private.h | 1 + dlls/d3d8/device.c | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index bb25be16de0..755991a64c7 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -114,6 +114,7 @@ struct d3d8_device struct wined3d_device_parent device_parent; LONG ref; struct wined3d_device *wined3d_device; + struct wined3d_device_context *immediate_context; unsigned int adapter_ordinal; struct d3d8 *d3d_parent; struct d3d8_handle_table handle_table; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index f0bfab660a7..8464b99e32c 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1534,17 +1534,17 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device); rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL; - hr = wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv); + hr = wined3d_device_context_set_depth_stencil_view(device->immediate_context, rtv); d3d8_surface_release_rendertarget_view(ds_impl, rtv); if (SUCCEEDED(hr)) { rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL; if (render_target) { - if (SUCCEEDED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE))) + if (SUCCEEDED(hr = wined3d_device_context_set_rendertarget_view(device->immediate_context, 0, rtv, TRUE))) device_reset_viewport_state(device); else - wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv); + wined3d_device_context_set_depth_stencil_view(device->immediate_context, original_dsv); } d3d8_surface_release_rendertarget_view(rt_impl, rtv); } @@ -2495,7 +2495,6 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface, { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); unsigned int vertex_count; - HRESULT hr;
TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n", iface, primitive_type, start_vertex, primitive_count); @@ -2505,10 +2504,10 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface, d3d8_device_upload_sysmem_vertex_buffers(device, start_vertex, vertex_count); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); - hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); + wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 0); wined3d_mutex_unlock();
- return hr; + return D3D_OK; }
static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, @@ -2535,7 +2534,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, d3d8_device_upload_sysmem_index_buffer(device, start_idx, index_count); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); - wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count); + wined3d_device_context_draw_indexed(device->immediate_context, base_vertex_index, start_idx, index_count, 0, 0); wined3d_mutex_unlock();
return D3D_OK; @@ -2629,7 +2628,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); - hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); + wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vtx_count, 0, 0); wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0);
done: @@ -2687,6 +2686,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface struct wined3d_map_desc wined3d_map_desc; struct wined3d_box wined3d_box = {0}; struct wined3d_resource *ib, *vb; + unsigned int base_vertex_idx; UINT vb_pos, ib_pos, align; HRESULT hr;
@@ -2753,11 +2753,13 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
wined3d_stateblock_set_index_buffer(device->state, device->index_buffer, wined3dformat_from_d3dformat(index_format)); - wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vertex_stride - min_vertex_idx); + base_vertex_idx = vb_pos / vertex_stride - min_vertex_idx; + wined3d_stateblock_set_base_vertex_index(device->state, base_vertex_idx);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); - wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); + wined3d_device_context_draw_indexed(device->immediate_context, + base_vertex_idx, ib_pos / idx_fmt_size, idx_count, 0, 0);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); wined3d_stateblock_set_index_buffer(device->state, NULL, WINED3DFMT_UNKNOWN); @@ -3775,6 +3777,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine return hr; }
+ device->immediate_context = wined3d_device_get_immediate_context(device->wined3d_device); wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/ddraw.c | 5 +++-- dlls/ddraw/ddraw_private.h | 2 ++ dlls/ddraw/device.c | 31 ++++++++++++++++--------------- dlls/ddraw/executebuffer.c | 4 ++-- dlls/ddraw/surface.c | 8 ++++---- 5 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 705d0335d95..5582e9862a1 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -952,13 +952,13 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window, { if (dsv) { - wined3d_device_set_depth_stencil_view(ddraw->wined3d_device, dsv); + wined3d_device_context_set_depth_stencil_view(ddraw->immediate_context, dsv); wined3d_rendertarget_view_decref(dsv); }
if (rtv) { - wined3d_device_set_rendertarget_view(ddraw->wined3d_device, 0, rtv, FALSE); + wined3d_device_context_set_rendertarget_view(ddraw->immediate_context, 0, rtv, FALSE); wined3d_rendertarget_view_decref(rtv); }
@@ -5166,6 +5166,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type de wined3d_decref(ddraw->wined3d); return hr; } + ddraw->immediate_context = wined3d_device_get_immediate_context(ddraw->wined3d_device);
list_init(&ddraw->surface_list);
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 0c65b9940ba..b49d84a7961 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -97,6 +97,7 @@ struct ddraw struct wined3d_adapter *wined3d_adapter; struct wined3d_output *wined3d_output; struct wined3d_device *wined3d_device; + struct wined3d_device_context *immediate_context; DWORD flags; LONG device_state;
@@ -326,6 +327,7 @@ struct d3d_device
IUnknown *outer_unknown; struct wined3d_device *wined3d_device; + struct wined3d_device_context *immediate_context; struct ddraw *ddraw; IUnknown *rt_iface;
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index ce937b0c543..feec6774b15 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -283,7 +283,7 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface) if (This->vertex_buffer) wined3d_buffer_decref(This->vertex_buffer);
- wined3d_device_set_rendertarget_view(This->wined3d_device, 0, NULL, FALSE); + wined3d_device_context_set_rendertarget_view(This->immediate_context, 0, NULL, FALSE);
wined3d_stateblock_decref(This->state); if (This->recording) @@ -1861,7 +1861,7 @@ static HRESULT d3d_device_set_render_target(struct d3d_device *device, return DDERR_INVALIDPARAMS; }
- if (FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, + if (FAILED(hr = wined3d_device_context_set_rendertarget_view(device->immediate_context, 0, ddraw_surface_get_rendertarget_view(target), FALSE))) return hr;
@@ -3523,7 +3523,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface, wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vertex_count); + wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vertex_count, 0, 0);
done: wined3d_mutex_unlock(); @@ -3733,10 +3733,10 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
wined3d_stateblock_set_vertex_declaration(device->state, ddraw_find_decl(device->ddraw, fvf)); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0); - wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / stride); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(*indices), index_count); + wined3d_device_context_draw_indexed(device->immediate_context, vb_pos / stride, + ib_pos / sizeof(*indices), index_count, 0, 0);
done: wined3d_mutex_unlock(); @@ -4063,7 +4063,7 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / dst_stride, vertex_count); + wined3d_device_context_draw(device->immediate_context, vb_pos / dst_stride, vertex_count, 0, 0);
done: wined3d_mutex_unlock(); @@ -4194,13 +4194,13 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface, if (FAILED(hr)) goto done; wined3d_stateblock_set_index_buffer(device->state, device->index_buffer, WINED3DFMT_R16_UINT); - wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vtx_dst_stride);
wined3d_stateblock_set_vertex_declaration(device->state, ddraw_find_decl(device->ddraw, fvf)); wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count); + wined3d_device_context_draw_indexed(device->immediate_context, + vb_pos / vtx_dst_stride, ib_pos / sizeof(WORD), index_count, 0, 0);
done: wined3d_mutex_unlock(); @@ -4323,7 +4323,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); + wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 0);
wined3d_mutex_unlock();
@@ -4429,7 +4429,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, * 1) Upload the indices to the index buffer * 2) Set the index source * 3) Set the Vertex Buffer as the Stream source - * 4) Call wined3d_device_draw_indexed_primitive() + * 4) Call wined3d_device_context_draw_indexed() */
wined3d_mutex_lock(); @@ -4463,7 +4463,6 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, device->index_buffer_pos = ib_pos + index_count * sizeof(WORD);
/* Set the index stream */ - wined3d_stateblock_set_base_vertex_index(device->state, start_vertex); wined3d_stateblock_set_index_buffer(device->state, device->index_buffer, WINED3DFMT_R16_UINT);
/* Set the vertex stream source */ @@ -4478,7 +4477,8 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count); + wined3d_device_context_draw_indexed(device->immediate_context, start_vertex, + ib_pos / sizeof(WORD), index_count, 0, 0);
wined3d_mutex_unlock();
@@ -6955,12 +6955,12 @@ enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device if (!depthStencil) { TRACE("Setting wined3d depth stencil to NULL\n"); - wined3d_device_set_depth_stencil_view(device->wined3d_device, NULL); + wined3d_device_context_set_depth_stencil_view(device->immediate_context, NULL); return WINED3D_ZB_FALSE; }
dsi = impl_from_IDirectDrawSurface7(depthStencil); - wined3d_device_set_depth_stencil_view(device->wined3d_device, + wined3d_device_context_set_depth_stencil_view(device->immediate_context, ddraw_surface_get_rendertarget_view(dsi));
IDirectDrawSurface7_Release(depthStencil); @@ -7030,13 +7030,14 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, c
/* This is for convenience. */ device->wined3d_device = ddraw->wined3d_device; + device->immediate_context = ddraw->immediate_context; wined3d_device_incref(ddraw->wined3d_device); device->update_state = device->state = ddraw->state; device->stateblock_state = ddraw->stateblock_state; wined3d_stateblock_incref(ddraw->state);
/* Render to the back buffer */ - if (FAILED(hr = wined3d_device_set_rendertarget_view(ddraw->wined3d_device, + if (FAILED(hr = wined3d_device_context_set_rendertarget_view(device->immediate_context, 0, ddraw_surface_get_rendertarget_view(target), TRUE))) { ERR("Failed to set render target, hr %#x.\n", hr); diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index d87878883c7..1427e32e28c 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -83,7 +83,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); for (i = 0; i < count; ++i) - wined3d_device_draw_primitive(device->wined3d_device, p[i].wFirst, p[i].wCount); + wined3d_device_context_draw(device->immediate_context, p[i].wFirst, p[i].wCount, 0, 0);
instr += sizeof(*p) * count; break; @@ -191,7 +191,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d wined3d_stateblock_set_index_buffer(device->state, buffer->index_buffer, WINED3DFMT_R16_UINT); wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d_device_sync_surfaces(device); - wined3d_device_draw_indexed_primitive(device->wined3d_device, index_pos, index_count); + wined3d_device_context_draw_indexed(device->immediate_context, 0, index_pos, index_count, 0, 0);
buffer->index_pos = index_pos + index_count; break; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 6af1fce825f..0eaaeec9975 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1369,7 +1369,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface *
src_rtv = ddraw_surface_get_rendertarget_view(src_impl); if (rtv == dst_impl->wined3d_rtv) - wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE); + wined3d_device_context_set_rendertarget_view(dst_impl->ddraw->immediate_context, 0, src_rtv, FALSE); wined3d_rendertarget_view_set_parent(src_rtv, dst_impl); dst_impl->wined3d_rtv = src_rtv; wined3d_texture_set_sub_resource_parent(src_impl->wined3d_texture, 0, dst_impl); @@ -1406,7 +1406,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface * src_impl = impl_from_IDirectDrawSurface(current); src_rtv = ddraw_surface_get_rendertarget_view(src_impl); if (rtv == dst_impl->wined3d_rtv) - wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE); + wined3d_device_context_set_rendertarget_view(dst_impl->ddraw->immediate_context, 0, src_rtv, FALSE); wined3d_rendertarget_view_set_parent(src_rtv, dst_impl); dst_impl->wined3d_rtv = src_rtv; wined3d_texture_set_sub_resource_parent(src_impl->wined3d_texture, 0, dst_impl); @@ -1429,7 +1429,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface * /* We don't have to worry about potential texture bindings, since * flippable surfaces can never be textures. */ if (rtv == src_impl->wined3d_rtv) - wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, tmp_rtv, FALSE); + wined3d_device_context_set_rendertarget_view(dst_impl->ddraw->immediate_context, 0, tmp_rtv, FALSE); wined3d_rendertarget_view_set_parent(tmp_rtv, src_impl); src_impl->wined3d_rtv = tmp_rtv; wined3d_texture_set_sub_resource_parent(texture, 0, src_impl); @@ -2183,7 +2183,7 @@ static HRESULT ddraw_surface_delete_attached_surface(struct ddraw_surface *surfa * but don't cleanup properly after the relevant dll is unloaded. */ if (attachment->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER && wined3d_device_get_depth_stencil_view(surface->ddraw->wined3d_device) == attachment->wined3d_rtv) - wined3d_device_set_depth_stencil_view(surface->ddraw->wined3d_device, NULL); + wined3d_device_context_set_depth_stencil_view(surface->ddraw->immediate_context, NULL); wined3d_mutex_unlock();
/* Set attached_iface to NULL before releasing it, the surface may go
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88280
Your paranoid android.
=== debiant2 (32 bit report) ===
ddraw: ddraw1.c:14214: Test failed: Expect window rect (0,0)-(1024,768), got (-7,-26)-(1003,709).
=== debiant2 (64 bit WoW report) ===
ddraw: ddraw1.c:14214: Test failed: Expect window rect (0,0)-(1024,768), got (1031,26)-(2041,728).
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/cs.c | 8 ++++---- dlls/wined3d/device.c | 2 +- dlls/wined3d/wined3d_private.h | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index ef3c0c76c14..462e6d8a93b 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2615,12 +2615,12 @@ static void wined3d_cs_exec_copy_uav_counter(struct wined3d_cs *cs, const void * wined3d_resource_release(&op->buffer->resource); }
-void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, - unsigned int offset, struct wined3d_unordered_access_view *uav) +void wined3d_device_context_emit_copy_uav_counter(struct wined3d_device_context *context, + struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav) { struct wined3d_cs_copy_uav_counter *op;
- op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_COPY_UAV_COUNTER; op->buffer = dst_buffer; op->offset = offset; @@ -2628,7 +2628,7 @@ void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buff
wined3d_resource_acquire(&dst_buffer->resource);
- wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); }
static void wined3d_cs_exec_generate_mipmaps(struct wined3d_cs *cs, const void *data) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 3b22f7b2086..540dcfdcc9f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4818,7 +4818,7 @@ void CDECL wined3d_device_copy_uav_counter(struct wined3d_device *device, TRACE("device %p, dst_buffer %p, offset %u, uav %p.\n", device, dst_buffer, offset, uav);
- wined3d_cs_emit_copy_uav_counter(device->cs, dst_buffer, offset, uav); + wined3d_device_context_emit_copy_uav_counter(&device->cs->c, dst_buffer, offset, uav); }
static bool resources_format_compatible(const struct wined3d_resource *src_resource, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index db6b6488e59..957290c7ece 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4733,8 +4733,6 @@ void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs *cs, struct wined const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs, struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) DECLSPEC_HIDDEN; -void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, - unsigned int offset, struct wined3d_unordered_access_view *uav) DECLSPEC_HIDDEN; void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -4783,6 +4781,9 @@ static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d cs->c.ops->push_constants(&cs->c, p, start_idx, count, constants); }
+void wined3d_device_context_emit_copy_uav_counter(struct wined3d_device_context *context, + struct wined3d_buffer *dst_buffer, unsigned int offset, + struct wined3d_unordered_access_view *uav) DECLSPEC_HIDDEN; void wined3d_device_context_emit_draw(struct wined3d_device_context *context, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 4 ++-- dlls/wined3d/device.c | 8 ++++---- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 2738ff1a5bd..e84f88ff5f2 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -1273,7 +1273,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_UpdateSubresource(ID3D11De static void STDMETHODCALLTYPE d3d11_immediate_context_CopyStructureCount(ID3D11DeviceContext1 *iface, ID3D11Buffer *dst_buffer, UINT dst_offset, ID3D11UnorderedAccessView *src_view) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d11_unordered_access_view *uav; struct d3d_buffer *buffer_impl;
@@ -1284,7 +1284,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopyStructureCount(ID3D11D uav = unsafe_impl_from_ID3D11UnorderedAccessView(src_view);
wined3d_mutex_lock(); - wined3d_device_copy_uav_counter(device->wined3d_device, + wined3d_device_context_copy_uav_counter(context->wined3d_context, buffer_impl->wined3d_buffer, dst_offset, uav->wined3d_view); wined3d_mutex_unlock(); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 540dcfdcc9f..c03621c706a 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4812,13 +4812,13 @@ float CDECL wined3d_device_get_npatch_mode(const struct wined3d_device *device) return 0.0f; }
-void CDECL wined3d_device_copy_uav_counter(struct wined3d_device *device, +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) { - TRACE("device %p, dst_buffer %p, offset %u, uav %p.\n", - device, dst_buffer, offset, uav); + TRACE("context %p, dst_buffer %p, offset %u, uav %p.\n", + context, dst_buffer, offset, uav);
- wined3d_device_context_emit_copy_uav_counter(&device->cs->c, dst_buffer, offset, uav); + wined3d_device_context_emit_copy_uav_counter(context, dst_buffer, offset, uav); }
static bool resources_format_compatible(const struct wined3d_resource *src_resource, diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 918e9e253cc..3ea90e0c925 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -46,7 +46,6 @@ @ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr) @ cdecl wined3d_device_copy_resource(ptr ptr ptr) @ cdecl wined3d_device_copy_sub_resource_region(ptr ptr long long long long ptr long ptr long) -@ cdecl wined3d_device_copy_uav_counter(ptr ptr long ptr) @ cdecl wined3d_device_create(ptr ptr long ptr long long ptr long ptr ptr) @ cdecl wined3d_device_decref(ptr) @ cdecl wined3d_device_dispatch_compute(ptr long long long) @@ -166,6 +165,7 @@ @ cdecl wined3d_device_update_texture(ptr ptr ptr) @ cdecl wined3d_device_validate_device(ptr 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_indexed(ptr long long long long long) @ cdecl wined3d_device_context_draw_indirect(ptr ptr long long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 18dab157834..bff77b2b949 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2363,8 +2363,6 @@ HRESULT __cdecl wined3d_device_copy_sub_resource_region(struct wined3d_device *d 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_copy_uav_counter(struct wined3d_device *device, - struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav); 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, const enum wined3d_feature_level *feature_levels, unsigned int feature_level_count, @@ -2557,6 +2555,8 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture); HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
+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); void __cdecl wined3d_device_context_dispatch(struct wined3d_device_context *context, unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z); void __cdecl wined3d_device_context_dispatch_indirect(struct wined3d_device_context *context,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com