From: Steve Schnepp steve.schnepp@pwkf.org
We have no dx7 specifics, therefore using directly the d3d_device is simpler and more performant. --- dlls/ddraw/device.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 6e6cd895a95..9ce37d89b76 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -34,8 +34,8 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); WINE_DECLARE_DEBUG_CHANNEL(ddraw_perf); WINE_DECLARE_DEBUG_CHANNEL(ddraw_buffer);
-static HRESULT ddraw_buffer_flush_d7(IDirect3DDevice7 *iface); -static HRESULT ddraw_buffer_add_d7(IDirect3DDevice7 *iface, D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count, DWORD flags, UINT stride); +static HRESULT ddraw_buffer_flush_d7(struct d3d_device *device); +static HRESULT ddraw_buffer_add_d7(struct d3d_device *device, D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count, DWORD flags, UINT stride);
/* The device ID */ const GUID IID_D3DDEVICE_WineD3D = { @@ -1598,7 +1598,7 @@ static HRESULT d3d_device7_EndScene(IDirect3DDevice7 *iface) TRACE("iface %p.\n", iface);
// Flush the vertices buffer - ddraw_buffer_flush_d7(iface); + ddraw_buffer_flush_d7(device);
wined3d_mutex_lock(); hr = wined3d_device_end_scene(device->wined3d_device); @@ -2557,7 +2557,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, TRACE("iface %p, state %#x, value %#lx.\n", iface, state, value);
// Flush the vertices buffer - ddraw_buffer_flush_d7(iface); + ddraw_buffer_flush_d7(device);
wined3d_mutex_lock(); /* Some render states need special care */ @@ -3464,7 +3464,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface,
if (!TRACE_ON(ddraw_buffer)) goto old;
- hr = ddraw_buffer_add_d7(iface, primitive_type, fvf, vertices, vertex_count, flags, stride); + hr = ddraw_buffer_add_d7(device, primitive_type, fvf, vertices, vertex_count, flags, stride); if (hr == D3D_OK) { /* Buffered successfuly -> returning immediatly :-) */ return D3D_OK; @@ -3475,9 +3475,9 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface, FIXME("cannot buffer, flushing first\n");
// Cannot buffer, need to flush the rest, then process this one - hr = ddraw_buffer_flush_d7(iface); + hr = ddraw_buffer_flush_d7(device);
- hr = ddraw_buffer_add_d7(iface, primitive_type, fvf, vertices, vertex_count, flags, stride); + hr = ddraw_buffer_add_d7(device, primitive_type, fvf, vertices, vertex_count, flags, stride); if (hr == D3D_OK) { /* Buffered successfuly -> returning immediatly :-) */ return D3D_OK; @@ -4682,7 +4682,7 @@ static HRESULT d3d_device7_SetTexture(IDirect3DDevice7 *iface, TRACE("iface %p, stage %lu, texture %p.\n", iface, stage, texture);
// Flush the vertices buffer - ddraw_buffer_flush_d7(iface); + ddraw_buffer_flush_d7(device);
if (surf && (surf->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE)) { @@ -4969,7 +4969,7 @@ static HRESULT d3d_device7_SetTextureStageState(IDirect3DDevice7 *iface, iface, stage, state, value);
// Flush the vertices buffer - ddraw_buffer_flush_d7(iface); + ddraw_buffer_flush_d7(device);
if (state > D3DTSS_TEXTURETRANSFORMFLAGS) { @@ -7024,8 +7024,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_su * * Note : it does transform D3DPT_TRIANGLEFAN into D3DPT_TRIANGLELIST. */ -static HRESULT ddraw_buffer_add_d7(IDirect3DDevice7 *iface, D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count, DWORD flags, UINT stride) { - struct d3d_device *device = impl_from_IDirect3DDevice7(iface); +static HRESULT ddraw_buffer_add_d7(struct d3d_device *device, D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count, DWORD flags, UINT stride) { int buffer_indice_count_initial = device->ddraw_device_buffer.buffer_vertex_count;
if (flags) return WINED3DERR_NOTAVAILABLE; @@ -7152,9 +7151,7 @@ done: return hr; }
-static HRESULT ddraw_buffer_flush_d7(IDirect3DDevice7 *iface) { - struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - +static HRESULT ddraw_buffer_flush_d7(struct d3d_device *device) { /* Nothing to do if it is empty */ if (! device->ddraw_device_buffer.buffer_vertex_count) return D3D_OK;