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