[PATCH 1/5] wined3d: Remove state management methods from the IWineD3DDevice interface.

Henri Verbeet hverbeet at codeweavers.com
Mon May 16 16:01:21 CDT 2011


---
 dlls/d3d10core/device.c    |   13 +-
 dlls/d3d8/device.c         |  131 ++--
 dlls/d3d9/device.c         |  138 ++--
 dlls/ddraw/device.c        |  300 ++++----
 dlls/ddraw/executebuffer.c |   25 +-
 dlls/ddraw/surface.c       |    4 +-
 dlls/ddraw/vertexbuffer.c  |   53 +-
 dlls/ddraw/viewport.c      |   17 +-
 dlls/wined3d/device.c      | 1944 ++++++++++++++++++++++----------------------
 dlls/wined3d/stateblock.c  |   56 +-
 dlls/wined3d/wined3d.spec  |   64 ++
 include/wine/wined3d.idl   |  340 ++------
 12 files changed, 1466 insertions(+), 1619 deletions(-)

diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 8936f36..c2df413 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -129,7 +129,7 @@ static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface, ID3D
 
     TRACE("iface %p, shader %p\n", iface, shader);
 
-    IWineD3DDevice_SetPixelShader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
+    wined3d_device_set_pixel_shader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
 }
 
 static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
@@ -146,7 +146,7 @@ static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface, ID3D
 
     TRACE("iface %p, shader %p\n", iface, shader);
 
-    IWineD3DDevice_SetVertexShader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
+    wined3d_device_set_vertex_shader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
 }
 
 static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
@@ -157,7 +157,7 @@ static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface,
     TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
             iface, index_count, start_index_location, base_vertex_location);
 
-    IWineD3DDevice_SetBaseVertexIndex(This->wined3d_device, base_vertex_location);
+    wined3d_device_set_base_vertex_index(This->wined3d_device, base_vertex_location);
     IWineD3DDevice_DrawIndexedPrimitive(This->wined3d_device, start_index_location, index_count);
 }
 
@@ -185,7 +185,7 @@ static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface,
 
     TRACE("iface %p, input_layout %p\n", iface, input_layout);
 
-    IWineD3DDevice_SetVertexDeclaration(This->wined3d_device,
+    wined3d_device_set_vertex_declaration(This->wined3d_device,
             input_layout ? ((struct d3d10_input_layout *)input_layout)->wined3d_decl : NULL);
 }
 
@@ -201,7 +201,7 @@ static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *ifac
 
     for (i = 0; i < buffer_count; ++i)
     {
-        IWineD3DDevice_SetStreamSource(This->wined3d_device, start_slot,
+        wined3d_device_set_stream_source(This->wined3d_device, start_slot,
                 buffers[i] ? ((struct d3d10_buffer *)buffers[i])->wined3d_buffer : NULL,
                 offsets[i], strides[i]);
     }
@@ -215,7 +215,8 @@ static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
     TRACE("iface %p, buffer %p, format %s, offset %u.\n",
             iface, buffer, debug_dxgi_format(format), offset);
 
-    IWineD3DDevice_SetIndexBuffer(This->wined3d_device, buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
+    wined3d_device_set_index_buffer(This->wined3d_device,
+            buffer ? ((struct d3d10_buffer *)buffer)->wined3d_buffer : NULL,
             wined3dformat_from_dxgi_format(format));
     if (offset) FIXME("offset %u not supported.\n", offset);
 }
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 2e749e3..7d5936d 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -595,14 +595,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface,
     TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters);
 
     wined3d_mutex_lock();
-    IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
+    wined3d_device_set_index_buffer(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
     for (i = 0; i < 16; ++i)
     {
-        IWineD3DDevice_SetStreamSource(This->WineD3DDevice, i, NULL, 0, 0);
+        wined3d_device_set_stream_source(This->WineD3DDevice, i, NULL, 0, 0);
     }
     for (i = 0; i < 16; ++i)
     {
-        IWineD3DDevice_SetTexture(This->WineD3DDevice, i, NULL);
+        wined3d_device_set_texture(This->WineD3DDevice, i, NULL);
     }
 
     IWineD3DDevice_EnumResources(This->WineD3DDevice, reset_enum_callback, &resources_ok);
@@ -634,7 +634,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface,
     hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
     if (SUCCEEDED(hr))
     {
-        hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0);
+        hr = wined3d_device_set_render_state(This->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0);
         This->lost = FALSE;
     }
     else
@@ -724,7 +724,7 @@ static void WINAPI IDirect3DDevice8Impl_SetGammaRamp(IDirect3DDevice8 *iface, DW
 
     /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
     wined3d_mutex_lock();
-    IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, 0, Flags, (CONST WINED3DGAMMARAMP *) pRamp);
+    wined3d_device_set_gamma_ramp(This->WineD3DDevice, 0, Flags, (const WINED3DGAMMARAMP *)pRamp);
     wined3d_mutex_unlock();
 }
 
@@ -736,7 +736,7 @@ static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(IDirect3DDevice8 *iface, D3
 
     /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
     wined3d_mutex_lock();
-    IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, 0, (WINED3DGAMMARAMP *) pRamp);
+    wined3d_device_get_gamma_ramp(This->WineD3DDevice, 0, (WINED3DGAMMARAMP *)pRamp);
     wined3d_mutex_unlock();
 }
 
@@ -1137,14 +1137,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
         }
     }
 
-    hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &original_ds);
+    hr = wined3d_device_get_depth_stencil(This->WineD3DDevice, &original_ds);
     if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND)
     {
-        hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wined3d_surface : NULL);
+        hr = wined3d_device_set_depth_stencil(This->WineD3DDevice, pZSurface ? pZSurface->wined3d_surface : NULL);
         if (SUCCEEDED(hr) && pRenderTarget)
         {
-            hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wined3d_surface, TRUE);
-            if (FAILED(hr)) IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, original_ds);
+            hr = wined3d_device_set_render_target(This->WineD3DDevice, 0, pSurface->wined3d_surface, TRUE);
+            if (FAILED(hr))
+                wined3d_device_set_depth_stencil(This->WineD3DDevice, original_ds);
         }
     }
     if (original_ds)
@@ -1169,7 +1170,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *ifa
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &wined3d_surface);
+    hr = wined3d_device_get_render_target(This->WineD3DDevice, 0, &wined3d_surface);
     if (SUCCEEDED(hr) && wined3d_surface)
     {
         *ppRenderTarget = wined3d_surface_get_parent(wined3d_surface);
@@ -1200,7 +1201,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevic
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &wined3d_surface);
+    hr = wined3d_device_get_depth_stencil(This->WineD3DDevice, &wined3d_surface);
     if (SUCCEEDED(hr))
     {
         *ppZStencilSurface = wined3d_surface_get_parent(wined3d_surface);
@@ -1272,7 +1273,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(IDirect3DDevice8 *iface,
 
     /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix);
+    hr = wined3d_device_set_transform(This->WineD3DDevice, State, (const WINED3DMATRIX *)lpMatrix);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1288,7 +1289,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTransform(IDirect3DDevice8 *iface,
 
     /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
+    hr = wined3d_device_get_transform(This->WineD3DDevice, State, (WINED3DMATRIX *)pMatrix);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1320,7 +1321,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(IDirect3DDevice8 *iface,
 
     /* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
+    hr = wined3d_device_set_viewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1336,7 +1337,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetViewport(IDirect3DDevice8 *iface,
 
     /* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
+    hr = wined3d_device_get_viewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1352,7 +1353,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(IDirect3DDevice8 *iface,
 
     /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
+    hr = wined3d_device_set_material(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1368,7 +1369,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(IDirect3DDevice8 *iface,
 
     /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
+    hr = wined3d_device_get_material(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1384,7 +1385,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetLight(IDirect3DDevice8 *iface, DWO
 
     /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
+    hr = wined3d_device_set_light(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1400,7 +1401,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetLight(IDirect3DDevice8 *iface, DWO
 
     /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
+    hr = wined3d_device_get_light(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1415,7 +1416,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(IDirect3DDevice8 *iface,
     TRACE("iface %p, index %u, enable %#x.\n", iface, Index, Enable);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable);
+    hr = wined3d_device_set_light_enable(This->WineD3DDevice, Index, Enable);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1430,7 +1431,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(IDirect3DDevice8 *ifac
     TRACE("iface %p, index %u, enable %p.\n", iface, Index, pEnable);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable);
+    hr = wined3d_device_get_light_enable(This->WineD3DDevice, Index, pEnable);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1445,7 +1446,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetClipPlane(IDirect3DDevice8 *iface,
     TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane);
+    hr = wined3d_device_set_clip_plane(This->WineD3DDevice, Index, pPlane);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1460,7 +1461,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetClipPlane(IDirect3DDevice8 *iface,
     TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane);
+    hr = wined3d_device_get_clip_plane(This->WineD3DDevice, Index, pPlane);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1490,11 +1491,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(IDirect3DDevice8 *ifac
     {
         case D3DRS_ZBIAS:
             wined3d_value.f = Value * zbias_factor;
-            hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, WINED3DRS_DEPTHBIAS, wined3d_value.d);
+            hr = wined3d_device_set_render_state(This->WineD3DDevice, WINED3DRS_DEPTHBIAS, wined3d_value.d);
             break;
 
         default:
-            hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value);
+            hr = wined3d_device_set_render_state(This->WineD3DDevice, State, Value);
     }
     wined3d_mutex_unlock();
 
@@ -1518,12 +1519,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderState(IDirect3DDevice8 *ifac
     switch (State)
     {
         case D3DRS_ZBIAS:
-            hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, WINED3DRS_DEPTHBIAS, &wined3d_value.d);
+            hr = wined3d_device_get_render_state(This->WineD3DDevice, WINED3DRS_DEPTHBIAS, &wined3d_value.d);
             if (SUCCEEDED(hr)) *pValue = wined3d_value.f / zbias_factor;
             break;
 
         default:
-        hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue);
+        hr = wined3d_device_get_render_state(This->WineD3DDevice, State, pValue);
     }
     wined3d_mutex_unlock();
 
@@ -1707,7 +1708,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetClipStatus(IDirect3DDevice8 *iface
 /* FIXME: Verify that D3DCLIPSTATUS8 ~= WINED3DCLIPSTATUS */
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
+    hr = wined3d_device_set_clip_status(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1722,7 +1723,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(IDirect3DDevice8 *iface
     TRACE("iface %p, clip_status %p.\n", iface, pClipStatus);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
+    hr = wined3d_device_get_clip_status(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1742,7 +1743,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface,
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &wined3d_texture);
+    hr = wined3d_device_get_texture(This->WineD3DDevice, Stage, &wined3d_texture);
     if (FAILED(hr))
     {
         WARN("Failed to get texture for stage %u, hr %#x.\n", Stage, hr);
@@ -1775,7 +1776,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(IDirect3DDevice8 *iface, D
     TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, pTexture);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage,
+    hr = wined3d_device_set_texture(This->WineD3DDevice, Stage,
             pTexture ? ((IDirect3DBaseTexture8Impl *)pTexture)->wined3d_texture : NULL);
     wined3d_mutex_unlock();
 
@@ -1838,8 +1839,10 @@ static HRESULT  WINAPI  IDirect3DDevice8Impl_GetTextureStageState(IDirect3DDevic
     l = &tss_lookup[Type];
 
     wined3d_mutex_lock();
-    if (l->sampler_state) hr = IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Stage, l->state, pValue);
-    else hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, l->state, pValue);
+    if (l->sampler_state)
+        hr = wined3d_device_get_sampler_state(This->WineD3DDevice, Stage, l->state, pValue);
+    else
+        hr = wined3d_device_get_texture_stage_state(This->WineD3DDevice, Stage, l->state, pValue);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1863,8 +1866,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(IDirect3DDevice8
     l = &tss_lookup[Type];
 
     wined3d_mutex_lock();
-    if (l->sampler_state) hr = IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Stage, l->state, Value);
-    else hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, l->state, Value);
+    if (l->sampler_state)
+        hr = wined3d_device_set_sampler_state(This->WineD3DDevice, Stage, l->state, Value);
+    else
+        hr = wined3d_device_set_texture_stage_state(This->WineD3DDevice, Stage, l->state, Value);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1902,7 +1907,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(IDirect3DDevice8 *i
     TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
+    hr = wined3d_device_set_palette_entries(This->WineD3DDevice, PaletteNumber, pEntries);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1917,7 +1922,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(IDirect3DDevice8 *i
     TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
+    hr = wined3d_device_get_palette_entries(This->WineD3DDevice, PaletteNumber, pEntries);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1932,7 +1937,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(IDirect3DDev
     TRACE("iface %p, palette_idx %u.\n", iface, PaletteNumber);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
+    hr = wined3d_device_set_current_texture_palette(This->WineD3DDevice, PaletteNumber);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1947,7 +1952,7 @@ static HRESULT  WINAPI  IDirect3DDevice8Impl_GetCurrentTexturePalette(IDirect3DD
     TRACE("iface %p, palette_idx %p.\n", iface, PaletteNumber);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
+    hr = wined3d_device_get_current_texture_palette(This->WineD3DDevice, PaletteNumber);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2176,9 +2181,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *ifa
         TRACE("Setting FVF, %#x\n", pShader);
 
         wined3d_mutex_lock();
-        IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
+        wined3d_device_set_vertex_declaration(This->WineD3DDevice,
                 IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration);
-        IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL);
+        wined3d_device_set_vertex_shader(This->WineD3DDevice, NULL);
         wined3d_mutex_unlock();
 
         return D3D_OK;
@@ -2196,10 +2201,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *ifa
         return D3DERR_INVALIDCALL;
     }
 
-    hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
+    hr = wined3d_device_set_vertex_declaration(This->WineD3DDevice,
             ((IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration)->wined3d_vertex_declaration);
     if (SUCCEEDED(hr))
-        hr = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, shader->wined3d_shader);
+        hr = wined3d_device_set_vertex_shader(This->WineD3DDevice, shader->wined3d_shader);
     wined3d_mutex_unlock();
 
     TRACE("Returning hr %#x\n", hr);
@@ -2217,7 +2222,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *ifa
     TRACE("iface %p, shader %p.\n", iface, ppShader);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
+    hr = wined3d_device_get_vertex_declaration(This->WineD3DDevice, &wined3d_declaration);
     if (FAILED(hr))
     {
         wined3d_mutex_unlock();
@@ -2261,7 +2266,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(IDirect3DDevice8 *
         return D3DERR_INVALIDCALL;
     }
 
-    cur = IWineD3DDevice_GetVertexShader(This->WineD3DDevice);
+    cur = wined3d_device_get_vertex_shader(This->WineD3DDevice);
     if (cur)
     {
         if (cur == shader->wined3d_shader)
@@ -2295,7 +2300,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(IDirect3DDevi
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
+    hr = wined3d_device_set_vs_consts_f(This->WineD3DDevice, Register, pConstantData, ConstantCount);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2317,7 +2322,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderConstant(IDirect3DDevi
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
+    hr = wined3d_device_get_vs_consts_f(This->WineD3DDevice, Register, pConstantData, ConstantCount);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2411,8 +2416,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(IDirect3DDevice8 *iface,
      * problem)
      */
     wined3d_mutex_lock();
-    IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, baseVertexIndex);
-    hr = IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice,
+    wined3d_device_set_base_vertex_index(This->WineD3DDevice, baseVertexIndex);
+    hr = wined3d_device_set_index_buffer(This->WineD3DDevice,
             ib ? ib->wineD3DIndexBuffer : NULL,
             ib ? ib->format : WINED3DFMT_UNKNOWN);
     wined3d_mutex_unlock();
@@ -2435,8 +2440,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface,
 
     /* The case from UINT to INT is safe because d3d8 will never set negative values */
     wined3d_mutex_lock();
-    IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex);
-    hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
+    *pBaseVertexIndex = wined3d_device_get_base_vertex_index(This->WineD3DDevice);
+    hr = wined3d_device_get_index_buffer(This->WineD3DDevice, &retIndexData);
     if (SUCCEEDED(hr) && retIndexData)
     {
         *ppIndexData = wined3d_buffer_get_parent(retIndexData);
@@ -2517,7 +2522,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(IDirect3DDevice8 *ifac
 
     if (!pShader)
     {
-        hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice, NULL);
+        hr = wined3d_device_set_pixel_shader(This->WineD3DDevice, NULL);
         wined3d_mutex_unlock();
         return hr;
     }
@@ -2531,7 +2536,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(IDirect3DDevice8 *ifac
     }
 
     TRACE("(%p) : Setting shader %p\n", This, shader);
-    hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader->wined3d_shader);
+    hr = wined3d_device_set_pixel_shader(This->WineD3DDevice, shader->wined3d_shader);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2550,7 +2555,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac
     }
 
     wined3d_mutex_lock();
-    object = IWineD3DDevice_GetPixelShader(This->WineD3DDevice);
+    object = wined3d_device_get_pixel_shader(This->WineD3DDevice);
     if (object)
     {
         IDirect3DPixelShader8Impl *d3d8_shader;
@@ -2587,7 +2592,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(IDirect3DDevice8 *i
         return D3DERR_INVALIDCALL;
     }
 
-    cur = IWineD3DDevice_GetPixelShader(This->WineD3DDevice);
+    cur = wined3d_device_get_pixel_shader(This->WineD3DDevice);
     if (cur)
     {
         if (cur == shader->wined3d_shader)
@@ -2615,7 +2620,7 @@ static HRESULT  WINAPI  IDirect3DDevice8Impl_SetPixelShaderConstant(IDirect3DDev
             iface, Register, pConstantData, ConstantCount);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
+    hr = wined3d_device_set_ps_consts_f(This->WineD3DDevice, Register, pConstantData, ConstantCount);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2631,7 +2636,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderConstant(IDirect3DDevic
             iface, Register, pConstantData, ConstantCount);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
+    hr = wined3d_device_get_ps_consts_f(This->WineD3DDevice, Register, pConstantData, ConstantCount);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2719,9 +2724,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa
             iface, StreamNumber, pStreamData, Stride);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber,
-                                        NULL == pStreamData ? NULL : ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer,
-                                        0/* Offset in bytes */, Stride);
+    hr = wined3d_device_set_stream_source(This->WineD3DDevice, StreamNumber,
+            pStreamData ? ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer : NULL,
+            0/* Offset in bytes */, Stride);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2742,7 +2747,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *ifa
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber,
+    hr = wined3d_device_get_stream_source(This->WineD3DDevice, StreamNumber,
             &retStream, 0 /* Offset in bytes */, pStride);
     if (SUCCEEDED(hr) && retStream)
     {
@@ -3194,7 +3199,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT
         return hr;
     }
 
-    hr = IWineD3DDevice_SetRenderState(device->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0);
+    hr = wined3d_device_set_render_state(device->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0);
     wined3d_mutex_unlock();
     if (FAILED(hr))
     {
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index c7ebfc9..443f229 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -591,12 +591,14 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
      * below fails, the device is considered "lost", and _Reset and _Release are the only allowed calls
      */
     wined3d_mutex_lock();
-    IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
-    for(i = 0; i < 16; i++) {
-        IWineD3DDevice_SetStreamSource(This->WineD3DDevice, i, NULL, 0, 0);
+    wined3d_device_set_index_buffer(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
+    for (i = 0; i < 16; ++i)
+    {
+        wined3d_device_set_stream_source(This->WineD3DDevice, i, NULL, 0, 0);
     }
-    for(i = 0; i < 16; i++) {
-        IWineD3DDevice_SetTexture(This->WineD3DDevice, i, NULL);
+    for (i = 0; i < 16; ++i)
+    {
+        wined3d_device_set_texture(This->WineD3DDevice, i, NULL);
     }
 
     IWineD3DDevice_EnumResources(This->WineD3DDevice, reset_enum_callback, &resources_ok);
@@ -730,7 +732,7 @@ static void WINAPI IDirect3DDevice9Impl_SetGammaRamp(IDirect3DDevice9Ex *iface,
 
     /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
     wined3d_mutex_lock();
-    IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, iSwapChain, Flags, (CONST WINED3DGAMMARAMP *)pRamp);
+    wined3d_device_set_gamma_ramp(This->WineD3DDevice, iSwapChain, Flags, (const WINED3DGAMMARAMP *)pRamp);
     wined3d_mutex_unlock();
 }
 
@@ -743,7 +745,7 @@ static void WINAPI IDirect3DDevice9Impl_GetGammaRamp(IDirect3DDevice9Ex *iface,
 
     /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
     wined3d_mutex_lock();
-    IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, iSwapChain, (WINED3DGAMMARAMP *) pRamp);
+    wined3d_device_get_gamma_ramp(This->WineD3DDevice, iSwapChain, (WINED3DGAMMARAMP *)pRamp);
     wined3d_mutex_unlock();
 }
 
@@ -1155,7 +1157,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(IDirect3DDevice9Ex *i
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex,
+    hr = wined3d_device_set_render_target(This->WineD3DDevice, RenderTargetIndex,
             pSurface ? pSurface->wined3d_surface : NULL, TRUE);
     wined3d_mutex_unlock();
 
@@ -1183,7 +1185,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *i
 
     wined3d_mutex_lock();
 
-    hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, RenderTargetIndex, &wined3d_surface);
+    hr = wined3d_device_get_render_target(This->WineD3DDevice, RenderTargetIndex, &wined3d_surface);
 
     if (FAILED(hr))
     {
@@ -1217,7 +1219,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(IDirect3DDevic
     pSurface = (IDirect3DSurface9Impl*)pZStencilSurface;
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pSurface ? pSurface->wined3d_surface : NULL);
+    hr = wined3d_device_set_depth_stencil(This->WineD3DDevice, pSurface ? pSurface->wined3d_surface : NULL);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1237,7 +1239,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevic
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &wined3d_surface);
+    hr = wined3d_device_get_depth_stencil(This->WineD3DDevice, &wined3d_surface);
     if (SUCCEEDED(hr))
     {
         *ppZStencilSurface = wined3d_surface_get_parent(wined3d_surface);
@@ -1310,7 +1312,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(IDirect3DDevice9Ex *ifac
 
     /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix);
+    hr = wined3d_device_set_transform(This->WineD3DDevice, State, (const WINED3DMATRIX *)lpMatrix);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1326,7 +1328,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(IDirect3DDevice9Ex *ifac
 
     /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
+    hr = wined3d_device_get_transform(This->WineD3DDevice, State, (WINED3DMATRIX *)pMatrix);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1358,7 +1360,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(IDirect3DDevice9Ex *iface
 
     /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
+    hr = wined3d_device_set_viewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1374,7 +1376,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(IDirect3DDevice9Ex *iface
 
     /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
+    hr = wined3d_device_get_viewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1390,7 +1392,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(IDirect3DDevice9Ex *iface
 
     /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
+    hr = wined3d_device_set_material(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1406,7 +1408,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetMaterial(IDirect3DDevice9Ex *iface
 
     /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
+    hr = wined3d_device_get_material(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1422,7 +1424,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetLight(IDirect3DDevice9Ex *iface, D
 
     /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
+    hr = wined3d_device_set_light(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1438,7 +1440,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetLight(IDirect3DDevice9Ex *iface, D
 
     /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
+    hr = wined3d_device_get_light(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1453,7 +1455,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_LightEnable(IDirect3DDevice9Ex *iface
     TRACE("iface %p, index %u, enable %#x.\n", iface, Index, Enable);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable);
+    hr = wined3d_device_set_light_enable(This->WineD3DDevice, Index, Enable);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1468,7 +1470,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetLightEnable(IDirect3DDevice9Ex *if
     TRACE("iface %p, index %u, enable %p.\n", iface, Index, pEnable);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable);
+    hr = wined3d_device_get_light_enable(This->WineD3DDevice, Index, pEnable);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1483,7 +1485,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(IDirect3DDevice9Ex *ifac
     TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane);
+    hr = wined3d_device_set_clip_plane(This->WineD3DDevice, Index, pPlane);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1498,7 +1500,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(IDirect3DDevice9Ex *ifac
     TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane);
+    hr = wined3d_device_get_clip_plane(This->WineD3DDevice, Index, pPlane);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1513,7 +1515,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_SetRenderState(IDir
     TRACE("iface %p, state %#x, value %#x.\n", iface, State, Value);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value);
+    hr = wined3d_device_set_render_state(This->WineD3DDevice, State, Value);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1528,7 +1530,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(IDirect3DDevice9Ex *if
     TRACE("iface %p, state %#x, value %p.\n", iface, State, pValue);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue);
+    hr = wined3d_device_get_render_state(This->WineD3DDevice, State, pValue);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1639,7 +1641,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetClipStatus(IDirect3DDevice9Ex *ifa
     TRACE("iface %p, clip_status %p.\n", iface, pClipStatus);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
+    hr = wined3d_device_set_clip_status(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1654,7 +1656,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(IDirect3DDevice9Ex *ifa
     TRACE("iface %p, clip_status %p.\n", iface, pClipStatus);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
+    hr = wined3d_device_get_clip_status(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1674,7 +1676,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(IDirect3DDevice9Ex *iface,
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &wined3d_texture);
+    hr = wined3d_device_get_texture(This->WineD3DDevice, Stage, &wined3d_texture);
     if (SUCCEEDED(hr) && wined3d_texture)
     {
         *ppTexture = wined3d_texture_get_parent(wined3d_texture);
@@ -1703,7 +1705,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(IDirect3DDevice9Ex *iface,
     TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetTexture(device->WineD3DDevice, stage,
+    hr = wined3d_device_set_texture(device->WineD3DDevice, stage,
             texture ? ((IDirect3DBaseTexture9Impl *)texture)->wined3d_texture : NULL);
     wined3d_mutex_unlock();
 
@@ -1762,7 +1764,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(IDirect3DDevice9
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], pValue);
+    hr = wined3d_device_get_texture_stage_state(This->WineD3DDevice, Stage, tss_lookup[Type], pValue);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1783,7 +1785,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(IDirect3DDevice9
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], Value);
+    hr = wined3d_device_set_texture_stage_state(This->WineD3DDevice, Stage, tss_lookup[Type], Value);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1798,7 +1800,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(IDirect3DDevice9Ex *i
     TRACE("iface %p, sampler %u, state %#x, value %p.\n", iface, Sampler, Type, pValue);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Sampler, Type, pValue);
+    hr = wined3d_device_get_sampler_state(This->WineD3DDevice, Sampler, Type, pValue);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1813,7 +1815,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_SetSamplerState(IDi
     TRACE("iface %p, sampler %u, state %#x, value %#x.\n", iface, Sampler, Type, Value);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Sampler, Type, Value);
+    hr = wined3d_device_set_sampler_state(This->WineD3DDevice, Sampler, Type, Value);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1843,7 +1845,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(IDirect3DDevice9Ex
     TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
+    hr = wined3d_device_set_palette_entries(This->WineD3DDevice, PaletteNumber, pEntries);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1858,7 +1860,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPaletteEntries(IDirect3DDevice9Ex
     TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
+    hr = wined3d_device_get_palette_entries(This->WineD3DDevice, PaletteNumber, pEntries);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1873,7 +1875,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetCurrentTexturePalette(IDirect3DDev
     TRACE("iface %p, palette_idx %u.\n", iface, PaletteNumber);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
+    hr = wined3d_device_set_current_texture_palette(This->WineD3DDevice, PaletteNumber);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1888,7 +1890,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetCurrentTexturePalette(IDirect3DDev
     TRACE("iface %p, palette_idx %p.\n", iface, PaletteNumber);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
+    hr = wined3d_device_get_current_texture_palette(This->WineD3DDevice, PaletteNumber);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1903,7 +1905,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetScissorRect(IDirect3DDevice9Ex *if
     TRACE("iface %p, rect %p.\n", iface, pRect);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetScissorRect(This->WineD3DDevice, pRect);
+    hr = wined3d_device_set_scissor_rect(This->WineD3DDevice, pRect);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1917,7 +1919,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetScissorRect(IDirect3DDevice9Ex *if
     TRACE("iface %p, rect %p.\n", iface, pRect);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetScissorRect(This->WineD3DDevice, pRect);
+    hr = wined3d_device_get_scissor_rect(This->WineD3DDevice, pRect);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1932,7 +1934,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetSoftwareVertexProcessing(IDirect3D
     TRACE("iface %p, software %#x.\n", iface, bSoftware);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetSoftwareVertexProcessing(This->WineD3DDevice, bSoftware);
+    hr = wined3d_device_set_software_vertex_processing(This->WineD3DDevice, bSoftware);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1946,7 +1948,7 @@ static BOOL WINAPI IDirect3DDevice9Impl_GetSoftwareVertexProcessing(IDirect3DDev
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = IWineD3DDevice_GetSoftwareVertexProcessing(This->WineD3DDevice);
+    ret = wined3d_device_get_software_vertex_processing(This->WineD3DDevice);
     wined3d_mutex_unlock();
 
     return ret;
@@ -1960,7 +1962,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetNPatchMode(IDirect3DDevice9Ex *ifa
     TRACE("iface %p, segment_count %.8e.\n", iface, nSegments);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetNPatchMode(This->WineD3DDevice, nSegments);
+    hr = wined3d_device_set_npatch_mode(This->WineD3DDevice, nSegments);
     wined3d_mutex_unlock();
 
     return hr;
@@ -1974,7 +1976,7 @@ static float WINAPI IDirect3DDevice9Impl_GetNPatchMode(IDirect3DDevice9Ex *iface
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = IWineD3DDevice_GetNPatchMode(This->WineD3DDevice);
+    ret = wined3d_device_get_npatch_mode(This->WineD3DDevice);
     wined3d_mutex_unlock();
 
     return ret;
@@ -2011,7 +2013,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(IDirect3DDevice9
             NumVertices, startIndex, primCount);
 
     wined3d_mutex_lock();
-    IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, BaseVertexIndex);
+    wined3d_device_set_base_vertex_index(This->WineD3DDevice, BaseVertexIndex);
     IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
     hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, startIndex,
             vertex_count_from_primitive_count(PrimitiveType, primCount));
@@ -2127,7 +2129,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9
     TRACE("iface %p, declaration %p.\n", iface, declaration);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
+    hr = wined3d_device_set_vertex_declaration(This->WineD3DDevice,
             declaration ? ((IDirect3DVertexDeclaration9Impl *)declaration)->wineD3DVertexDeclaration : NULL);
     wined3d_mutex_unlock();
 
@@ -2146,7 +2148,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9
     if (!declaration) return D3DERR_INVALIDCALL;
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
+    hr = wined3d_device_get_vertex_declaration(This->WineD3DDevice, &wined3d_declaration);
     if (SUCCEEDED(hr) && wined3d_declaration)
     {
         *declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
@@ -2321,7 +2323,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *i
     TRACE("iface %p, shader %p.\n", iface, shader);
 
     wined3d_mutex_lock();
-    hr =  IWineD3DDevice_SetVertexShader(This->WineD3DDevice,
+    hr =  wined3d_device_set_vertex_shader(This->WineD3DDevice,
             shader ? ((IDirect3DVertexShader9Impl *)shader)->wined3d_shader : NULL);
     wined3d_mutex_unlock();
 
@@ -2337,7 +2339,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *i
     TRACE("iface %p, shader %p.\n", iface, shader);
 
     wined3d_mutex_lock();
-    wined3d_shader = IWineD3DDevice_GetVertexShader(This->WineD3DDevice);
+    wined3d_shader = wined3d_device_get_vertex_shader(This->WineD3DDevice);
     if (wined3d_shader)
     {
         *shader = wined3d_shader_get_parent(wined3d_shader);
@@ -2371,7 +2373,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDev
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_set_vs_consts_f(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2393,7 +2395,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDev
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_get_vs_consts_f(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2408,7 +2410,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(IDirect3DDev
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetVertexShaderConstantI(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_set_vs_consts_i(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2423,7 +2425,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(IDirect3DDev
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetVertexShaderConstantI(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_get_vs_consts_i(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2438,7 +2440,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(IDirect3DDev
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetVertexShaderConstantB(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_set_vs_consts_b(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2453,7 +2455,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(IDirect3DDev
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetVertexShaderConstantB(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_get_vs_consts_b(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2469,7 +2471,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(IDirect3DDevice9Ex *i
             iface, StreamNumber, pStreamData, OffsetInBytes, Stride);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber,
+    hr = wined3d_device_set_stream_source(This->WineD3DDevice, StreamNumber,
             pStreamData ? ((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer : NULL,
             OffsetInBytes, Stride);
     wined3d_mutex_unlock();
@@ -2492,7 +2494,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *i
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
+    hr = wined3d_device_get_stream_source(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
     if (SUCCEEDED(hr) && retStream)
     {
         *pStream = wined3d_buffer_get_parent(retStream);
@@ -2521,7 +2523,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9E
     TRACE("iface %p, stream_idx %u, freq %u.\n", iface, StreamNumber, Divider);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider);
+    hr = wined3d_device_set_stream_source_freq(This->WineD3DDevice, StreamNumber, Divider);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2536,7 +2538,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSourceFreq(IDirect3DDevice9E
     TRACE("iface %p, stream_idx %u, freq %p.\n", iface, StreamNumber, Divider);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider);
+    hr = wined3d_device_get_stream_source_freq(This->WineD3DDevice, StreamNumber, Divider);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2552,7 +2554,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(IDirect3DDevice9Ex *iface,
     TRACE("iface %p, buffer %p.\n", iface, pIndexData);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice,
+    hr = wined3d_device_set_index_buffer(This->WineD3DDevice,
             ib ? ib->wineD3DIndexBuffer : NULL,
             ib ? ib->format : WINED3DFMT_UNKNOWN);
     wined3d_mutex_unlock();
@@ -2574,7 +2576,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface,
     }
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
+    hr = wined3d_device_get_index_buffer(This->WineD3DDevice, &retIndexData);
     if (SUCCEEDED(hr) && retIndexData)
     {
         *ppIndexData = wined3d_buffer_get_parent(retIndexData);
@@ -2630,7 +2632,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *if
     TRACE("iface %p, shader %p.\n", iface, shader);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice,
+    hr = wined3d_device_set_pixel_shader(This->WineD3DDevice,
             shader ? ((IDirect3DPixelShader9Impl *)shader)->wined3d_shader : NULL);
     wined3d_mutex_unlock();
 
@@ -2648,7 +2650,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *if
     if (!shader) return D3DERR_INVALIDCALL;
 
     wined3d_mutex_lock();
-    wined3d_shader = IWineD3DDevice_GetPixelShader(This->WineD3DDevice);
+    wined3d_shader = wined3d_device_get_pixel_shader(This->WineD3DDevice);
     if (wined3d_shader)
     {
         *shader = wined3d_shader_get_parent(wined3d_shader);
@@ -2675,7 +2677,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevi
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_set_ps_consts_f(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2690,7 +2692,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(IDirect3DDevi
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_get_ps_consts_f(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2705,7 +2707,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(IDirect3DDevi
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPixelShaderConstantI(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_set_ps_consts_i(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2720,7 +2722,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(IDirect3DDevi
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetPixelShaderConstantI(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_get_ps_consts_i(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2735,7 +2737,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(IDirect3DDevi
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_SetPixelShaderConstantB(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_set_ps_consts_b(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
@@ -2750,7 +2752,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(IDirect3DDevi
     TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
 
     wined3d_mutex_lock();
-    hr = IWineD3DDevice_GetPixelShaderConstantB(This->WineD3DDevice, reg_idx, data, count);
+    hr = wined3d_device_get_ps_consts_b(This->WineD3DDevice, reg_idx, data, count);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index bce0dde..79768f8 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -297,7 +297,7 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
 
         /* Set the device up to render to the front buffer since the back
          * buffer will vanish soon. */
-        IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
+        wined3d_device_set_render_target(This->wineD3DDevice, 0,
                 This->ddraw->d3d_target->wined3d_surface, TRUE);
 
         /* Release the WineD3DDevice. This won't destroy it */
@@ -1373,24 +1373,14 @@ IDirect3DDeviceImpl_1_SetMatrix(IDirect3DDevice *iface,
 
     *m = *D3DMatrix;
 
-    if(This->world == D3DMatHandle)
-    {
-        IWineD3DDevice_SetTransform(This->wineD3DDevice,
-                                    WINED3DTS_WORLDMATRIX(0),
-                                    (WINED3DMATRIX *) D3DMatrix);
-    }
-    if(This->view == D3DMatHandle)
-    {
-        IWineD3DDevice_SetTransform(This->wineD3DDevice,
-                                    WINED3DTS_VIEW,
-                                    (WINED3DMATRIX *) D3DMatrix);
-    }
-    if(This->proj == D3DMatHandle)
-    {
-        IWineD3DDevice_SetTransform(This->wineD3DDevice,
-                                    WINED3DTS_PROJECTION,
-                                    (WINED3DMATRIX *) D3DMatrix);
-    }
+    if (D3DMatHandle == This->world)
+        wined3d_device_set_transform(This->wineD3DDevice, WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)D3DMatrix);
+
+    if (D3DMatHandle == This->view)
+        wined3d_device_set_transform(This->wineD3DDevice, WINED3DTS_VIEW, (WINED3DMATRIX *)D3DMatrix);
+
+    if (D3DMatHandle == This->proj)
+        wined3d_device_set_transform(This->wineD3DDevice, WINED3DTS_PROJECTION, (WINED3DMATRIX *)D3DMatrix);
 
     LeaveCriticalSection(&ddraw_cs);
     return D3D_OK;
@@ -1861,7 +1851,7 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface,
         return D3D_OK;
     }
 
-    hr = IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
+    hr = wined3d_device_set_render_target(This->wineD3DDevice, 0,
             Target ? Target->wined3d_surface : NULL, FALSE);
     if(hr != D3D_OK)
     {
@@ -2271,9 +2261,7 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
         {
             WINED3DTEXTUREFILTERTYPE tex_mag;
 
-            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_MAGFILTER,
-                                                &tex_mag);
+            hr = wined3d_device_get_sampler_state(This->wineD3DDevice, 0, WINED3DSAMP_MAGFILTER, &tex_mag);
 
             switch (tex_mag)
             {
@@ -2295,14 +2283,14 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
             WINED3DTEXTUREFILTERTYPE tex_min;
             WINED3DTEXTUREFILTERTYPE tex_mip;
 
-            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
+            hr = wined3d_device_get_sampler_state(This->wineD3DDevice,
                     0, WINED3DSAMP_MINFILTER, &tex_min);
             if (FAILED(hr))
             {
                 LeaveCriticalSection(&ddraw_cs);
                 return hr;
             }
-            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
+            hr = wined3d_device_get_sampler_state(This->wineD3DDevice,
                     0, WINED3DSAMP_MIPFILTER, &tex_mip);
 
             switch (tex_min)
@@ -2353,14 +2341,12 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
 
         case D3DRENDERSTATE_TEXTUREADDRESS:
         case D3DRENDERSTATE_TEXTUREADDRESSU:
-            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_ADDRESSU,
-                                                Value);
+            hr = wined3d_device_get_sampler_state(This->wineD3DDevice,
+                    0, WINED3DSAMP_ADDRESSU, Value);
             break;
         case D3DRENDERSTATE_TEXTUREADDRESSV:
-            hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_ADDRESSV,
-                                                Value);
+            hr = wined3d_device_get_sampler_state(This->wineD3DDevice,
+                    0, WINED3DSAMP_ADDRESSV, Value);
             break;
 
         case D3DRENDERSTATE_BORDERCOLOR:
@@ -2382,10 +2368,9 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
                 float f;
             } wined3d_value;
 
-            hr = IWineD3DDevice_GetRenderState(This->wineD3DDevice,
-                                               WINED3DRS_DEPTHBIAS,
-                                               &wined3d_value.d);
-            if (SUCCEEDED(hr)) *Value = wined3d_value.f / zbias_factor;
+            hr = wined3d_device_get_render_state(This->wineD3DDevice, WINED3DRS_DEPTHBIAS, &wined3d_value.d);
+            if (SUCCEEDED(hr))
+                *Value = wined3d_value.f / zbias_factor;
             break;
         }
 
@@ -2398,9 +2383,7 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
                 hr = E_NOTIMPL;
                 break;
             }
-            hr = IWineD3DDevice_GetRenderState(This->wineD3DDevice,
-                                               RenderStateType,
-                                               Value);
+            hr = wined3d_device_get_render_state(This->wineD3DDevice, RenderStateType, Value);
     }
     LeaveCriticalSection(&ddraw_cs);
     return hr;
@@ -2450,7 +2433,7 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
 
             EnterCriticalSection(&ddraw_cs);
 
-            hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
+            hr = wined3d_device_get_texture(This->wineD3DDevice, 0, &tex);
             if (SUCCEEDED(hr) && tex)
             {
                 /* The parent of the texture is the IDirectDrawSurface7
@@ -2476,12 +2459,12 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
 
             This->legacyTextureBlending = TRUE;
 
-            IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, &colorop);
-            IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, &colorarg1);
-            IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, &colorarg2);
-            IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, &alphaop);
-            IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, &alphaarg1);
-            IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, &alphaarg2);
+            wined3d_device_get_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, &colorop);
+            wined3d_device_get_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, &colorarg1);
+            wined3d_device_get_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, &colorarg2);
+            wined3d_device_get_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, &alphaop);
+            wined3d_device_get_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, &alphaarg1);
+            wined3d_device_get_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, &alphaarg2);
 
             if (colorop == WINED3DTOP_SELECTARG1 && colorarg1 == WINED3DTA_TEXTURE &&
                 alphaop == WINED3DTOP_SELECTARG1 && alphaarg1 == WINED3DTA_TEXTURE)
@@ -2505,7 +2488,7 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
                 BOOL tex_alpha = FALSE;
                 DDPIXELFORMAT ddfmt;
 
-                hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
+                hr = wined3d_device_get_texture(This->wineD3DDevice, 0, &tex);
 
                 if(hr == WINED3D_OK && tex)
                 {
@@ -2621,9 +2604,7 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface,
                     break;
             }
 
-            hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_MAGFILTER,
-                                                tex_mag);
+            hr = wined3d_device_set_sampler_state(This->wineD3DDevice, 0, WINED3DSAMP_MAGFILTER, tex_mag);
             break;
         }
 
@@ -2666,28 +2647,24 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface,
                     break;
             }
 
-            IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
+            wined3d_device_set_sampler_state(This->wineD3DDevice,
                     0, WINED3DSAMP_MIPFILTER, tex_mip);
-            hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_MINFILTER,
-                                                tex_min);
+            hr = wined3d_device_set_sampler_state(This->wineD3DDevice,
+                    0, WINED3DSAMP_MINFILTER, tex_min);
             break;
         }
 
         case D3DRENDERSTATE_TEXTUREADDRESS:
-                   IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
-                                                  0, WINED3DSAMP_ADDRESSV,
-                                                  Value);
+            wined3d_device_set_sampler_state(This->wineD3DDevice,
+                    0, WINED3DSAMP_ADDRESSV, Value);
             /* Drop through */
         case D3DRENDERSTATE_TEXTUREADDRESSU:
-            hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_ADDRESSU,
-                                                Value);
+            hr = wined3d_device_set_sampler_state(This->wineD3DDevice,
+                    0, WINED3DSAMP_ADDRESSU, Value);
             break;
         case D3DRENDERSTATE_TEXTUREADDRESSV:
-            hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice,
-                                                0, WINED3DSAMP_ADDRESSV,
-                                                Value);
+            hr = wined3d_device_set_sampler_state(This->wineD3DDevice,
+                    0, WINED3DSAMP_ADDRESSV, Value);
             break;
 
         case D3DRENDERSTATE_BORDERCOLOR:
@@ -2711,9 +2688,7 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface,
                 float f;
             } wined3d_value;
             wined3d_value.f = Value * zbias_factor;
-            hr = IWineD3DDevice_SetRenderState(This->wineD3DDevice,
-                                               WINED3DRS_DEPTHBIAS,
-                                               wined3d_value.d);
+            hr = wined3d_device_set_render_state(This->wineD3DDevice, WINED3DRS_DEPTHBIAS, wined3d_value.d);
             break;
         }
 
@@ -2727,9 +2702,7 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface,
                 break;
             }
 
-            hr = IWineD3DDevice_SetRenderState(This->wineD3DDevice,
-                                               RenderStateType,
-                                               Value);
+            hr = wined3d_device_set_render_state(This->wineD3DDevice, RenderStateType, Value);
             break;
     }
     LeaveCriticalSection(&ddraw_cs);
@@ -2798,9 +2771,7 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
 
             if(Value == 0)
             {
-                hr = IWineD3DDevice_SetTexture(This->wineD3DDevice,
-                                               0,
-                                               NULL);
+                hr = wined3d_device_set_texture(This->wineD3DDevice, 0, NULL);
                 break;
             }
 
@@ -2828,7 +2799,7 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
                     BOOL tex_alpha = FALSE;
                     DDPIXELFORMAT ddfmt;
 
-                    hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
+                    hr = wined3d_device_get_texture(This->wineD3DDevice, 0, &tex);
 
                     if(hr == WINED3D_OK && tex)
                     {
@@ -2848,49 +2819,75 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
                     }
 
                     if (tex_alpha)
-                        IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1);
+                        wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                                0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1);
                     else
-                        IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE);
-
+                        wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                                0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE);
                     break;
                 }
 
                 case D3DTBLEND_ADD:
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_ADD);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLOROP, WINED3DTOP_ADD);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
                     break;
 
                 case D3DTBLEND_MODULATEALPHA:
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_MODULATE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAOP, WINED3DTOP_MODULATE);
                     break;
 
                 case D3DTBLEND_COPY:
                 case D3DTBLEND_DECAL:
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_SELECTARG1);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLOROP, WINED3DTOP_SELECTARG1);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1);
                     break;
 
                 case D3DTBLEND_DECALALPHA:
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_BLENDTEXTUREALPHA);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
-                    IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLOROP, WINED3DTOP_BLENDTEXTUREALPHA);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
+                    wined3d_device_set_texture_stage_state(This->wineD3DDevice,
+                            0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT);
                     break;
 
                 default:
@@ -3171,14 +3168,12 @@ IDirect3DDeviceImpl_7_SetTransform(IDirect3DDevice7 *iface,
         default:                        type = TransformStateType;
     }
 
-    if(!Matrix)
-       return DDERR_INVALIDPARAMS;
+    if (!Matrix)
+        return DDERR_INVALIDPARAMS;
 
     /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetTransform(This->wineD3DDevice,
-                                     type,
-                                     (WINED3DMATRIX*) Matrix);
+    hr = wined3d_device_set_transform(This->wineD3DDevice, type, (WINED3DMATRIX *)Matrix);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
 }
@@ -3268,7 +3263,7 @@ IDirect3DDeviceImpl_7_GetTransform(IDirect3DDevice7 *iface,
 
     /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_GetTransform(This->wineD3DDevice, type, (WINED3DMATRIX*) Matrix);
+    hr = wined3d_device_get_transform(This->wineD3DDevice, type, (WINED3DMATRIX *)Matrix);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
 }
@@ -3450,7 +3445,7 @@ IDirect3DDeviceImpl_7_DrawPrimitive(IDirect3DDevice7 *iface,
 
     /* Set the FVF */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, ddraw_find_decl(This->ddraw, VertexType));
+    hr = wined3d_device_set_vertex_declaration(This->wineD3DDevice, ddraw_find_decl(This->ddraw, VertexType));
     if(hr != D3D_OK)
     {
         LeaveCriticalSection(&ddraw_cs);
@@ -3569,7 +3564,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
 
     /* Set the D3DDevice's FVF */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, ddraw_find_decl(This->ddraw, VertexType));
+    hr = wined3d_device_set_vertex_declaration(This->wineD3DDevice, ddraw_find_decl(This->ddraw, VertexType));
     if(FAILED(hr))
     {
         ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr);
@@ -4065,9 +4060,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface,
     stride = get_flexible_vertex_size(vb->fvf);
 
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice,
-                                             vb->wineD3DVertexDeclaration);
-    if(FAILED(hr))
+    hr = wined3d_device_set_vertex_declaration(This->wineD3DDevice, vb->wineD3DVertexDeclaration);
+    if (FAILED(hr))
     {
         ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr);
         LeaveCriticalSection(&ddraw_cs);
@@ -4075,11 +4069,7 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface,
     }
 
     /* Set the vertex stream source */
-    hr = IWineD3DDevice_SetStreamSource(This->wineD3DDevice,
-                                        0 /* StreamNumber */,
-                                        vb->wineD3DVertexBuffer,
-                                        0 /* StartVertex - we pass this to DrawPrimitive */,
-                                        stride);
+    hr = wined3d_device_set_stream_source(This->wineD3DDevice, 0, vb->wineD3DVertexBuffer, 0, stride);
     if(hr != D3D_OK)
     {
         ERR("(%p) IDirect3DDevice::SetStreamSource failed with hr = %08x\n", This, hr);
@@ -4184,9 +4174,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
 
     EnterCriticalSection(&ddraw_cs);
 
-    hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice,
-                                             vb->wineD3DVertexDeclaration);
-    if(FAILED(hr))
+    hr = wined3d_device_set_vertex_declaration(This->wineD3DDevice, vb->wineD3DVertexDeclaration);
+    if (FAILED(hr))
     {
         ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr);
         LeaveCriticalSection(&ddraw_cs);
@@ -4233,17 +4222,12 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
     wined3d_buffer_unmap(This->indexbuffer);
 
     /* Set the index stream */
-    IWineD3DDevice_SetBaseVertexIndex(This->wineD3DDevice, StartVertex);
-    hr = IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, This->indexbuffer,
-                                   WINED3DFMT_R16_UINT);
+    wined3d_device_set_base_vertex_index(This->wineD3DDevice, StartVertex);
+    hr = wined3d_device_set_index_buffer(This->wineD3DDevice, This->indexbuffer, WINED3DFMT_R16_UINT);
 
     /* Set the vertex stream source */
-    hr = IWineD3DDevice_SetStreamSource(This->wineD3DDevice,
-                                        0 /* StreamNumber */,
-                                        vb->wineD3DVertexBuffer,
-                                        0 /* offset, we pass this to DrawIndexedPrimitive */,
-                                        stride);
-    if(hr != D3D_OK)
+    hr = wined3d_device_set_stream_source(This->wineD3DDevice, 0, vb->wineD3DVertexBuffer, 0, stride);
+    if (FAILED(hr))
     {
         ERR("(%p) IDirect3DDevice::SetStreamSource failed with hr = %08x\n", This, hr);
         LeaveCriticalSection(&ddraw_cs);
@@ -4462,7 +4446,7 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface,
     }
 
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, Stage, &wined3d_texture);
+    hr = wined3d_device_get_texture(This->wineD3DDevice, Stage, &wined3d_texture);
     if (FAILED(hr) || !wined3d_texture)
     {
         *Texture = NULL;
@@ -4545,7 +4529,7 @@ IDirect3DDeviceImpl_7_SetTexture(IDirect3DDevice7 *iface,
 
     /* Texture may be NULL here */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetTexture(This->wineD3DDevice,
+    hr = wined3d_device_set_texture(This->wineD3DDevice,
             Stage, surf ? surf->wined3d_texture : NULL);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
@@ -4602,9 +4586,8 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
         DDPIXELFORMAT ddfmt;
         HRESULT result;
 
-        result = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
-
-        if(result == WINED3D_OK && tex)
+        result = wined3d_device_get_texture(This->wineD3DDevice, 0, &tex);
+        if (result == WINED3D_OK && tex)
         {
             struct wined3d_resource *sub_resource;
 
@@ -4623,9 +4606,9 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
 
         /* Arg 1/2 are already set to WINED3DTA_TEXTURE/WINED3DTA_CURRENT in case of D3DTBLEND_MODULATE */
         if (tex_alpha)
-            IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1);
+            wined3d_device_set_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1);
         else
-            IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
+            wined3d_device_set_texture_stage_state(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2);
     }
 
     LeaveCriticalSection(&ddraw_cs);
@@ -4713,7 +4696,7 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface,
 
     if (l->sampler_state)
     {
-        hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, Stage, l->state, State);
+        hr = wined3d_device_get_sampler_state(This->wineD3DDevice, Stage, l->state, State);
 
         switch(TexStageStateType)
         {
@@ -4757,7 +4740,7 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface,
     }
     else
     {
-        hr = IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, Stage, l->state, State);
+        hr = wined3d_device_get_texture_stage_state(This->wineD3DDevice, Stage, l->state, State);
     }
 
     LeaveCriticalSection(&ddraw_cs);
@@ -4880,18 +4863,18 @@ IDirect3DDeviceImpl_7_SetTextureStageState(IDirect3DDevice7 *iface,
             }
 
             case D3DTSS_ADDRESS:
-                IWineD3DDevice_SetSamplerState(This->wineD3DDevice, Stage, WINED3DSAMP_ADDRESSV, State);
+                wined3d_device_set_sampler_state(This->wineD3DDevice, Stage, WINED3DSAMP_ADDRESSV, State);
                 break;
 
             default:
                 break;
         }
 
-        hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice, Stage, l->state, State);
+        hr = wined3d_device_set_sampler_state(This->wineD3DDevice, Stage, l->state, State);
     }
     else
     {
-        hr = IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, Stage, l->state, State);
+        hr = wined3d_device_set_texture_stage_state(This->wineD3DDevice, Stage, l->state, State);
     }
 
     LeaveCriticalSection(&ddraw_cs);
@@ -5098,8 +5081,7 @@ IDirect3DDeviceImpl_7_SetViewport(IDirect3DDevice7 *iface,
 
     /* Note: D3DVIEWPORT7 is compatible with WINED3DVIEWPORT */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetViewport(This->wineD3DDevice,
-                                    (WINED3DVIEWPORT*) Data);
+    hr = wined3d_device_set_viewport(This->wineD3DDevice, (WINED3DVIEWPORT *)Data);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
 }
@@ -5155,8 +5137,7 @@ IDirect3DDeviceImpl_7_GetViewport(IDirect3DDevice7 *iface,
 
     /* Note: D3DVIEWPORT7 is compatible with WINED3DVIEWPORT */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_GetViewport(This->wineD3DDevice,
-                                    (WINED3DVIEWPORT*) Data);
+    hr = wined3d_device_get_viewport(This->wineD3DDevice, (WINED3DVIEWPORT *)Data);
 
     LeaveCriticalSection(&ddraw_cs);
     return hr_ddraw_from_wined3d(hr);
@@ -5211,8 +5192,7 @@ IDirect3DDeviceImpl_7_SetMaterial(IDirect3DDevice7 *iface,
     if (!Mat) return DDERR_INVALIDPARAMS;
     /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetMaterial(This->wineD3DDevice,
-                                    (WINED3DMATERIAL*) Mat);
+    hr = wined3d_device_set_material(This->wineD3DDevice, (WINED3DMATERIAL *)Mat);
     LeaveCriticalSection(&ddraw_cs);
     return hr_ddraw_from_wined3d(hr);
 }
@@ -5265,8 +5245,7 @@ IDirect3DDeviceImpl_7_GetMaterial(IDirect3DDevice7 *iface,
 
     EnterCriticalSection(&ddraw_cs);
     /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */
-    hr = IWineD3DDevice_GetMaterial(This->wineD3DDevice,
-                                    (WINED3DMATERIAL*) Mat);
+    hr = wined3d_device_get_material(This->wineD3DDevice, (WINED3DMATERIAL *)Mat);
     LeaveCriticalSection(&ddraw_cs);
     return hr_ddraw_from_wined3d(hr);
 }
@@ -5320,9 +5299,7 @@ IDirect3DDeviceImpl_7_SetLight(IDirect3DDevice7 *iface,
 
     EnterCriticalSection(&ddraw_cs);
     /* Note: D3DLIGHT7 is compatible with WINED3DLIGHT */
-    hr = IWineD3DDevice_SetLight(This->wineD3DDevice,
-                                 LightIndex,
-                                 (WINED3DLIGHT*) Light);
+    hr = wined3d_device_set_light(This->wineD3DDevice, LightIndex, (WINED3DLIGHT *)Light);
     LeaveCriticalSection(&ddraw_cs);
     return hr_ddraw_from_wined3d(hr);
 }
@@ -5376,9 +5353,7 @@ IDirect3DDeviceImpl_7_GetLight(IDirect3DDevice7 *iface,
 
     EnterCriticalSection(&ddraw_cs);
     /* Note: D3DLIGHT7 is compatible with WINED3DLIGHT */
-    rc =  IWineD3DDevice_GetLight(This->wineD3DDevice,
-                                  LightIndex,
-                                  (WINED3DLIGHT*) Light);
+    rc =  wined3d_device_get_light(This->wineD3DDevice, LightIndex, (WINED3DLIGHT *)Light);
 
     /* Translate the result. WineD3D returns other values than D3D7 */
     LeaveCriticalSection(&ddraw_cs);
@@ -6273,7 +6248,7 @@ IDirect3DDeviceImpl_7_LightEnable(IDirect3DDevice7 *iface,
     TRACE("iface %p, light_idx %u, enabled %#x.\n", iface, LightIndex, Enable);
 
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetLightEnable(This->wineD3DDevice, LightIndex, Enable);
+    hr = wined3d_device_set_light_enable(This->wineD3DDevice, LightIndex, Enable);
     LeaveCriticalSection(&ddraw_cs);
     return hr_ddraw_from_wined3d(hr);
 }
@@ -6332,7 +6307,7 @@ IDirect3DDeviceImpl_7_GetLightEnable(IDirect3DDevice7 *iface,
         return DDERR_INVALIDPARAMS;
 
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_GetLightEnable(This->wineD3DDevice, LightIndex, Enable);
+    hr = wined3d_device_get_light_enable(This->wineD3DDevice, LightIndex, Enable);
     LeaveCriticalSection(&ddraw_cs);
     return hr_ddraw_from_wined3d(hr);
 }
@@ -6391,7 +6366,7 @@ IDirect3DDeviceImpl_7_SetClipPlane(IDirect3DDevice7 *iface,
         return DDERR_INVALIDPARAMS;
 
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_SetClipPlane(This->wineD3DDevice, Index, PlaneEquation);
+    hr = wined3d_device_set_clip_plane(This->wineD3DDevice, Index, PlaneEquation);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
 }
@@ -6448,7 +6423,7 @@ IDirect3DDeviceImpl_7_GetClipPlane(IDirect3DDevice7 *iface,
         return DDERR_INVALIDPARAMS;
 
     EnterCriticalSection(&ddraw_cs);
-    hr = IWineD3DDevice_GetClipPlane(This->wineD3DDevice, Index, PlaneEquation);
+    hr = wined3d_device_get_clip_plane(This->wineD3DDevice, Index, PlaneEquation);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
 }
@@ -6772,14 +6747,13 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This)
     if(!depthStencil)
     {
         TRACE("Setting wined3d depth stencil to NULL\n");
-        IWineD3DDevice_SetDepthStencilSurface(This->wineD3DDevice,
-                                              NULL);
+        wined3d_device_set_depth_stencil(This->wineD3DDevice, NULL);
         return WINED3DZB_FALSE;
     }
 
     dsi = (IDirectDrawSurfaceImpl *)depthStencil;
     TRACE("Setting wined3d depth stencil to %p (wined3d %p)\n", dsi, dsi->wined3d_surface);
-    IWineD3DDevice_SetDepthStencilSurface(This->wineD3DDevice, dsi->wined3d_surface);
+    wined3d_device_set_depth_stencil(This->wineD3DDevice, dsi->wined3d_surface);
 
     IDirectDrawSurface7_Release(depthStencil);
     return WINED3DZB_TRUE;
@@ -6826,7 +6800,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
     IWineD3DDevice_AddRef(ddraw->wineD3DDevice);
 
     /* Render to the back buffer */
-    hr = IWineD3DDevice_SetRenderTarget(ddraw->wineD3DDevice, 0, target->wined3d_surface, TRUE);
+    hr = wined3d_device_set_render_target(ddraw->wineD3DDevice, 0, target->wined3d_surface, TRUE);
     if (FAILED(hr))
     {
         ERR("Failed to set render target, hr %#x.\n", hr);
@@ -6849,7 +6823,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
 
     ddraw->d3ddevice = device;
 
-    IWineD3DDevice_SetRenderState(ddraw->wineD3DDevice, WINED3DRS_ZENABLE,
+    wined3d_device_set_render_state(ddraw->wineD3DDevice, WINED3DRS_ZENABLE,
             IDirect3DDeviceImpl_UpdateDepthStencil(device));
 
     return D3D_OK;
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 070cdc7..581e218 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -155,11 +155,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
 		}
                 /* IDirect3DDevices have color keying always enabled -
                  * enable it before drawing. This overwrites any ALPHA*
-                 * render state
-                 */
-                IWineD3DDevice_SetRenderState(lpDevice->wineD3DDevice,
-                                              WINED3DRS_COLORKEYENABLE,
-                                              1);
+                 * render state. */
+                wined3d_device_set_render_state(lpDevice->wineD3DDevice, WINED3DRS_COLORKEYENABLE, 1);
                 IDirect3DDevice7_DrawIndexedPrimitive((IDirect3DDevice7 *)lpDevice,
                         D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, This->indices, count * 3, 0);
 	    } break;
@@ -318,18 +315,12 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
 
                 /* Get the transform and world matrix */
                 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
-
-                IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice,
-                                            D3DTRANSFORMSTATE_VIEW,
-                                            (WINED3DMATRIX*) &view_mat);
-
-                IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice,
-                                            D3DTRANSFORMSTATE_PROJECTION,
-                                            (WINED3DMATRIX*) &proj_mat);
-
-                IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice,
-                                            WINED3DTS_WORLDMATRIX(0),
-                                            (WINED3DMATRIX*) &world_mat);
+                wined3d_device_get_transform(lpDevice->wineD3DDevice,
+                        D3DTRANSFORMSTATE_VIEW, (WINED3DMATRIX *)&view_mat);
+                wined3d_device_get_transform(lpDevice->wineD3DDevice,
+                        D3DTRANSFORMSTATE_PROJECTION, (WINED3DMATRIX *)&proj_mat);
+                wined3d_device_get_transform(lpDevice->wineD3DDevice,
+                        WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)&world_mat);
 
 		for (i = 0; i < count; i++) {
 		    LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr;
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 8ea39e6..56774b3 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -2923,7 +2923,7 @@ static HRESULT WINAPI ddraw_gamma_control_GetGammaRamp(IDirectDrawGammaControl *
     if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
     {
         /* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP. */
-        IWineD3DDevice_GetGammaRamp(surface->ddraw->wineD3DDevice, 0, (WINED3DGAMMARAMP *)gamma_ramp);
+        wined3d_device_get_gamma_ramp(surface->ddraw->wineD3DDevice, 0, (WINED3DGAMMARAMP *)gamma_ramp);
     }
     else
     {
@@ -2965,7 +2965,7 @@ static HRESULT WINAPI ddraw_gamma_control_SetGammaRamp(IDirectDrawGammaControl *
     if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
     {
         /* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP */
-        IWineD3DDevice_SetGammaRamp(surface->ddraw->wineD3DDevice, 0, flags, (WINED3DGAMMARAMP *)gamma_ramp);
+        wined3d_device_set_gamma_ramp(surface->ddraw->wineD3DDevice, 0, flags, (WINED3DGAMMARAMP *)gamma_ramp);
     }
     else
     {
diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index 7ae4d6e..7d622a6 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -141,23 +141,14 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
         UINT offset, stride;
 
         EnterCriticalSection(&ddraw_cs);
-        /* D3D7 Vertex buffers don't stay bound in the device, they are passed as a parameter
-         * to drawPrimitiveVB. DrawPrimitiveVB sets them as the stream source in wined3d,
-         * and they should get unset there before they are destroyed
-         */
-        IWineD3DDevice_GetStreamSource(This->ddraw->wineD3DDevice,
-                                       0 /* Stream number */,
-                                       &curVB,
-                                       &offset,
-                                       &stride);
-        if(curVB == This->wineD3DVertexBuffer)
-        {
-            IWineD3DDevice_SetStreamSource(This->ddraw->wineD3DDevice,
-                                        0 /* Steam number */,
-                                        NULL /* stream data */,
-                                        0 /* Offset */,
-                                        0 /* stride */);
-        }
+        /* D3D7 Vertex buffers don't stay bound in the device, they are passed
+         * as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the
+         * stream source in wined3d, and they should get unset there before
+         * they are destroyed. */
+        wined3d_device_get_stream_source(This->ddraw->wineD3DDevice,
+                0, &curVB, &offset, &stride);
+        if (curVB == This->wineD3DVertexBuffer)
+            wined3d_device_set_stream_source(This->ddraw->wineD3DDevice, 0, NULL, 0, 0);
         if (curVB)
             wined3d_buffer_decref(curVB); /* For the GetStreamSource */
 
@@ -335,23 +326,13 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
      * the vertex ops
      */
     doClip = VertexOp & D3DVOP_CLIP ? TRUE : FALSE;
-    IWineD3DDevice_GetRenderState(D3D->wineD3DDevice,
-                                  WINED3DRS_CLIPPING,
-                                  (DWORD *) &oldClip);
-    if(doClip != oldClip)
-    {
-        IWineD3DDevice_SetRenderState(D3D->wineD3DDevice,
-                                      WINED3DRS_CLIPPING,
-                                      doClip);
-    }
+    wined3d_device_get_render_state(D3D->wineD3DDevice, WINED3DRS_CLIPPING, (DWORD *)&oldClip);
+    if (doClip != oldClip)
+        wined3d_device_set_render_state(D3D->wineD3DDevice, WINED3DRS_CLIPPING, doClip);
 
-    IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
-                                   0, /* Stream No */
-                                   Src->wineD3DVertexBuffer,
-                                   0, /* Offset */
-                                   get_flexible_vertex_size(Src->fvf));
-    IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice,
-                                        Src->wineD3DVertexDeclaration);
+    wined3d_device_set_stream_source(D3D->wineD3DDevice,
+            0, Src->wineD3DVertexBuffer, 0, get_flexible_vertex_size(Src->fvf));
+    wined3d_device_set_vertex_declaration(D3D->wineD3DDevice, Src->wineD3DVertexDeclaration);
     hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice,
                                         SrcIndex,
                                         DestIndex,
@@ -362,10 +343,8 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
                                         This->fvf);
 
     /* Restore the states if needed */
-    if(doClip != oldClip)
-        IWineD3DDevice_SetRenderState(D3D->wineD3DDevice,
-                                      WINED3DRS_CLIPPING,
-                                      oldClip);
+    if (doClip != oldClip)
+        wined3d_device_set_render_state(D3D->wineD3DDevice, WINED3DRS_CLIPPING, oldClip);
     LeaveCriticalSection(&ddraw_cs);
     return hr;
 }
diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c
index de2bbce..7aeda68 100644
--- a/dlls/ddraw/viewport.c
+++ b/dlls/ddraw/viewport.c
@@ -387,17 +387,12 @@ IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface,
 
 
     EnterCriticalSection(&ddraw_cs);
-    IWineD3DDevice_GetTransform(This->active_device->wineD3DDevice,
-                                D3DTRANSFORMSTATE_VIEW,
-                                (WINED3DMATRIX*) &view_mat);
-
-    IWineD3DDevice_GetTransform(This->active_device->wineD3DDevice,
-                                D3DTRANSFORMSTATE_PROJECTION,
-                                (WINED3DMATRIX*) &proj_mat);
-
-    IWineD3DDevice_GetTransform(This->active_device->wineD3DDevice,
-                                WINED3DTS_WORLDMATRIX(0),
-                                (WINED3DMATRIX*) &world_mat);
+    wined3d_device_get_transform(This->active_device->wineD3DDevice,
+            D3DTRANSFORMSTATE_VIEW, (WINED3DMATRIX *)&view_mat);
+    wined3d_device_get_transform(This->active_device->wineD3DDevice,
+            D3DTRANSFORMSTATE_PROJECTION, (WINED3DMATRIX *)&proj_mat);
+    wined3d_device_get_transform(This->active_device->wineD3DDevice,
+            WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)&world_mat);
     multiply_matrix(&mat,&view_mat,&world_mat);
     multiply_matrix(&mat,&proj_mat,&mat);
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5e79f0b..885a14e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1526,7 +1526,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
 
     for (i = 1; i < gl_info->limits.buffers; ++i)
     {
-        IWineD3DDevice_SetRenderTarget(iface, i, NULL, FALSE);
+        wined3d_device_set_render_target(iface, i, NULL, FALSE);
     }
 
     surface = This->render_targets[0];
@@ -1676,47 +1676,51 @@ static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *ifa
     return (This->adapter->TextureRam - This->adapter->UsedTextureRam);
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,
-        struct wined3d_buffer *buffer, UINT OffsetInBytes, UINT Stride)
+HRESULT CDECL wined3d_device_set_stream_source(IWineD3DDevice *iface, UINT stream_idx,
+        struct wined3d_buffer *buffer, UINT offset, UINT stride)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_stream_state *stream;
     struct wined3d_buffer *prev_buffer;
 
-    TRACE("iface %p, stream_idx %u, buffer %p, offset %u, stride %u.\n",
-            iface, StreamNumber, buffer, OffsetInBytes, Stride);
+    TRACE("device %p, stream_idx %u, buffer %p, offset %u, stride %u.\n",
+            device, stream_idx, buffer, offset, stride);
 
-    if (StreamNumber >= MAX_STREAMS) {
-        WARN("Stream out of range %d\n", StreamNumber);
+    if (stream_idx >= MAX_STREAMS)
+    {
+        WARN("Stream index %u out of range.\n", stream_idx);
         return WINED3DERR_INVALIDCALL;
-    } else if(OffsetInBytes & 0x3) {
-        WARN("OffsetInBytes is not 4 byte aligned: %d\n", OffsetInBytes);
+    }
+    else if (offset & 0x3)
+    {
+        WARN("Offset %u is not 4 byte aligned.\n", offset);
         return WINED3DERR_INVALIDCALL;
     }
 
-    stream = &This->updateStateBlock->state.streams[StreamNumber];
+    stream = &device->updateStateBlock->state.streams[stream_idx];
     prev_buffer = stream->buffer;
 
-    This->updateStateBlock->changed.streamSource |= 1 << StreamNumber;
+    device->updateStateBlock->changed.streamSource |= 1 << stream_idx;
 
     if (prev_buffer == buffer
-            && stream->stride == Stride
-            && stream->offset == OffsetInBytes)
+            && stream->stride == stride
+            && stream->offset == offset)
     {
-       TRACE("Application is setting the old values over, nothing to do\n");
+       TRACE("Application is setting the old values over, nothing to do.\n");
        return WINED3D_OK;
     }
 
     stream->buffer = buffer;
     if (buffer)
     {
-        stream->stride = Stride;
-        stream->offset = OffsetInBytes;
+        stream->stride = stride;
+        stream->offset = offset;
     }
 
-    /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    /* Handle recording of state blocks. */
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         if (buffer)
             wined3d_buffer_incref(buffer);
         if (prev_buffer)
@@ -1735,152 +1739,145 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
         wined3d_buffer_decref(prev_buffer);
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
-        UINT StreamNumber, struct wined3d_buffer **buffer, UINT *pOffset, UINT *pStride)
+HRESULT CDECL wined3d_device_get_stream_source(IWineD3DDevice *iface,
+        UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_stream_state *stream;
 
-    TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
-            iface, StreamNumber, buffer, pOffset, pStride);
+    TRACE("device %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
+            device, stream_idx, buffer, offset, stride);
 
-    if (StreamNumber >= MAX_STREAMS)
+    if (stream_idx >= MAX_STREAMS)
     {
-        WARN("Stream out of range %d\n", StreamNumber);
+        WARN("Stream index %u out of range.\n", stream_idx);
         return WINED3DERR_INVALIDCALL;
     }
 
-    stream = &This->stateBlock->state.streams[StreamNumber];
+    stream = &device->stateBlock->state.streams[stream_idx];
     *buffer = stream->buffer;
-    *pStride = stream->stride;
-    if (pOffset) *pOffset = stream->offset;
-
     if (*buffer)
         wined3d_buffer_incref(*buffer);
+    if (offset)
+        *offset = stream->offset;
+    *stride = stream->stride;
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *iface,  UINT StreamNumber, UINT Divider) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_stream_source_freq(IWineD3DDevice *iface, UINT stream_idx, UINT divider)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_stream_state *stream;
-    UINT old_flags, oldFreq;
+    UINT old_flags, old_freq;
 
-    TRACE("iface %p, stream_idx %u, divider %#x.\n", iface, StreamNumber, Divider);
+    TRACE("device %p, stream_idx %u, divider %#x.\n", device, stream_idx, divider);
 
-    /* Verify input at least in d3d9 this is invalid. */
-    if ((Divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (Divider & WINED3DSTREAMSOURCE_INDEXEDDATA))
+    /* Verify input. At least in d3d9 this is invalid. */
+    if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (divider & WINED3DSTREAMSOURCE_INDEXEDDATA))
     {
-        WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL\n");
+        WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n");
         return WINED3DERR_INVALIDCALL;
     }
-    if ((Divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !StreamNumber)
+    if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !stream_idx)
     {
-        WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL\n");
+        WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n");
         return WINED3DERR_INVALIDCALL;
     }
-    if (!Divider)
+    if (!divider)
     {
-        WARN("Divider is 0, returning D3DERR_INVALIDCALL\n");
+        WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n");
         return WINED3DERR_INVALIDCALL;
     }
 
-    stream = &This->updateStateBlock->state.streams[StreamNumber];
+    stream = &device->updateStateBlock->state.streams[stream_idx];
     old_flags = stream->flags;
-    oldFreq = stream->frequency;
+    old_freq = stream->frequency;
 
-    stream->flags = Divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA);
-    stream->frequency = Divider & 0x7FFFFF;
+    stream->flags = divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA);
+    stream->frequency = divider & 0x7fffff;
 
-    This->updateStateBlock->changed.streamFreq |= 1 << StreamNumber;
+    device->updateStateBlock->changed.streamFreq |= 1 << stream_idx;
 
-    if (stream->frequency != oldFreq || stream->flags != old_flags)
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
+    if (stream->frequency != old_freq || stream->flags != old_flags)
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *iface,  UINT StreamNumber, UINT* Divider) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_get_stream_source_freq(IWineD3DDevice *iface, UINT stream_idx, UINT *divider)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_stream_state *stream;
 
-    TRACE("iface %p, stream_idx %u, divider %p.\n", iface, StreamNumber, Divider);
+    TRACE("device %p, stream_idx %u, divider %p.\n", device, stream_idx, divider);
 
-    stream = &This->updateStateBlock->state.streams[StreamNumber];
-    *Divider = stream->flags | stream->frequency;
+    stream = &device->updateStateBlock->state.streams[stream_idx];
+    *divider = stream->flags | stream->frequency;
 
-    TRACE("Returning %#x.\n", *Divider);
+    TRACE("Returning %#x.\n", *divider);
 
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set & Multiply Transform
- *****/
-static HRESULT  WINAPI  IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE d3dts, CONST WINED3DMATRIX* lpmatrix) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_transform(IWineD3DDevice *iface,
+        WINED3DTRANSFORMSTATETYPE d3dts, const WINED3DMATRIX *matrix)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    /* Most of this routine, comments included copied from ddraw tree initially: */
-    TRACE("(%p) : Transform State=%s\n", This, debug_d3dtstype(d3dts));
+    TRACE("device %p, state %s, matrix %p.\n",
+            device, debug_d3dtstype(d3dts), matrix);
 
-    /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
-        This->updateStateBlock->changed.transform[d3dts >> 5] |= 1 << (d3dts & 0x1f);
-        This->updateStateBlock->state.transforms[d3dts] = *lpmatrix;
+    /* Handle recording of state blocks. */
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
+        device->updateStateBlock->changed.transform[d3dts >> 5] |= 1 << (d3dts & 0x1f);
+        device->updateStateBlock->state.transforms[d3dts] = *matrix;
         return WINED3D_OK;
     }
 
-    /*
-     * If the new matrix is the same as the current one,
+    /* If the new matrix is the same as the current one,
      * we cut off any further processing. this seems to be a reasonable
      * optimization because as was noticed, some apps (warcraft3 for example)
      * tend towards setting the same matrix repeatedly for some reason.
      *
-     * From here on we assume that the new matrix is different, wherever it matters.
-     */
-    if (!memcmp(&This->stateBlock->state.transforms[d3dts].u.m[0][0], lpmatrix, sizeof(*lpmatrix)))
+     * From here on we assume that the new matrix is different, wherever it matters. */
+    if (!memcmp(&device->stateBlock->state.transforms[d3dts].u.m[0][0], matrix, sizeof(*matrix)))
     {
-        TRACE("The app is setting the same matrix over again\n");
+        TRACE("The application is setting the same matrix over again.\n");
         return WINED3D_OK;
     }
-    else
-    {
-        conv_mat(lpmatrix, &This->stateBlock->state.transforms[d3dts].u.m[0][0]);
-    }
 
-    /*
-       ScreenCoord = ProjectionMat * ViewMat * WorldMat * ObjectCoord
-       where ViewMat = Camera space, WorldMat = world space.
+    conv_mat(matrix, &device->stateBlock->state.transforms[d3dts].u.m[0][0]);
 
-       In OpenGL, camera and world space is combined into GL_MODELVIEW
-       matrix.  The Projection matrix stay projection matrix.
-     */
+    /* ScreenCoord = ProjectionMat * ViewMat * WorldMat * ObjectCoord
+     * where ViewMat = Camera space, WorldMat = world space.
+     *
+     * In OpenGL, camera and world space is combined into GL_MODELVIEW
+     * matrix.  The Projection matrix stay projection matrix. */
 
-    /* Capture the times we can just ignore the change for now */
-    if (d3dts == WINED3DTS_VIEW) { /* handle the VIEW matrix */
-        This->view_ident = !memcmp(lpmatrix, identity, 16 * sizeof(float));
-        /* Handled by the state manager */
-    }
+    if (d3dts == WINED3DTS_VIEW)
+        device->view_ident = !memcmp(matrix, identity, 16 * sizeof(float));
 
-    if (d3dts < WINED3DTS_WORLDMATRIX(This->adapter->gl_info.limits.blends))
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TRANSFORM(d3dts));
+    if (d3dts < WINED3DTS_WORLDMATRIX(device->adapter->gl_info.limits.blends))
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TRANSFORM(d3dts));
 
     return WINED3D_OK;
 
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface,
+HRESULT CDECL wined3d_device_get_transform(IWineD3DDevice *iface,
         WINED3DTRANSFORMSTATETYPE state, WINED3DMATRIX *matrix)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("iface %p, state %s, matrix %p.\n", iface, debug_d3dtstype(state), matrix);
+    TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix);
 
     *matrix = device->stateBlock->state.transforms[state];
 
@@ -1910,47 +1907,43 @@ static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface
 
     multiply_matrix(&temp, mat, pMatrix);
 
-    /* Apply change via set transform - will reapply to eg. lights this way */
-    return IWineD3DDeviceImpl_SetTransform(iface, State, &temp);
+    /* Apply change via set transform - will reapply to eg. lights this way. */
+    return wined3d_device_set_transform(iface, State, &temp);
 }
 
-/*****
- * Get / Set Light
- *****/
-/* Note lights are real special cases. Although the device caps state only eg. 8 are supported,
-   you can reference any indexes you want as long as that number max are enabled at any
-   one point in time! Therefore since the indexes can be anything, we need a hashmap of them.
-   However, this causes stateblock problems. When capturing the state block, I duplicate the hashmap,
-   but when recording, just build a chain pretty much of commands to be replayed.                  */
-
-static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index, CONST WINED3DLIGHT* pLight) {
-    float rho;
+/* Note lights are real special cases. Although the device caps state only
+ * e.g. 8 are supported, you can reference any indexes you want as long as
+ * that number max are enabled at any one point in time. Therefore since the
+ * indices can be anything, we need a hashmap of them. However, this causes
+ * stateblock problems. When capturing the state block, I duplicate the
+ * hashmap, but when recording, just build a chain pretty much of commands to
+ * be replayed. */
+HRESULT CDECL wined3d_device_set_light(IWineD3DDevice *iface, DWORD light_idx, CONST WINED3DLIGHT *light)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx);
     struct wined3d_light_info *object = NULL;
-    UINT Hi = LIGHTMAP_HASHFUNC(Index);
     struct list *e;
+    float rho;
 
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p) : Idx(%d), pLight(%p). Hash index is %d\n", This, Index, pLight, Hi);
+    TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light);
 
-    /* Check the parameter range. Need for speed most wanted sets junk lights which confuse
-     * the gl driver.
-     */
-    if(!pLight) {
-        WARN("Light pointer = NULL, returning WINED3DERR_INVALIDCALL\n");
+    /* Check the parameter range. Need for speed most wanted sets junk lights
+     * which confuse the GL driver. */
+    if (!light)
         return WINED3DERR_INVALIDCALL;
-    }
 
-    switch(pLight->Type) {
+    switch (light->Type)
+    {
         case WINED3DLIGHT_POINT:
         case WINED3DLIGHT_SPOT:
         case WINED3DLIGHT_PARALLELPOINT:
         case WINED3DLIGHT_GLSPOT:
-            /* Incorrect attenuation values can cause the gl driver to crash. Happens with Need for speed
-             * most wanted
-             */
-            if (pLight->Attenuation0 < 0.0f || pLight->Attenuation1 < 0.0f || pLight->Attenuation2 < 0.0f)
+            /* Incorrect attenuation values can cause the gl driver to crash.
+             * Happens with Need for speed most wanted. */
+            if (light->Attenuation0 < 0.0f || light->Attenuation1 < 0.0f || light->Attenuation2 < 0.0f)
             {
-                WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL\n");
+                WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL.\n");
                 return WINED3DERR_INVALIDCALL;
             }
             break;
@@ -1964,395 +1957,425 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
         return WINED3DERR_INVALIDCALL;
     }
 
-    LIST_FOR_EACH(e, &This->updateStateBlock->state.light_map[Hi])
+    LIST_FOR_EACH(e, &device->updateStateBlock->state.light_map[hash_idx])
     {
         object = LIST_ENTRY(e, struct wined3d_light_info, entry);
-        if(object->OriginalIndex == Index) break;
+        if (object->OriginalIndex == light_idx)
+            break;
         object = NULL;
     }
 
-    if(!object) {
+    if (!object)
+    {
         TRACE("Adding new light\n");
         object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
-        if(!object) {
+        if (!object)
+        {
             ERR("Out of memory error when allocating a light\n");
             return E_OUTOFMEMORY;
         }
-        list_add_head(&This->updateStateBlock->state.light_map[Hi], &object->entry);
+        list_add_head(&device->updateStateBlock->state.light_map[hash_idx], &object->entry);
         object->glIndex = -1;
-        object->OriginalIndex = Index;
-    }
-
-    /* Initialize the object */
-    TRACE("Light %d setting to type %d, Diffuse(%f,%f,%f,%f), Specular(%f,%f,%f,%f), Ambient(%f,%f,%f,%f)\n", Index, pLight->Type,
-          pLight->Diffuse.r, pLight->Diffuse.g, pLight->Diffuse.b, pLight->Diffuse.a,
-          pLight->Specular.r, pLight->Specular.g, pLight->Specular.b, pLight->Specular.a,
-          pLight->Ambient.r, pLight->Ambient.g, pLight->Ambient.b, pLight->Ambient.a);
-    TRACE("... Pos(%f,%f,%f), Dirn(%f,%f,%f)\n", pLight->Position.x, pLight->Position.y, pLight->Position.z,
-          pLight->Direction.x, pLight->Direction.y, pLight->Direction.z);
-    TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", pLight->Range, pLight->Falloff, pLight->Theta, pLight->Phi);
-
-    /* Save away the information */
-    object->OriginalParms = *pLight;
-
-    switch (pLight->Type) {
-    case WINED3DLIGHT_POINT:
-        /* Position */
-        object->lightPosn[0] = pLight->Position.x;
-        object->lightPosn[1] = pLight->Position.y;
-        object->lightPosn[2] = pLight->Position.z;
-        object->lightPosn[3] = 1.0f;
-        object->cutoff = 180.0f;
-        /* FIXME: Range */
-        break;
-
-    case WINED3DLIGHT_DIRECTIONAL:
-        /* Direction */
-        object->lightPosn[0] = -pLight->Direction.x;
-        object->lightPosn[1] = -pLight->Direction.y;
-        object->lightPosn[2] = -pLight->Direction.z;
-        object->lightPosn[3] = 0.0f;
-        object->exponent     = 0.0f;
-        object->cutoff       = 180.0f;
-        break;
-
-    case WINED3DLIGHT_SPOT:
-        /* Position */
-        object->lightPosn[0] = pLight->Position.x;
-        object->lightPosn[1] = pLight->Position.y;
-        object->lightPosn[2] = pLight->Position.z;
-        object->lightPosn[3] = 1.0f;
-
-        /* Direction */
-        object->lightDirn[0] = pLight->Direction.x;
-        object->lightDirn[1] = pLight->Direction.y;
-        object->lightDirn[2] = pLight->Direction.z;
-        object->lightDirn[3] = 1.0f;
+        object->OriginalIndex = light_idx;
+    }
 
-        /*
-         * opengl-ish and d3d-ish spot lights use too different models for the
-         * light "intensity" as a function of the angle towards the main light direction,
-         * so we only can approximate very roughly.
-         * however spot lights are rather rarely used in games (if ever used at all).
-         * furthermore if still used, probably nobody pays attention to such details.
-         */
-        if (!pLight->Falloff)
-        {
-            /* Falloff = 0 is easy, because d3d's and opengl's spot light equations have the
-             * falloff resp. exponent parameter as an exponent, so the spot light lighting
-             * will always be 1.0 for both of them, and we don't have to care for the
-             * rest of the rather complex calculation
-             */
+    /* Initialize the object. */
+    TRACE("Light %d setting to type %d, Diffuse(%f,%f,%f,%f), Specular(%f,%f,%f,%f), Ambient(%f,%f,%f,%f)\n",
+            light_idx, light->Type,
+            light->Diffuse.r, light->Diffuse.g, light->Diffuse.b, light->Diffuse.a,
+            light->Specular.r, light->Specular.g, light->Specular.b, light->Specular.a,
+            light->Ambient.r, light->Ambient.g, light->Ambient.b, light->Ambient.a);
+    TRACE("... Pos(%f,%f,%f), Dir(%f,%f,%f)\n", light->Position.x, light->Position.y, light->Position.z,
+            light->Direction.x, light->Direction.y, light->Direction.z);
+    TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n",
+            light->Range, light->Falloff, light->Theta, light->Phi);
+
+    /* Save away the information. */
+    object->OriginalParms = *light;
+
+    switch (light->Type)
+    {
+        case WINED3DLIGHT_POINT:
+            /* Position */
+            object->lightPosn[0] = light->Position.x;
+            object->lightPosn[1] = light->Position.y;
+            object->lightPosn[2] = light->Position.z;
+            object->lightPosn[3] = 1.0f;
+            object->cutoff = 180.0f;
+            /* FIXME: Range */
+            break;
+
+        case WINED3DLIGHT_DIRECTIONAL:
+            /* Direction */
+            object->lightPosn[0] = -light->Direction.x;
+            object->lightPosn[1] = -light->Direction.y;
+            object->lightPosn[2] = -light->Direction.z;
+            object->lightPosn[3] = 0.0f;
             object->exponent = 0.0f;
-        } else {
-            rho = pLight->Theta + (pLight->Phi - pLight->Theta)/(2*pLight->Falloff);
-            if (rho < 0.0001f) rho = 0.0001f;
-            object->exponent = -0.3f/logf(cosf(rho/2));
-        }
-        if (object->exponent > 128.0f)
-        {
-            object->exponent = 128.0f;
-        }
-        object->cutoff = (float) (pLight->Phi*90/M_PI);
+            object->cutoff = 180.0f;
+            break;
+
+        case WINED3DLIGHT_SPOT:
+            /* Position */
+            object->lightPosn[0] = light->Position.x;
+            object->lightPosn[1] = light->Position.y;
+            object->lightPosn[2] = light->Position.z;
+            object->lightPosn[3] = 1.0f;
+
+            /* Direction */
+            object->lightDirn[0] = light->Direction.x;
+            object->lightDirn[1] = light->Direction.y;
+            object->lightDirn[2] = light->Direction.z;
+            object->lightDirn[3] = 1.0f;
+
+            /* opengl-ish and d3d-ish spot lights use too different models
+             * for the light "intensity" as a function of the angle towards
+             * the main light direction, so we only can approximate very
+             * roughly. However, spot lights are rather rarely used in games
+             * (if ever used at all). Furthermore if still used, probably
+             * nobody pays attention to such details. */
+            if (!light->Falloff)
+            {
+                /* Falloff = 0 is easy, because d3d's and opengl's spot light
+                 * equations have the falloff resp. exponent parameter as an
+                 * exponent, so the spot light lighting will always be 1.0 for
+                 * both of them, and we don't have to care for the rest of the
+                 * rather complex calculation. */
+                object->exponent = 0.0f;
+            }
+            else
+            {
+                rho = light->Theta + (light->Phi - light->Theta) / (2 * light->Falloff);
+                if (rho < 0.0001f)
+                    rho = 0.0001f;
+                object->exponent = -0.3f / logf(cosf(rho / 2));
+            }
 
-        /* FIXME: Range */
-        break;
+            if (object->exponent > 128.0f)
+                object->exponent = 128.0f;
 
-    default:
-        FIXME("Unrecognized light type %d\n", pLight->Type);
-    }
+            object->cutoff = (float)(light->Phi * 90 / M_PI);
+            /* FIXME: Range */
+            break;
 
-    /* Update the live definitions if the light is currently assigned a glIndex */
-    if (object->glIndex != -1 && !This->isRecordingState) {
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_ACTIVELIGHT(object->glIndex));
+        default:
+            FIXME("Unrecognized light type %#x.\n", light->Type);
     }
+
+    /* Update the live definitions if the light is currently assigned a glIndex. */
+    if (object->glIndex != -1 && !device->isRecordingState)
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_ACTIVELIGHT(object->glIndex));
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index, WINED3DLIGHT *pLight)
+HRESULT CDECL wined3d_device_get_light(IWineD3DDevice *iface, UINT light_idx, WINED3DLIGHT *light)
 {
-    struct wined3d_light_info *lightInfo = NULL;
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    DWORD Hi = LIGHTMAP_HASHFUNC(Index);
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx);
+    struct wined3d_light_info *light_info = NULL;
     struct list *e;
-    TRACE("(%p) : Idx(%d), pLight(%p)\n", This, Index, pLight);
 
-    LIST_FOR_EACH(e, &This->stateBlock->state.light_map[Hi])
+    TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light);
+
+    LIST_FOR_EACH(e, &device->stateBlock->state.light_map[hash_idx])
     {
-        lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
-        if(lightInfo->OriginalIndex == Index) break;
-        lightInfo = NULL;
+        light_info = LIST_ENTRY(e, struct wined3d_light_info, entry);
+        if (light_info->OriginalIndex == light_idx)
+            break;
+        light_info = NULL;
     }
 
-    if (!lightInfo)
+    if (!light_info)
     {
         TRACE("Light information requested but light not defined\n");
         return WINED3DERR_INVALIDCALL;
     }
 
-    *pLight = lightInfo->OriginalParms;
+    *light = light_info->OriginalParms;
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set Light Enable
- *   (Note for consistency, renamed d3dx function by adding the 'set' prefix)
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD Index, BOOL Enable)
+HRESULT CDECL wined3d_device_set_light_enable(IWineD3DDevice *iface, UINT light_idx, BOOL enable)
 {
-    struct wined3d_light_info *lightInfo = NULL;
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    UINT Hi = LIGHTMAP_HASHFUNC(Index);
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx);
+    struct wined3d_light_info *light_info = NULL;
     struct list *e;
-    TRACE("(%p) : Idx(%d), enable? %d\n", This, Index, Enable);
 
-    LIST_FOR_EACH(e, &This->updateStateBlock->state.light_map[Hi])
+    TRACE("device %p, light_idx %u, enable %#x.\n", device, light_idx, enable);
+
+    LIST_FOR_EACH(e, &device->updateStateBlock->state.light_map[hash_idx])
     {
-        lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
-        if(lightInfo->OriginalIndex == Index) break;
-        lightInfo = NULL;
+        light_info = LIST_ENTRY(e, struct wined3d_light_info, entry);
+        if (light_info->OriginalIndex == light_idx)
+            break;
+        light_info = NULL;
     }
-    TRACE("Found light: %p\n", lightInfo);
+    TRACE("Found light %p.\n", light_info);
 
-    /* Special case - enabling an undefined light creates one with a strict set of parms! */
-    if (!lightInfo)
+    /* Special case - enabling an undefined light creates one with a strict set of parameters. */
+    if (!light_info)
     {
         TRACE("Light enabled requested but light not defined, so defining one!\n");
-        IWineD3DDeviceImpl_SetLight(iface, Index, &WINED3D_default_light);
+        wined3d_device_set_light(iface, light_idx, &WINED3D_default_light);
 
-        /* Search for it again! Should be fairly quick as near head of list */
-        LIST_FOR_EACH(e, &This->updateStateBlock->state.light_map[Hi])
+        /* Search for it again! Should be fairly quick as near head of list. */
+        LIST_FOR_EACH(e, &device->updateStateBlock->state.light_map[hash_idx])
         {
-            lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
-            if(lightInfo->OriginalIndex == Index) break;
-            lightInfo = NULL;
+            light_info = LIST_ENTRY(e, struct wined3d_light_info, entry);
+            if (light_info->OriginalIndex == light_idx)
+                break;
+            light_info = NULL;
         }
-        if (!lightInfo)
+        if (!light_info)
         {
             FIXME("Adding default lights has failed dismally\n");
             return WINED3DERR_INVALIDCALL;
         }
     }
 
-    if(!Enable) {
-        if(lightInfo->glIndex != -1) {
-            if(!This->isRecordingState) {
-                IWineD3DDeviceImpl_MarkStateDirty(This, STATE_ACTIVELIGHT(lightInfo->glIndex));
-            }
+    if (!enable)
+    {
+        if (light_info->glIndex != -1)
+        {
+            if (!device->isRecordingState)
+                IWineD3DDeviceImpl_MarkStateDirty(device, STATE_ACTIVELIGHT(light_info->glIndex));
 
-            This->updateStateBlock->state.lights[lightInfo->glIndex] = NULL;
-            lightInfo->glIndex = -1;
-        } else {
+            device->updateStateBlock->state.lights[light_info->glIndex] = NULL;
+            light_info->glIndex = -1;
+        }
+        else
+        {
             TRACE("Light already disabled, nothing to do\n");
         }
-        lightInfo->enabled = FALSE;
-    } else {
-        lightInfo->enabled = TRUE;
-        if (lightInfo->glIndex != -1) {
-            /* nop */
+        light_info->enabled = FALSE;
+    }
+    else
+    {
+        light_info->enabled = TRUE;
+        if (light_info->glIndex != -1)
+        {
             TRACE("Nothing to do as light was enabled\n");
-        } else {
+        }
+        else
+        {
             int i;
-            /* Find a free gl light */
-            for (i = 0; i < This->maxConcurrentLights; ++i)
+            /* Find a free GL light. */
+            for (i = 0; i < device->maxConcurrentLights; ++i)
             {
-                if (!This->updateStateBlock->state.lights[i])
+                if (!device->updateStateBlock->state.lights[i])
                 {
-                    This->updateStateBlock->state.lights[i] = lightInfo;
-                    lightInfo->glIndex = i;
+                    device->updateStateBlock->state.lights[i] = light_info;
+                    light_info->glIndex = i;
                     break;
                 }
             }
-            if(lightInfo->glIndex == -1) {
+            if (light_info->glIndex == -1)
+            {
                 /* Our tests show that Windows returns D3D_OK in this situation, even with
                  * D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE devices. This
                  * is consistent among ddraw, d3d8 and d3d9. GetLightEnable returns TRUE
                  * as well for those lights.
                  *
-                 * TODO: Test how this affects rendering
-                 */
+                 * TODO: Test how this affects rendering. */
                 WARN("Too many concurrently active lights\n");
                 return WINED3D_OK;
             }
 
-            /* i == lightInfo->glIndex */
-            if(!This->isRecordingState) {
-                IWineD3DDeviceImpl_MarkStateDirty(This, STATE_ACTIVELIGHT(i));
-            }
+            /* i == light_info->glIndex */
+            if (!device->isRecordingState)
+                IWineD3DDeviceImpl_MarkStateDirty(device, STATE_ACTIVELIGHT(i));
         }
     }
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL* pEnable)
+HRESULT CDECL wined3d_device_get_light_enable(IWineD3DDevice *iface, UINT light_idx, BOOL *enable)
 {
-    struct wined3d_light_info *lightInfo = NULL;
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx);
+    struct wined3d_light_info *light_info = NULL;
     struct list *e;
-    UINT Hi = LIGHTMAP_HASHFUNC(Index);
-    TRACE("(%p) : for idx(%d)\n", This, Index);
 
-    LIST_FOR_EACH(e, &This->stateBlock->state.light_map[Hi])
+    TRACE("device %p, light_idx %u, enable %p.\n", device, light_idx, enable);
+
+    LIST_FOR_EACH(e, &device->stateBlock->state.light_map[hash_idx])
     {
-        lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
-        if(lightInfo->OriginalIndex == Index) break;
-        lightInfo = NULL;
+        light_info = LIST_ENTRY(e, struct wined3d_light_info, entry);
+        if (light_info->OriginalIndex == light_idx)
+            break;
+        light_info = NULL;
     }
 
-    if (!lightInfo)
+    if (!light_info)
     {
-        TRACE("Light enabled state requested but light not defined\n");
+        TRACE("Light enabled state requested but light not defined.\n");
         return WINED3DERR_INVALIDCALL;
     }
     /* true is 128 according to SetLightEnable */
-    *pEnable = lightInfo->enabled ? 128 : 0;
+    *enable = light_info->enabled ? 128 : 0;
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set Clip Planes
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWORD Index, CONST float *pPlane) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p) : for idx %d, %p\n", This, Index, pPlane);
+HRESULT CDECL wined3d_device_set_clip_plane(IWineD3DDevice *iface, UINT plane_idx, const float *plane)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
 
-    /* Validate Index */
-    if (Index >= This->adapter->gl_info.limits.clipplanes)
+    /* Validate plane_idx. */
+    if (plane_idx >= device->adapter->gl_info.limits.clipplanes)
     {
-        TRACE("Application has requested clipplane this device doesn't support\n");
+        TRACE("Application has requested clipplane this device doesn't support.\n");
         return WINED3DERR_INVALIDCALL;
     }
 
-    This->updateStateBlock->changed.clipplane |= 1 << Index;
+    device->updateStateBlock->changed.clipplane |= 1 << plane_idx;
 
-    if (This->updateStateBlock->state.clip_planes[Index][0] == pPlane[0]
-            && This->updateStateBlock->state.clip_planes[Index][1] == pPlane[1]
-            && This->updateStateBlock->state.clip_planes[Index][2] == pPlane[2]
-            && This->updateStateBlock->state.clip_planes[Index][3] == pPlane[3])
+    if (device->updateStateBlock->state.clip_planes[plane_idx][0] == plane[0]
+            && device->updateStateBlock->state.clip_planes[plane_idx][1] == plane[1]
+            && device->updateStateBlock->state.clip_planes[plane_idx][2] == plane[2]
+            && device->updateStateBlock->state.clip_planes[plane_idx][3] == plane[3])
     {
-        TRACE("Application is setting old values over, nothing to do\n");
+        TRACE("Application is setting old values over, nothing to do.\n");
         return WINED3D_OK;
     }
 
-    This->updateStateBlock->state.clip_planes[Index][0] = pPlane[0];
-    This->updateStateBlock->state.clip_planes[Index][1] = pPlane[1];
-    This->updateStateBlock->state.clip_planes[Index][2] = pPlane[2];
-    This->updateStateBlock->state.clip_planes[Index][3] = pPlane[3];
+    device->updateStateBlock->state.clip_planes[plane_idx][0] = plane[0];
+    device->updateStateBlock->state.clip_planes[plane_idx][1] = plane[1];
+    device->updateStateBlock->state.clip_planes[plane_idx][2] = plane[2];
+    device->updateStateBlock->state.clip_planes[plane_idx][3] = plane[3];
 
-    /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    /* Handle recording of state blocks. */
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_CLIPPLANE(Index));
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_CLIPPLANE(plane_idx));
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWORD Index, float *pPlane) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p) : for idx %d\n", This, Index);
+HRESULT CDECL wined3d_device_get_clip_plane(IWineD3DDevice *iface, DWORD plane_idx, float *plane)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
 
-    /* Validate Index */
-    if (Index >= This->adapter->gl_info.limits.clipplanes)
+    /* Validate plane_idx. */
+    if (plane_idx >= device->adapter->gl_info.limits.clipplanes)
     {
-        TRACE("Application has requested clipplane this device doesn't support\n");
+        TRACE("Application has requested clipplane this device doesn't support.\n");
         return WINED3DERR_INVALIDCALL;
     }
 
-    pPlane[0] = (float)This->stateBlock->state.clip_planes[Index][0];
-    pPlane[1] = (float)This->stateBlock->state.clip_planes[Index][1];
-    pPlane[2] = (float)This->stateBlock->state.clip_planes[Index][2];
-    pPlane[3] = (float)This->stateBlock->state.clip_planes[Index][3];
+    plane[0] = (float)device->stateBlock->state.clip_planes[plane_idx][0];
+    plane[1] = (float)device->stateBlock->state.clip_planes[plane_idx][1];
+    plane[2] = (float)device->stateBlock->state.clip_planes[plane_idx][2];
+    plane[3] = (float)device->stateBlock->state.clip_planes[plane_idx][3];
+
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set Clip Plane Status
- *   WARNING: This code relies on the fact that D3DCLIPSTATUS8 == D3DCLIPSTATUS9
- *****/
-static HRESULT  WINAPI  IWineD3DDeviceImpl_SetClipStatus(IWineD3DDevice *iface, CONST WINED3DCLIPSTATUS* pClipStatus) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    FIXME("(%p) : stub\n", This);
+HRESULT CDECL wined3d_device_set_clip_status(IWineD3DDevice *iface, const WINED3DCLIPSTATUS *clip_status)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    FIXME("device %p, clip_status %p stub!\n", device, clip_status);
 
-    if (!pClipStatus)
+    if (!clip_status)
         return WINED3DERR_INVALIDCALL;
 
-    This->updateStateBlock->state.clip_status.ClipUnion = pClipStatus->ClipUnion;
-    This->updateStateBlock->state.clip_status.ClipIntersection = pClipStatus->ClipIntersection;
+    device->updateStateBlock->state.clip_status.ClipUnion = clip_status->ClipUnion;
+    device->updateStateBlock->state.clip_status.ClipIntersection = clip_status->ClipIntersection;
+
     return WINED3D_OK;
 }
 
-static HRESULT  WINAPI  IWineD3DDeviceImpl_GetClipStatus(IWineD3DDevice *iface, WINED3DCLIPSTATUS* pClipStatus) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    FIXME("(%p) : stub\n", This);
+HRESULT CDECL wined3d_device_get_clip_status(IWineD3DDevice *iface, WINED3DCLIPSTATUS *clip_status)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    FIXME("device %p, clip_status %p stub!\n", device, clip_status);
 
-    if (!pClipStatus)
+    if (!clip_status)
         return WINED3DERR_INVALIDCALL;
 
-    pClipStatus->ClipUnion = This->updateStateBlock->state.clip_status.ClipUnion;
-    pClipStatus->ClipIntersection = This->updateStateBlock->state.clip_status.ClipIntersection;
+    clip_status->ClipUnion = device->updateStateBlock->state.clip_status.ClipUnion;
+    clip_status->ClipIntersection = device->updateStateBlock->state.clip_status.ClipIntersection;
+
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set Material
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONST WINED3DMATERIAL* pMaterial) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_material(IWineD3DDevice *iface, const WINED3DMATERIAL *material)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, material %p.\n", device, material);
 
-    This->updateStateBlock->changed.material = TRUE;
-    This->updateStateBlock->state.material = *pMaterial;
+    device->updateStateBlock->changed.material = TRUE;
+    device->updateStateBlock->state.material = *material;
 
     /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_MATERIAL);
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_MATERIAL);
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetMaterial(IWineD3DDevice *iface, WINED3DMATERIAL* pMaterial) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    *pMaterial = This->updateStateBlock->state.material;
-    TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", This, pMaterial->Diffuse.r, pMaterial->Diffuse.g,
-        pMaterial->Diffuse.b, pMaterial->Diffuse.a);
-    TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", This, pMaterial->Ambient.r, pMaterial->Ambient.g,
-        pMaterial->Ambient.b, pMaterial->Ambient.a);
-    TRACE("(%p) : Specular (%f,%f,%f,%f)\n", This, pMaterial->Specular.r, pMaterial->Specular.g,
-        pMaterial->Specular.b, pMaterial->Specular.a);
-    TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", This, pMaterial->Emissive.r, pMaterial->Emissive.g,
-        pMaterial->Emissive.b, pMaterial->Emissive.a);
-    TRACE("(%p) : Power (%f)\n", This, pMaterial->Power);
+HRESULT CDECL wined3d_device_get_material(IWineD3DDevice *iface, WINED3DMATERIAL *material)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, material %p.\n", device, material);
+
+    *material = device->updateStateBlock->state.material;
+
+    TRACE("Diffuse {%.8e, %.8e, %.8e, %.8e}\n",
+            material->Diffuse.r, material->Diffuse.g,
+            material->Diffuse.b, material->Diffuse.a);
+    TRACE("Ambient {%.8e, %.8e, %.8e, %.8e}\n",
+            material->Ambient.r, material->Ambient.g,
+            material->Ambient.b, material->Ambient.a);
+    TRACE("Specular {%.8e, %.8e, %.8e, %.8e}\n",
+            material->Specular.r, material->Specular.g,
+            material->Specular.b, material->Specular.a);
+    TRACE("Emissive {%.8e, %.8e, %.8e, %.8e}\n",
+            material->Emissive.r, material->Emissive.g,
+            material->Emissive.b, material->Emissive.a);
+    TRACE("Power %.8e.\n", material->Power);
 
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set Indices
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetIndexBuffer(IWineD3DDevice *iface,
-        struct wined3d_buffer *buffer, enum wined3d_format_id fmt)
+HRESULT CDECL wined3d_device_set_index_buffer(IWineD3DDevice *iface,
+        struct wined3d_buffer *buffer, enum wined3d_format_id format_id)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_buffer *prev_buffer;
 
     TRACE("iface %p, buffer %p, format %s.\n",
-            iface, buffer, debug_d3dformat(fmt));
+            iface, buffer, debug_d3dformat(format_id));
 
-    prev_buffer = This->updateStateBlock->state.index_buffer;
+    prev_buffer = device->updateStateBlock->state.index_buffer;
 
-    This->updateStateBlock->changed.indices = TRUE;
-    This->updateStateBlock->state.index_buffer = buffer;
-    This->updateStateBlock->state.index_format = fmt;
+    device->updateStateBlock->changed.indices = TRUE;
+    device->updateStateBlock->state.index_buffer = buffer;
+    device->updateStateBlock->state.index_format = format_id;
 
-    /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    /* Handle recording of state blocks. */
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         if (buffer)
             wined3d_buffer_incref(buffer);
         if (prev_buffer)
@@ -2362,7 +2385,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndexBuffer(IWineD3DDevice *iface,
 
     if (prev_buffer != buffer)
     {
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER);
         if (buffer)
         {
             InterlockedIncrement(&buffer->bind_count);
@@ -2378,13 +2401,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndexBuffer(IWineD3DDevice *iface,
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetIndexBuffer(IWineD3DDevice *iface, struct wined3d_buffer **buffer)
+HRESULT CDECL wined3d_device_get_index_buffer(IWineD3DDevice *iface, struct wined3d_buffer **buffer)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
     TRACE("iface %p, buffer %p.\n", iface, buffer);
 
-    *buffer = This->stateBlock->state.index_buffer;
+    *buffer = device->stateBlock->state.index_buffer;
 
     if (*buffer)
         wined3d_buffer_incref(*buffer);
@@ -2395,247 +2418,269 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetIndexBuffer(IWineD3DDevice *iface, s
 }
 
 /* Method to offer d3d9 a simple way to set the base vertex index without messing with the index buffer */
-static HRESULT WINAPI IWineD3DDeviceImpl_SetBaseVertexIndex(IWineD3DDevice *iface, INT BaseIndex) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p)->(%d)\n", This, BaseIndex);
+HRESULT CDECL wined3d_device_set_base_vertex_index(IWineD3DDevice *iface, INT base_index)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, base_index %d.\n", device, base_index);
 
-    if (This->updateStateBlock->state.base_vertex_index == BaseIndex)
+    if (device->updateStateBlock->state.base_vertex_index == base_index)
     {
         TRACE("Application is setting the old value over, nothing to do\n");
         return WINED3D_OK;
     }
 
-    This->updateStateBlock->state.base_vertex_index = BaseIndex;
+    device->updateStateBlock->state.base_vertex_index = base_index;
 
-    if (This->isRecordingState) {
+    if (device->isRecordingState)
+    {
         TRACE("Recording... not performing anything\n");
         return WINED3D_OK;
     }
+
     /* The base vertex index affects the stream sources */
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC);
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetBaseVertexIndex(IWineD3DDevice *iface, INT* base_index) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p) : base_index %p\n", This, base_index);
-
-    *base_index = This->stateBlock->state.base_vertex_index;
+INT CDECL wined3d_device_get_base_vertex_index(IWineD3DDevice *iface)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("Returning %u\n", *base_index);
+    TRACE("device %p.\n", device);
 
-    return WINED3D_OK;
+    return device->stateBlock->state.base_vertex_index;
 }
 
-/*****
- * Get / Set Viewports
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED3DVIEWPORT* pViewport) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_viewport(IWineD3DDevice *iface, const WINED3DVIEWPORT *viewport)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("(%p)\n", This);
-    This->updateStateBlock->changed.viewport = TRUE;
-    This->updateStateBlock->state.viewport = *pViewport;
+    TRACE("device %p, viewport %p.\n", device, viewport);
+    TRACE("x %u, y %u, w %u, h %u, minz %.8e, maxz %.8e.\n",
+          viewport->X, viewport->Y, viewport->Width, viewport->Height, viewport->MinZ, viewport->MaxZ);
+
+    device->updateStateBlock->changed.viewport = TRUE;
+    device->updateStateBlock->state.viewport = *viewport;
 
     /* Handle recording of state blocks */
-    if (This->isRecordingState) {
+    if (device->isRecordingState)
+    {
         TRACE("Recording... not performing anything\n");
         return WINED3D_OK;
     }
 
-    TRACE("(%p) : x=%d, y=%d, wid=%d, hei=%d, minz=%f, maxz=%f\n", This,
-          pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height, pViewport->MinZ, pViewport->MaxZ);
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VIEWPORT);
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VIEWPORT);
     return WINED3D_OK;
-
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetViewport(IWineD3DDevice *iface, WINED3DVIEWPORT* pViewport) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p)\n", This);
-    *pViewport = This->stateBlock->state.viewport;
+HRESULT CDECL wined3d_device_get_viewport(IWineD3DDevice *iface, WINED3DVIEWPORT *viewport)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, viewport %p.\n", device, viewport);
+
+    *viewport = device->stateBlock->state.viewport;
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface,
-        WINED3DRENDERSTATETYPE State, DWORD Value)
+HRESULT CDECL wined3d_device_set_render_state(IWineD3DDevice *iface,
+        WINED3DRENDERSTATETYPE state, DWORD value)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    DWORD oldValue = This->stateBlock->state.render_states[State];
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    DWORD old_value = device->stateBlock->state.render_states[state];
 
-    TRACE("iface %p, state %s (%#x), value %#x.\n", iface, debug_d3drenderstate(State), State, Value);
+    TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
 
-    This->updateStateBlock->changed.renderState[State >> 5] |= 1 << (State & 0x1f);
-    This->updateStateBlock->state.render_states[State] = Value;
+    device->updateStateBlock->changed.renderState[state >> 5] |= 1 << (state & 0x1f);
+    device->updateStateBlock->state.render_states[state] = value;
 
-    /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    /* Handle recording of state blocks. */
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
-    /* Compared here and not before the assignment to allow proper stateblock recording */
-    if(Value == oldValue) {
-        TRACE("Application is setting the old value over, nothing to do\n");
-    } else {
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(State));
-    }
+    /* Compared here and not before the assignment to allow proper stateblock recording. */
+    if (value == old_value)
+        TRACE("Application is setting the old value over, nothing to do.\n");
+    else
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(state));
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderState(IWineD3DDevice *iface,
-        WINED3DRENDERSTATETYPE State, DWORD *pValue)
+HRESULT CDECL wined3d_device_get_render_state(IWineD3DDevice *iface,
+        WINED3DRENDERSTATETYPE state, DWORD *value)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, state %s (%#x), value %p.\n", device, debug_d3drenderstate(state), state, value);
 
-    TRACE("iface %p, state %s (%#x), value %p.\n", iface, debug_d3drenderstate(State), State, pValue);
+    *value = device->stateBlock->state.render_states[state];
 
-    *pValue = This->stateBlock->state.render_states[State];
     return WINED3D_OK;
 }
 
-/*****
- * Get / Set Sampler States
- * TODO: Verify against dx9 definitions
- *****/
-
-static HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD Value) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    DWORD oldValue;
+HRESULT CDECL wined3d_device_set_sampler_state(IWineD3DDevice *iface,
+        UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD value)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    DWORD old_value;
 
-    TRACE("(%p) : Sampler %#x, Type %s (%#x), Value %#x\n",
-            This, Sampler, debug_d3dsamplerstate(Type), Type, Value);
+    TRACE("device %p, sampler_idx %u, state %s, value %#x.\n",
+            device, sampler_idx, debug_d3dsamplerstate(state), value);
 
-    if (Sampler >= WINED3DVERTEXTEXTURESAMPLER0 && Sampler <= WINED3DVERTEXTEXTURESAMPLER3) {
-        Sampler -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
-    }
+    if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
+        sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
 
-    if (Sampler >= sizeof(This->stateBlock->state.sampler_states) / sizeof(*This->stateBlock->state.sampler_states))
+    if (sampler_idx >= sizeof(device->stateBlock->state.sampler_states)
+            / sizeof(*device->stateBlock->state.sampler_states))
     {
-        ERR("Current Sampler overflows sampleState0 array (sampler %d)\n", Sampler);
+        WARN("Invalid sampler %u.\n", sampler_idx);
         return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
     }
 
-    oldValue = This->stateBlock->state.sampler_states[Sampler][Type];
-    This->updateStateBlock->state.sampler_states[Sampler][Type] = Value;
-    This->updateStateBlock->changed.samplerState[Sampler] |= 1 << Type;
+    old_value = device->stateBlock->state.sampler_states[sampler_idx][state];
+    device->updateStateBlock->state.sampler_states[sampler_idx][state] = value;
+    device->updateStateBlock->changed.samplerState[sampler_idx] |= 1 << state;
 
-    /* Handle recording of state blocks */
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    /* Handle recording of state blocks. */
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
-    if(oldValue == Value) {
-        TRACE("Application is setting the old value over, nothing to do\n");
+    if (old_value == value)
+    {
+        TRACE("Application is setting the old value over, nothing to do.\n");
         return WINED3D_OK;
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(Sampler));
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(sampler_idx));
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD* Value) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_get_sampler_state(IWineD3DDevice *iface,
+        UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD *value)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("(%p) : Sampler %#x, Type %s (%#x)\n",
-            This, Sampler, debug_d3dsamplerstate(Type), Type);
+    TRACE("device %p, sampler_idx %u, state %s, value %p.\n",
+            device, sampler_idx, debug_d3dsamplerstate(state), value);
 
-    if (Sampler >= WINED3DVERTEXTEXTURESAMPLER0 && Sampler <= WINED3DVERTEXTEXTURESAMPLER3) {
-        Sampler -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
-    }
+    if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
+        sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
 
-    if (Sampler >= sizeof(This->stateBlock->state.sampler_states) / sizeof(*This->stateBlock->state.sampler_states))
+    if (sampler_idx >= sizeof(device->stateBlock->state.sampler_states)
+            / sizeof(*device->stateBlock->state.sampler_states))
     {
-        ERR("Current Sampler overflows sampleState0 array (sampler %d)\n", Sampler);
+        WARN("Invalid sampler %u.\n", sampler_idx);
         return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
     }
-    *Value = This->stateBlock->state.sampler_states[Sampler][Type];
-    TRACE("(%p) : Returning %#x\n", This, *Value);
+
+    *value = device->stateBlock->state.sampler_states[sampler_idx][state];
+    TRACE("Returning %#x.\n", *value);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, CONST RECT* pRect) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_scissor_rect(IWineD3DDevice *iface, const RECT *rect)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, rect %s.\n", device, wine_dbgstr_rect(rect));
 
-    This->updateStateBlock->changed.scissorRect = TRUE;
-    if (EqualRect(&This->updateStateBlock->state.scissor_rect, pRect))
+    device->updateStateBlock->changed.scissorRect = TRUE;
+    if (EqualRect(&device->updateStateBlock->state.scissor_rect, rect))
     {
         TRACE("App is setting the old scissor rectangle over, nothing to do.\n");
         return WINED3D_OK;
     }
-    CopyRect(&This->updateStateBlock->state.scissor_rect, pRect);
+    CopyRect(&device->updateStateBlock->state.scissor_rect, rect);
 
-    if(This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT);
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SCISSORRECT);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_get_scissor_rect(IWineD3DDevice *iface, RECT *rect)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, rect %p.\n", device, rect);
+
+    *rect = device->updateStateBlock->state.scissor_rect;
+    TRACE("Returning rect %s.\n", wine_dbgstr_rect(rect));
 
-    *pRect = This->updateStateBlock->state.scissor_rect;
-    TRACE("(%p)Returning a Scissor Rect of %d:%d-%d:%d\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom);
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice *iface,
-        struct wined3d_vertex_declaration *pDecl)
+HRESULT CDECL wined3d_device_set_vertex_declaration(IWineD3DDevice *iface,
+        struct wined3d_vertex_declaration *declaration)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
-    struct wined3d_vertex_declaration *oldDecl = This->updateStateBlock->state.vertex_declaration;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    struct wined3d_vertex_declaration *prev = device->updateStateBlock->state.vertex_declaration;
 
-    TRACE("iface %p, declaration %p.\n", iface, pDecl);
+    TRACE("device %p, declaration %p.\n", device, declaration);
 
-    if (pDecl)
-        wined3d_vertex_declaration_incref(pDecl);
-    if (oldDecl)
-        wined3d_vertex_declaration_decref(oldDecl);
+    if (declaration)
+        wined3d_vertex_declaration_incref(declaration);
+    if (prev)
+        wined3d_vertex_declaration_decref(prev);
 
-    This->updateStateBlock->state.vertex_declaration = pDecl;
-    This->updateStateBlock->changed.vertexDecl = TRUE;
+    device->updateStateBlock->state.vertex_declaration = declaration;
+    device->updateStateBlock->changed.vertexDecl = TRUE;
 
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
-    } else if(pDecl == oldDecl) {
-        /* Checked after the assignment to allow proper stateblock recording */
-        TRACE("Application is setting the old declaration over, nothing to do\n");
+    }
+    else if (declaration == prev)
+    {
+        /* Checked after the assignment to allow proper stateblock recording. */
+        TRACE("Application is setting the old declaration over, nothing to do.\n");
         return WINED3D_OK;
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VDECL);
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexDeclaration(IWineD3DDevice *iface,
-        struct wined3d_vertex_declaration **ppDecl)
+HRESULT CDECL wined3d_device_get_vertex_declaration(IWineD3DDevice *iface,
+        struct wined3d_vertex_declaration **declaration)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("iface %p, declaration %p.\n", iface, ppDecl);
+    TRACE("device %p, declaration %p.\n", device, declaration);
 
-    *ppDecl = This->stateBlock->state.vertex_declaration;
-    if (*ppDecl)
-        wined3d_vertex_declaration_incref(*ppDecl);
+    *declaration = device->stateBlock->state.vertex_declaration;
+    if (*declaration)
+        wined3d_vertex_declaration_incref(*declaration);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, struct wined3d_shader *shader)
+HRESULT CDECL wined3d_device_set_vertex_shader(IWineD3DDevice *iface, struct wined3d_shader *shader)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_shader *prev = device->updateStateBlock->state.vertex_shader;
 
+    TRACE("device %p, shader %p.\n", device, shader);
+
     device->updateStateBlock->state.vertex_shader = shader;
     device->updateStateBlock->changed.vertexShader = TRUE;
 
@@ -2648,14 +2693,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface,
         TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
-    else if(prev == shader)
+
+    if (shader == prev)
     {
-        /* Checked here to allow proper stateblock recording */
-        TRACE("App is setting the old shader over, nothing to do.\n");
+        TRACE("Application is setting the old shader over, nothing to do.\n");
         return WINED3D_OK;
     }
 
-    TRACE("(%p) : setting shader(%p)\n", device, shader);
     if (shader)
         wined3d_shader_incref(shader);
     if (prev)
@@ -2666,12 +2710,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface,
     return WINED3D_OK;
 }
 
-static struct wined3d_shader * WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface)
+struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(IWineD3DDevice *iface)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_shader *shader;
 
-    TRACE("iface %p.\n", iface);
+    TRACE("device %p.\n", device);
 
     shader = device->stateBlock->state.vertex_shader;
     if (shader)
@@ -2681,150 +2725,145 @@ static struct wined3d_shader * WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3
     return shader;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(
-    IWineD3DDevice *iface,
-    UINT start,
-    CONST BOOL *srcData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    unsigned int i, cnt = min(count, MAX_CONST_B - start);
+HRESULT CDECL wined3d_device_set_vs_consts_b(IWineD3DDevice *iface,
+        UINT start_register, const BOOL *constants, UINT bool_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(bool_count, MAX_CONST_B - start_register);
+    UINT i;
 
-    TRACE("(iface %p, srcData %p, start %d, count %d)\n",
-            iface, srcData, start, count);
+    TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
+            device, start_register, constants, bool_count);
 
-    if (!srcData || start >= MAX_CONST_B) return WINED3DERR_INVALIDCALL;
+    if (!constants || start_register >= MAX_CONST_B)
+        return WINED3DERR_INVALIDCALL;
 
-    memcpy(&This->updateStateBlock->state.vs_consts_b[start], srcData, cnt * sizeof(BOOL));
-    for (i = 0; i < cnt; i++)
-        TRACE("Set BOOL constant %u to %s\n", start + i, srcData[i]? "true":"false");
+    memcpy(&device->updateStateBlock->state.vs_consts_b[start_register], constants, count * sizeof(BOOL));
+    for (i = 0; i < count; ++i)
+        TRACE("Set BOOL constant %u to %s.\n", start_register + i, constants[i] ? "true" : "false");
 
-    for (i = start; i < cnt + start; ++i) {
-        This->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i);
-    }
+    for (i = start_register; i < count + start_register; ++i)
+        device->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i);
 
-    if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+    if (!device->isRecordingState)
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VERTEXSHADERCONSTANT);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantB(
-    IWineD3DDevice *iface,
-    UINT start,
-    BOOL *dstData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int cnt = min(count, MAX_CONST_B - start);
+HRESULT CDECL wined3d_device_get_vs_consts_b(IWineD3DDevice *iface,
+        UINT start_register, BOOL *constants, UINT bool_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(bool_count, MAX_CONST_B - start_register);
 
-    TRACE("(iface %p, dstData %p, start %d, count %d)\n",
-            iface, dstData, start, count);
+    TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
+            device, start_register, constants, bool_count);
 
-    if (!dstData || cnt < 0)
+    if (!constants || start_register >= MAX_CONST_B)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(dstData, &This->stateBlock->state.vs_consts_b[start], cnt * sizeof(BOOL));
+    memcpy(constants, &device->stateBlock->state.vs_consts_b[start_register], count * sizeof(BOOL));
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(
-    IWineD3DDevice *iface,
-    UINT start,
-    CONST int *srcData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    unsigned int i, cnt = min(count, MAX_CONST_I - start);
+HRESULT CDECL wined3d_device_set_vs_consts_i(IWineD3DDevice *iface,
+        UINT start_register, const int *constants, UINT vector4i_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(vector4i_count, MAX_CONST_I - start_register);
+    UINT i;
 
-    TRACE("(iface %p, srcData %p, start %d, count %d)\n",
-            iface, srcData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
+            device, start_register, constants, vector4i_count);
 
-    if (!srcData || start >= MAX_CONST_I) return WINED3DERR_INVALIDCALL;
+    if (!constants || start_register >= MAX_CONST_I)
+        return WINED3DERR_INVALIDCALL;
 
-    memcpy(&This->updateStateBlock->state.vs_consts_i[start * 4], srcData, cnt * sizeof(int) * 4);
-    for (i = 0; i < cnt; i++)
-        TRACE("Set INT constant %u to { %d, %d, %d, %d }\n", start + i,
-           srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
+    memcpy(&device->updateStateBlock->state.vs_consts_i[start_register * 4], constants, count * sizeof(int) * 4);
+    for (i = 0; i < count; ++i)
+        TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i,
+                constants[i * 4], constants[i * 4 + 1],
+                constants[i * 4 + 2], constants[i * 4 + 3]);
 
-    for (i = start; i < cnt + start; ++i) {
-        This->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i);
-    }
+    for (i = start_register; i < count + start_register; ++i)
+        device->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i);
 
-    if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+    if (!device->isRecordingState)
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VERTEXSHADERCONSTANT);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantI(
-    IWineD3DDevice *iface,
-    UINT start,
-    int *dstData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int cnt = min(count, MAX_CONST_I - start);
+HRESULT CDECL wined3d_device_get_vs_consts_i(IWineD3DDevice *iface,
+        UINT start_register, int *constants, UINT vector4i_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(vector4i_count, MAX_CONST_I - start_register);
 
-    TRACE("(iface %p, dstData %p, start %d, count %d)\n",
-            iface, dstData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
+            device, start_register, constants, vector4i_count);
 
-    if (!dstData || ((signed int)MAX_CONST_I - (signed int)start) <= 0)
+    if (!constants || start_register >= MAX_CONST_I)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(dstData, &This->stateBlock->state.vs_consts_i[start * 4], cnt * sizeof(int) * 4);
+    memcpy(constants, &device->stateBlock->state.vs_consts_i[start_register * 4], count * sizeof(int) * 4);
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(
-    IWineD3DDevice *iface,
-    UINT start,
-    CONST float *srcData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_vs_consts_f(IWineD3DDevice *iface,
+        UINT start_register, const float *constants, UINT vector4f_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     UINT i;
 
-    TRACE("(iface %p, srcData %p, start %d, count %d)\n",
-            iface, srcData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
+            device, start_register, constants, vector4f_count);
 
-    /* Specifically test start > limit to catch MAX_UINT overflows when adding start + count */
-    if (!srcData || start + count > This->d3d_vshader_constantF || start > This->d3d_vshader_constantF)
+    /* Specifically test start_register > limit to catch MAX_UINT overflows
+     * when adding start_register + vector4f_count. */
+    if (!constants
+            || start_register + vector4f_count > device->d3d_vshader_constantF
+            || start_register > device->d3d_vshader_constantF)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(&This->updateStateBlock->state.vs_consts_f[start * 4], srcData, count * sizeof(float) * 4);
-    if(TRACE_ON(d3d)) {
-        for (i = 0; i < count; i++)
-            TRACE("Set FLOAT constant %u to { %f, %f, %f, %f }\n", start + i,
-                srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
+    memcpy(&device->updateStateBlock->state.vs_consts_f[start_register * 4],
+            constants, vector4f_count * sizeof(float) * 4);
+    if (TRACE_ON(d3d))
+    {
+        for (i = 0; i < vector4f_count; ++i)
+            TRACE("Set FLOAT constant %u to {%.8e, %.8e, %.8e, %.8e}.\n", start_register + i,
+                    constants[i * 4], constants[i * 4 + 1],
+                    constants[i * 4 + 2], constants[i * 4 + 3]);
     }
 
-    if (!This->isRecordingState)
+    if (!device->isRecordingState)
     {
-        This->shader_backend->shader_update_float_vertex_constants(This, start, count);
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+        device->shader_backend->shader_update_float_vertex_constants(device, start_register, vector4f_count);
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VERTEXSHADERCONSTANT);
     }
 
-    memset(This->updateStateBlock->changed.vertexShaderConstantsF + start, 1,
-            sizeof(*This->updateStateBlock->changed.vertexShaderConstantsF) * count);
+    memset(device->updateStateBlock->changed.vertexShaderConstantsF + start_register, 1,
+            sizeof(*device->updateStateBlock->changed.vertexShaderConstantsF) * vector4f_count);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(
-    IWineD3DDevice *iface,
-    UINT start,
-    float *dstData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int cnt = min(count, This->d3d_vshader_constantF - start);
+HRESULT CDECL wined3d_device_get_vs_consts_f(IWineD3DDevice *iface,
+        UINT start_register, float *constants, UINT vector4f_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    int count = min(vector4f_count, device->d3d_vshader_constantF - start_register);
 
-    TRACE("(iface %p, dstData %p, start %d, count %d)\n",
-            iface, dstData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
+            device, start_register, constants, vector4f_count);
 
-    if (!dstData || cnt < 0)
+    if (!constants || count < 0)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(dstData, &This->stateBlock->state.vs_consts_f[start * 4], cnt * sizeof(float) * 4);
+    memcpy(constants, &device->stateBlock->state.vs_consts_f[start_register * 4], count * sizeof(float) * 4);
+
     return WINED3D_OK;
 }
 
@@ -3033,31 +3072,29 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This)
     if (vs) device_map_vsamplers(This, ps, gl_info);
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, struct wined3d_shader *shader)
+HRESULT CDECL wined3d_device_set_pixel_shader(IWineD3DDevice *iface, struct wined3d_shader *shader)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_shader *prev = device->updateStateBlock->state.pixel_shader;
 
+    TRACE("device %p, shader %p.\n", device, shader);
+
     device->updateStateBlock->state.pixel_shader = shader;
     device->updateStateBlock->changed.pixelShader = TRUE;
 
-    /* Handle recording of state blocks */
-    if (device->isRecordingState)
-        TRACE("Recording... not performing anything\n");
-
     if (device->isRecordingState)
     {
-        TRACE("Recording... not performing anything.\n");
         if (shader)
             wined3d_shader_incref(shader);
         if (prev)
             wined3d_shader_decref(prev);
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
     if (shader == prev)
     {
-        TRACE("App is setting the old pixel shader over, nothing to do.\n");
+        TRACE("Application is setting the old shader over, nothing to do.\n");
         return WINED3D_OK;
     }
 
@@ -3066,18 +3103,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, s
     if (prev)
         wined3d_shader_decref(prev);
 
-    TRACE("Setting shader %p.\n", shader);
     IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADER);
 
     return WINED3D_OK;
 }
 
-static struct wined3d_shader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface)
+struct wined3d_shader * CDECL wined3d_device_get_pixel_shader(IWineD3DDevice *iface)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_shader *shader;
 
-    TRACE("iface %p.\n", iface);
+    TRACE("device %p.\n", device);
 
     shader = device->stateBlock->state.pixel_shader;
     if (shader)
@@ -3087,150 +3123,146 @@ static struct wined3d_shader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3D
     return shader;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(
-    IWineD3DDevice *iface,
-    UINT start,
-    CONST BOOL *srcData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    unsigned int i, cnt = min(count, MAX_CONST_B - start);
+HRESULT CDECL wined3d_device_set_ps_consts_b(IWineD3DDevice *iface,
+        UINT start_register, const BOOL *constants, UINT bool_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(bool_count, MAX_CONST_B - start_register);
+    UINT i;
 
-    TRACE("(iface %p, srcData %p, start %u, count %u)\n",
-            iface, srcData, start, count);
+    TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
+            device, start_register, constants, bool_count);
 
-    if (!srcData || start >= MAX_CONST_B) return WINED3DERR_INVALIDCALL;
+    if (!constants || start_register >= MAX_CONST_B)
+        return WINED3DERR_INVALIDCALL;
 
-    memcpy(&This->updateStateBlock->state.ps_consts_b[start], srcData, cnt * sizeof(BOOL));
-    for (i = 0; i < cnt; i++)
-        TRACE("Set BOOL constant %u to %s\n", start + i, srcData[i]? "true":"false");
+    memcpy(&device->updateStateBlock->state.ps_consts_b[start_register], constants, count * sizeof(BOOL));
+    for (i = 0; i < count; ++i)
+        TRACE("Set BOOL constant %u to %s.\n", start_register + i, constants[i] ? "true" : "false");
 
-    for (i = start; i < cnt + start; ++i) {
-        This->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i);
-    }
+    for (i = start_register; i < count + start_register; ++i)
+        device->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i);
 
-    if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+    if (!device->isRecordingState)
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADERCONSTANT);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantB(
-    IWineD3DDevice *iface,
-    UINT start,
-    BOOL *dstData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int cnt = min(count, MAX_CONST_B - start);
+HRESULT CDECL wined3d_device_get_ps_consts_b(IWineD3DDevice *iface,
+        UINT start_register, BOOL *constants, UINT bool_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(bool_count, MAX_CONST_B - start_register);
 
-    TRACE("(iface %p, dstData %p, start %d, count %d)\n",
-            iface, dstData, start, count);
+    TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
+            device, start_register, constants, bool_count);
 
-    if (!dstData || cnt < 0)
+    if (!constants || start_register >= MAX_CONST_B)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(dstData, &This->stateBlock->state.ps_consts_b[start], cnt * sizeof(BOOL));
+    memcpy(constants, &device->stateBlock->state.ps_consts_b[start_register], count * sizeof(BOOL));
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(
-    IWineD3DDevice *iface,
-    UINT start,
-    CONST int *srcData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    unsigned int i, cnt = min(count, MAX_CONST_I - start);
+HRESULT CDECL wined3d_device_set_ps_consts_i(IWineD3DDevice *iface,
+        UINT start_register, const int *constants, UINT vector4i_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(vector4i_count, MAX_CONST_I - start_register);
+    UINT i;
 
-    TRACE("(iface %p, srcData %p, start %u, count %u)\n",
-            iface, srcData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
+            device, start_register, constants, vector4i_count);
 
-    if (!srcData || start >= MAX_CONST_I) return WINED3DERR_INVALIDCALL;
+    if (!constants || start_register >= MAX_CONST_I)
+        return WINED3DERR_INVALIDCALL;
 
-    memcpy(&This->updateStateBlock->state.ps_consts_i[start * 4], srcData, cnt * sizeof(int) * 4);
-    for (i = 0; i < cnt; i++)
-        TRACE("Set INT constant %u to { %d, %d, %d, %d }\n", start + i,
-           srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
+    memcpy(&device->updateStateBlock->state.ps_consts_i[start_register * 4], constants, count * sizeof(int) * 4);
+    for (i = 0; i < count; ++i)
+        TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i,
+                constants[i * 4], constants[i * 4 + 1],
+                constants[i * 4 + 2], constants[i * 4 + 3]);
 
-    for (i = start; i < cnt + start; ++i) {
-        This->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i);
-    }
+    for (i = start_register; i < count + start_register; ++i)
+        device->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i);
 
-    if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+    if (!device->isRecordingState)
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADERCONSTANT);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantI(
-    IWineD3DDevice *iface,
-    UINT start,
-    int *dstData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int cnt = min(count, MAX_CONST_I - start);
+HRESULT CDECL wined3d_device_get_ps_consts_i(IWineD3DDevice *iface,
+        UINT start_register, int *constants, UINT vector4i_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT count = min(vector4i_count, MAX_CONST_I - start_register);
 
-    TRACE("(iface %p, dstData %p, start %d, count %d)\n",
-            iface, dstData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
+            device, start_register, constants, vector4i_count);
 
-    if (!dstData || cnt < 0)
+    if (!constants || start_register >= MAX_CONST_I)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(dstData, &This->stateBlock->state.ps_consts_i[start * 4], cnt * sizeof(int) * 4);
+    memcpy(constants, &device->stateBlock->state.ps_consts_i[start_register * 4], count * sizeof(int) * 4);
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(
-    IWineD3DDevice *iface,
-    UINT start,
-    CONST float *srcData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_ps_consts_f(IWineD3DDevice *iface,
+        UINT start_register, const float *constants, UINT vector4f_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     UINT i;
 
-    TRACE("(iface %p, srcData %p, start %d, count %d)\n",
-            iface, srcData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
+            device, start_register, constants, vector4f_count);
 
-    /* Specifically test start > limit to catch MAX_UINT overflows when adding start + count */
-    if (!srcData || start + count > This->d3d_pshader_constantF || start > This->d3d_pshader_constantF)
+    /* Specifically test start_register > limit to catch MAX_UINT overflows
+     * when adding start_register + vector4f_count. */
+    if (!constants
+            || start_register + vector4f_count > device->d3d_pshader_constantF
+            || start_register > device->d3d_pshader_constantF)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(&This->updateStateBlock->state.ps_consts_f[start * 4], srcData, count * sizeof(float) * 4);
-    if(TRACE_ON(d3d)) {
-        for (i = 0; i < count; i++)
-            TRACE("Set FLOAT constant %u to { %f, %f, %f, %f }\n", start + i,
-                srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
+    memcpy(&device->updateStateBlock->state.ps_consts_f[start_register * 4],
+            constants, vector4f_count * sizeof(float) * 4);
+    if (TRACE_ON(d3d))
+    {
+        for (i = 0; i < vector4f_count; ++i)
+            TRACE("Set FLOAT constant %u to {%.8e, %.8e, %.8e, %.8e}.\n", start_register + i,
+                    constants[i * 4], constants[i * 4 + 1],
+                    constants[i * 4 + 2], constants[i * 4 + 3]);
     }
 
-    if (!This->isRecordingState)
+    if (!device->isRecordingState)
     {
-        This->shader_backend->shader_update_float_pixel_constants(This, start, count);
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+        device->shader_backend->shader_update_float_pixel_constants(device, start_register, vector4f_count);
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADERCONSTANT);
     }
 
-    memset(This->updateStateBlock->changed.pixelShaderConstantsF + start, 1,
-            sizeof(*This->updateStateBlock->changed.pixelShaderConstantsF) * count);
+    memset(device->updateStateBlock->changed.pixelShaderConstantsF + start_register, 1,
+            sizeof(*device->updateStateBlock->changed.pixelShaderConstantsF) * vector4f_count);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(
-    IWineD3DDevice *iface,
-    UINT start,
-    float *dstData,
-    UINT count) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int cnt = min(count, This->d3d_pshader_constantF - start);
+HRESULT CDECL wined3d_device_get_ps_consts_f(IWineD3DDevice *iface,
+        UINT start_register, float *constants, UINT vector4f_count)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    int count = min(vector4f_count, device->d3d_pshader_constantF - start_register);
 
-    TRACE("(iface %p, dstData %p, start %d, count %d)\n",
-            iface, dstData, start, count);
+    TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
+            device, start_register, constants, vector4f_count);
 
-    if (!dstData || cnt < 0)
+    if (!constants || count < 0)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(dstData, &This->stateBlock->state.ps_consts_f[start * 4], cnt * sizeof(float) * 4);
+    memcpy(constants, &device->stateBlock->state.ps_consts_f[start_register * 4], count * sizeof(float) * 4);
+
     return WINED3D_OK;
 }
 
@@ -3307,15 +3339,9 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
     } else doClip = FALSE;
     dest_ptr = ((char *)buffer_get_sysmem(dest, gl_info)) + dwDestIndex * get_flexible_vertex_size(DestFVF);
 
-    IWineD3DDevice_GetTransform( (IWineD3DDevice *) This,
-                                 WINED3DTS_VIEW,
-                                 &view_mat);
-    IWineD3DDevice_GetTransform( (IWineD3DDevice *) This,
-                                 WINED3DTS_PROJECTION,
-                                 &proj_mat);
-    IWineD3DDevice_GetTransform( (IWineD3DDevice *) This,
-                                 WINED3DTS_WORLDMATRIX(0),
-                                 &world_mat);
+    wined3d_device_get_transform((IWineD3DDevice *)This, WINED3DTS_VIEW, &view_mat);
+    wined3d_device_get_transform((IWineD3DDevice *)This, WINED3DTS_PROJECTION, &proj_mat);
+    wined3d_device_get_transform((IWineD3DDevice *)This, WINED3DTS_WORLDMATRIX(0), &world_mat);
 
     TRACE("View mat:\n");
     TRACE("%f %f %f %f\n", view_mat.u.s._11, view_mat.u.s._12, view_mat.u.s._13, view_mat.u.s._14);
@@ -3336,7 +3362,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
     TRACE("%f %f %f %f\n", world_mat.u.s._41, world_mat.u.s._42, world_mat.u.s._43, world_mat.u.s._44);
 
     /* Get the viewport */
-    IWineD3DDevice_GetViewport( (IWineD3DDevice *) This, &vp);
+    wined3d_device_get_viewport((IWineD3DDevice *)This, &vp);
     TRACE("Viewport: X=%d, Y=%d, Width=%d, Height=%d, MinZ=%f, MaxZ=%f\n",
           vp.X, vp.Y, vp.Width, vp.Height, vp.MinZ, vp.MaxZ);
 
@@ -3644,121 +3670,126 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
     return hr;
 }
 
-/*****
- * Get / Set Texture Stage States
- * TODO: Verify against dx9 definitions
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type, DWORD Value)
+HRESULT CDECL wined3d_device_set_texture_stage_state(IWineD3DDevice *iface,
+        UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD value)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
-    DWORD oldValue;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+    DWORD old_value;
 
-    TRACE("(%p) : Stage=%d, Type=%s(%d), Value=%d\n", This, Stage, debug_d3dtexturestate(Type), Type, Value);
+    TRACE("device %p, stage %u, state %s, value %#x.\n",
+            device, stage, debug_d3dtexturestate(state), value);
 
-    if (Type > WINED3D_HIGHEST_TEXTURE_STATE)
+    if (state > WINED3D_HIGHEST_TEXTURE_STATE)
     {
-        WARN("Invalid Type %d passed.\n", Type);
+        WARN("Invalid state %#x passed.\n", state);
         return WINED3D_OK;
     }
 
-    if (Stage >= gl_info->limits.texture_stages)
+    if (stage >= gl_info->limits.texture_stages)
     {
         WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n",
-                Stage, gl_info->limits.texture_stages - 1);
+                stage, gl_info->limits.texture_stages - 1);
         return WINED3D_OK;
     }
 
-    oldValue = This->updateStateBlock->state.texture_states[Stage][Type];
-    This->updateStateBlock->changed.textureState[Stage] |= 1 << Type;
-    This->updateStateBlock->state.texture_states[Stage][Type] = Value;
+    old_value = device->updateStateBlock->state.texture_states[stage][state];
+    device->updateStateBlock->changed.textureState[stage] |= 1 << state;
+    device->updateStateBlock->state.texture_states[stage][state] = value;
 
-    if (This->isRecordingState) {
-        TRACE("Recording... not performing anything\n");
+    if (device->isRecordingState)
+    {
+        TRACE("Recording... not performing anything.\n");
         return WINED3D_OK;
     }
 
-    /* Checked after the assignments to allow proper stateblock recording */
-    if(oldValue == Value) {
-        TRACE("App is setting the old value over, nothing to do\n");
+    /* Checked after the assignments to allow proper stateblock recording. */
+    if (old_value == value)
+    {
+        TRACE("Application is setting the old value over, nothing to do.\n");
         return WINED3D_OK;
     }
 
-    if (Stage > This->stateBlock->state.lowest_disabled_stage
-            && This->StateTable[STATE_TEXTURESTAGE(0, Type)].representative
+    if (stage > device->stateBlock->state.lowest_disabled_stage
+            && device->StateTable[STATE_TEXTURESTAGE(0, state)].representative
             == STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP))
     {
-        /* Colorop change above lowest disabled stage? That won't change anything in the gl setup
-         * Changes in other states are important on disabled stages too
-         */
+        /* Colorop change above lowest disabled stage? That won't change
+         * anything in the GL setup. Changes in other states are important on
+         * disabled stages too. */
         return WINED3D_OK;
     }
 
-    if(Type == WINED3DTSS_COLOROP) {
+    if (state == WINED3DTSS_COLOROP)
+    {
         unsigned int i;
 
-        if(Value == WINED3DTOP_DISABLE && oldValue != WINED3DTOP_DISABLE) {
-            /* Previously enabled stage disabled now. Make sure to dirtify all enabled stages above Stage,
-             * they have to be disabled
+        if (value == WINED3DTOP_DISABLE && old_value != WINED3DTOP_DISABLE)
+        {
+            /* Previously enabled stage disabled now. Make sure to dirtify
+             * all enabled stages above stage, they have to be disabled.
              *
-             * The current stage is dirtified below.
-             */
-            for (i = Stage + 1; i < This->stateBlock->state.lowest_disabled_stage; ++i)
+             * The current stage is dirtified below. */
+            for (i = stage + 1; i < device->stateBlock->state.lowest_disabled_stage; ++i)
             {
-                TRACE("Additionally dirtifying stage %u\n", i);
-                IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP));
+                TRACE("Additionally dirtifying stage %u.\n", i);
+                IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP));
             }
-            This->stateBlock->state.lowest_disabled_stage = Stage;
-            TRACE("New lowest disabled: %u\n", Stage);
-        } else if(Value != WINED3DTOP_DISABLE && oldValue == WINED3DTOP_DISABLE) {
-            /* Previously disabled stage enabled. Stages above it may need enabling
-             * stage must be lowest_disabled_stage here, if it's bigger success is returned above,
-             * and stages below the lowest disabled stage can't be enabled(because they are enabled already).
+            device->stateBlock->state.lowest_disabled_stage = stage;
+            TRACE("New lowest disabled: %u.\n", stage);
+        }
+        else if (value != WINED3DTOP_DISABLE && old_value == WINED3DTOP_DISABLE)
+        {
+            /* Previously disabled stage enabled. Stages above it may need
+             * enabling. Stage must be lowest_disabled_stage here, if it's
+             * bigger success is returned above, and stages below the lowest
+             * disabled stage can't be enabled (because they are enabled
+             * already).
              *
-             * Again stage Stage doesn't need to be dirtified here, it is handled below.
-             */
-
-            for (i = Stage + 1; i < This->adapter->gl_info.limits.texture_stages; ++i)
+             * Again stage stage doesn't need to be dirtified here, it is
+             * handled below. */
+            for (i = stage + 1; i < gl_info->limits.texture_stages; ++i)
             {
-                if (This->updateStateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE)
+                if (device->updateStateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE)
                     break;
-                TRACE("Additionally dirtifying stage %u due to enable\n", i);
-                IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP));
+                TRACE("Additionally dirtifying stage %u due to enable.\n", i);
+                IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP));
             }
-            This->stateBlock->state.lowest_disabled_stage = i;
-            TRACE("New lowest disabled: %u\n", i);
+            device->stateBlock->state.lowest_disabled_stage = i;
+            TRACE("New lowest disabled: %u.\n", i);
         }
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(Stage, Type));
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, state));
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetTextureStageState(IWineD3DDevice *iface, DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type, DWORD *pValue)
+HRESULT CDECL wined3d_device_get_texture_stage_state(IWineD3DDevice *iface,
+        DWORD stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD *value)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("iface %p, stage %u, state %s, value %p.\n",
-            iface, Stage, debug_d3dtexturestate(Type), pValue);
+    TRACE("device %p, stage %u, state %s, value %p.\n",
+            device, stage, debug_d3dtexturestate(state), value);
 
-    if (Type > WINED3D_HIGHEST_TEXTURE_STATE)
+    if (state > WINED3D_HIGHEST_TEXTURE_STATE)
     {
-        WARN("Invalid Type %d passed.\n", Type);
+        WARN("Invalid state %#x passed.\n", state);
         return WINED3D_OK;
     }
 
-    *pValue = This->updateStateBlock->state.texture_states[Stage][Type];
-    TRACE("Returning %#x.\n", *pValue);
+    *value = device->updateStateBlock->state.texture_states[stage][state];
+    TRACE("Returning %#x.\n", *value);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
+HRESULT CDECL wined3d_device_set_texture(IWineD3DDevice *iface,
         DWORD stage, struct wined3d_texture *texture)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     struct wined3d_texture *prev;
 
     TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
@@ -3767,7 +3798,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
         stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
 
     /* Windows accepts overflowing this array... we do not. */
-    if (stage >= sizeof(This->stateBlock->state.textures) / sizeof(*This->stateBlock->state.textures))
+    if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures))
     {
         WARN("Ignoring invalid stage %u.\n", stage);
         return WINED3D_OK;
@@ -3780,9 +3811,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
         return WINED3DERR_INVALIDCALL;
     }
 
-    This->updateStateBlock->changed.textures |= 1 << stage;
+    device->updateStateBlock->changed.textures |= 1 << stage;
 
-    prev = This->updateStateBlock->state.textures[stage];
+    prev = device->updateStateBlock->state.textures[stage];
     TRACE("Previous texture %p.\n", prev);
 
     if (texture == prev)
@@ -3792,9 +3823,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
     }
 
     TRACE("Setting new texture to %p.\n", texture);
-    This->updateStateBlock->state.textures[stage] = texture;
+    device->updateStateBlock->state.textures[stage] = texture;
 
-    if (This->isRecordingState)
+    if (device->isRecordingState)
     {
         TRACE("Recording... not performing anything\n");
 
@@ -3811,15 +3842,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
         wined3d_texture_incref(texture);
 
         if (!prev || texture->target != prev->target)
-            IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER);
+            IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADER);
 
         if (!prev && stage < gl_info->limits.texture_stages)
         {
             /* The source arguments for color and alpha ops have different
              * meanings when a NULL texture is bound, so the COLOROP and
              * ALPHAOP have to be dirtified. */
-            IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP));
-            IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP));
+            IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP));
+            IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP));
         }
 
         if (bind_count == 1)
@@ -3834,8 +3865,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
 
         if (!texture && stage < gl_info->limits.texture_stages)
         {
-            IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP));
-            IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP));
+            IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP));
+            IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP));
         }
 
         if (bind_count && prev->sampler == stage)
@@ -3847,7 +3878,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
             TRACE("Searching for other stages the texture is bound to.\n");
             for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
             {
-                if (This->updateStateBlock->state.textures[i] == prev)
+                if (device->updateStateBlock->state.textures[i] == prev)
                 {
                     TRACE("Texture is also bound to stage %u.\n", i);
                     prev->sampler = i;
@@ -3857,28 +3888,28 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
         }
     }
 
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(stage));
+    IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(stage));
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface,
+HRESULT CDECL wined3d_device_get_texture(IWineD3DDevice *iface,
         DWORD stage, struct wined3d_texture **texture)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
+    TRACE("device %p, stage %u, texture %p.\n", device, stage, texture);
 
     if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
         stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
 
-    if (stage >= sizeof(This->stateBlock->state.textures) / sizeof(*This->stateBlock->state.textures))
+    if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures))
     {
-        WARN("Current stage overflows textures array (stage %u).\n", stage);
+        WARN("Ignoring invalid stage %u.\n", stage);
         return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
     }
 
-    *texture = This->stateBlock->state.textures[stage];
+    *texture = device->stateBlock->state.textures[stage];
     if (*texture)
         wined3d_texture_incref(*texture);
 
@@ -4592,136 +4623,160 @@ static void dirtify_p8_texture_samplers(IWineD3DDeviceImpl *device)
     }
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetPaletteEntries(IWineD3DDevice *iface,
-        UINT PaletteNumber, const PALETTEENTRY *pEntries)
+HRESULT CDECL wined3d_device_set_palette_entries(IWineD3DDevice *iface,
+        UINT palette_idx, const PALETTEENTRY *entries)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int j;
-    UINT NewSize;
-    PALETTEENTRY **palettes;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT i;
 
-    TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber);
+    TRACE("device %p, palette_idx %u, entries %p.\n", device, palette_idx, entries);
 
-    if (PaletteNumber >= MAX_PALETTES) {
-        ERR("(%p) : (%u) Out of range 0-%u, returning Invalid Call\n", This, PaletteNumber, MAX_PALETTES);
+    if (palette_idx >= MAX_PALETTES)
+    {
+        WARN("Invalid palette index %u.\n", palette_idx);
         return WINED3DERR_INVALIDCALL;
     }
 
-    if (PaletteNumber >= This->palette_count)
+    if (palette_idx >= device->palette_count)
     {
-        NewSize = This->palette_count;
-        do {
-           NewSize *= 2;
-        } while(PaletteNumber >= NewSize);
-        palettes = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->palettes, sizeof(PALETTEENTRY*) * NewSize);
-        if (!palettes) {
+        UINT new_size = device->palette_count;
+        PALETTEENTRY **palettes;
+
+        do
+        {
+           new_size *= 2;
+        } while (palette_idx >= new_size);
+        palettes = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, device->palettes, sizeof(*palettes) * new_size);
+        if (!palettes)
+        {
             ERR("Out of memory!\n");
             return E_OUTOFMEMORY;
         }
-        This->palettes = palettes;
-        This->palette_count = NewSize;
+        device->palettes = palettes;
+        device->palette_count = new_size;
     }
 
-    if (!This->palettes[PaletteNumber]) {
-        This->palettes[PaletteNumber] = HeapAlloc(GetProcessHeap(),  0, sizeof(PALETTEENTRY) * 256);
-        if (!This->palettes[PaletteNumber]) {
+    if (!device->palettes[palette_idx])
+    {
+        device->palettes[palette_idx] = HeapAlloc(GetProcessHeap(),  0, sizeof(PALETTEENTRY) * 256);
+        if (!device->palettes[palette_idx])
+        {
             ERR("Out of memory!\n");
             return E_OUTOFMEMORY;
         }
     }
 
-    for (j = 0; j < 256; ++j) {
-        This->palettes[PaletteNumber][j].peRed   = pEntries[j].peRed;
-        This->palettes[PaletteNumber][j].peGreen = pEntries[j].peGreen;
-        This->palettes[PaletteNumber][j].peBlue  = pEntries[j].peBlue;
-        This->palettes[PaletteNumber][j].peFlags = pEntries[j].peFlags;
+    for (i = 0; i < 256; ++i)
+    {
+        device->palettes[palette_idx][i].peRed = entries[i].peRed;
+        device->palettes[palette_idx][i].peGreen = entries[i].peGreen;
+        device->palettes[palette_idx][i].peBlue = entries[i].peBlue;
+        device->palettes[palette_idx][i].peFlags = entries[i].peFlags;
     }
-    if (PaletteNumber == This->currentPalette) dirtify_p8_texture_samplers(This);
-    TRACE("(%p) : returning\n", This);
+
+    if (palette_idx == device->currentPalette)
+        dirtify_p8_texture_samplers(device);
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetPaletteEntries(IWineD3DDevice *iface,
-        UINT PaletteNumber, PALETTEENTRY *pEntries)
+HRESULT CDECL wined3d_device_get_palette_entries(IWineD3DDevice *iface,
+        UINT palette_idx, PALETTEENTRY *entries)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    int j;
-    TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber);
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+    UINT i;
 
-    if (PaletteNumber >= This->palette_count || !This->palettes[PaletteNumber])
+    TRACE("device %p, palette_idx %u, entries %p.\n", device, palette_idx, entries);
+
+    if (palette_idx >= device->palette_count || !device->palettes[palette_idx])
     {
-        /* What happens in such situation isn't documented; Native seems to silently abort
-           on such conditions. Return Invalid Call. */
-        ERR("(%p) : (%u) Nonexistent palette. Palette count %u.\n", This, PaletteNumber, This->palette_count);
+        /* What happens in such situation isn't documented; Native seems to
+         * silently abort on such conditions. */
+        WARN("Invalid palette index %u.\n", palette_idx);
         return WINED3DERR_INVALIDCALL;
     }
-    for (j = 0; j < 256; ++j) {
-        pEntries[j].peRed   = This->palettes[PaletteNumber][j].peRed;
-        pEntries[j].peGreen = This->palettes[PaletteNumber][j].peGreen;
-        pEntries[j].peBlue  = This->palettes[PaletteNumber][j].peBlue;
-        pEntries[j].peFlags = This->palettes[PaletteNumber][j].peFlags;
+
+    for (i = 0; i < 256; ++i)
+    {
+        entries[i].peRed = device->palettes[palette_idx][i].peRed;
+        entries[i].peGreen = device->palettes[palette_idx][i].peGreen;
+        entries[i].peBlue = device->palettes[palette_idx][i].peBlue;
+        entries[i].peFlags = device->palettes[palette_idx][i].peFlags;
     }
-    TRACE("(%p) : returning\n", This);
+
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetCurrentTexturePalette(IWineD3DDevice *iface, UINT PaletteNumber)
+HRESULT CDECL wined3d_device_set_current_texture_palette(IWineD3DDevice *iface, UINT palette_idx)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber);
-    /* Native appears to silently abort on attempt to make an uninitialized palette current and render.
-       (tested with reference rasterizer). Return Invalid Call. */
-    if (PaletteNumber >= This->palette_count || !This->palettes[PaletteNumber])
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
+
+    TRACE("device %p, palette_idx %u.\n", device, palette_idx);
+
+    /* Native appears to silently abort on attempt to make an uninitialized
+     * palette current and render. (tested with reference rasterizer). */
+    if (palette_idx >= device->palette_count || !device->palettes[palette_idx])
     {
-        ERR("(%p) : (%u) Nonexistent palette. Palette count %u.\n", This, PaletteNumber, This->palette_count);
+        WARN("Invalid palette index %u.\n", palette_idx);
         return WINED3DERR_INVALIDCALL;
     }
-    /*TODO: stateblocks */
-    if (This->currentPalette != PaletteNumber) {
-        This->currentPalette = PaletteNumber;
-        dirtify_p8_texture_samplers(This);
+
+    /* TODO: stateblocks? */
+    if (device->currentPalette != palette_idx)
+    {
+        device->currentPalette = palette_idx;
+        dirtify_p8_texture_samplers(device);
     }
-    TRACE("(%p) : returning\n", This);
+
     return WINED3D_OK;
 }
 
-static HRESULT  WINAPI  IWineD3DDeviceImpl_GetCurrentTexturePalette(IWineD3DDevice *iface, UINT* PaletteNumber) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_get_current_texture_palette(IWineD3DDevice *iface, UINT *palette_idx)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    if (!PaletteNumber)
-    {
-        WARN("(%p) : returning Invalid Call\n", This);
+    TRACE("device %p, palette_idx %p.\n", device, palette_idx);
+
+    if (!palette_idx)
         return WINED3DERR_INVALIDCALL;
-    }
-    /*TODO: stateblocks */
-    *PaletteNumber = This->currentPalette;
-    TRACE("(%p) : returning  %u\n", This, *PaletteNumber);
+
+    *palette_idx = device->currentPalette;
+
     return WINED3D_OK;
 }
 
-static HRESULT  WINAPI  IWineD3DDeviceImpl_SetSoftwareVertexProcessing(IWineD3DDevice *iface, BOOL bSoftware) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+HRESULT CDECL wined3d_device_set_software_vertex_processing(IWineD3DDevice *iface, BOOL software)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     static BOOL warned;
+
+    TRACE("device %p, software %#x.\n", device, software);
+
     if (!warned)
     {
-        FIXME("(%p) : stub\n", This);
+        FIXME("device %p, software %#x stub!\n", device, software);
         warned = TRUE;
     }
 
-    This->softwareVertexProcessing = bSoftware;
+    device->softwareVertexProcessing = software;
+
     return WINED3D_OK;
 }
 
-
-static BOOL     WINAPI  IWineD3DDeviceImpl_GetSoftwareVertexProcessing(IWineD3DDevice *iface) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+BOOL CDECL wined3d_device_get_software_vertex_processing(IWineD3DDevice *iface)
+{
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     static BOOL warned;
+
+    TRACE("device %p.\n", device);
+
     if (!warned)
     {
-        FIXME("(%p) : stub\n", This);
+        TRACE("device %p stub!\n", device);
         warned = TRUE;
     }
-    return This->softwareVertexProcessing;
+
+    return device->softwareVertexProcessing;
 }
 
 static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface,
@@ -4751,27 +4806,36 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface,
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetNPatchMode(IWineD3DDevice *iface, float nSegments)
+HRESULT CDECL wined3d_device_set_npatch_mode(IWineD3DDevice *iface, float segments)
 {
     static BOOL warned;
-    if(nSegments != 0.0f) {
+
+    TRACE("iface %p, segments %.8e.\n", iface, segments);
+
+    if (segments != 0.0f)
+    {
         if (!warned)
         {
-            FIXME("iface %p, nSegments %.8e stub!\n", iface, nSegments);
+            FIXME("iface %p, segments %.8e stub!\n", iface, segments);
             warned = TRUE;
         }
     }
+
     return WINED3D_OK;
 }
 
-static float WINAPI IWineD3DDeviceImpl_GetNPatchMode(IWineD3DDevice *iface)
+float CDECL wined3d_device_get_npatch_mode(IWineD3DDevice *iface)
 {
     static BOOL warned;
+
+    TRACE("iface %p.\n", iface);
+
     if (!warned)
     {
         FIXME("iface %p stub!\n", iface);
         warned = TRUE;
     }
+
     return 0.0f;
 }
 
@@ -5070,8 +5134,7 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
     if (FAILED(hr)) ERR("Color fill failed, hr %#x.\n", hr);
 }
 
-/* rendertarget and depth stencil functions */
-static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface,
+HRESULT CDECL wined3d_device_get_render_target(IWineD3DDevice *iface,
         DWORD render_target_idx, struct wined3d_surface **render_target)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
@@ -5094,29 +5157,31 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface,
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice *iface,
-        struct wined3d_surface **depth_stencil)
+HRESULT CDECL wined3d_device_get_depth_stencil(IWineD3DDevice *iface, struct wined3d_surface **depth_stencil)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
 
-    TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
+    TRACE("device %p, depth_stencil %p.\n", device, depth_stencil);
 
     *depth_stencil = device->depth_stencil;
     TRACE("Returning depth/stencil surface %p.\n", *depth_stencil);
-    if (!*depth_stencil) return WINED3DERR_NOTFOUND;
+
+    if (!*depth_stencil)
+        return WINED3DERR_NOTFOUND;
+
     wined3d_surface_incref(*depth_stencil);
 
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
+HRESULT CDECL wined3d_device_set_render_target(IWineD3DDevice *iface,
         DWORD render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport)
 {
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_surface *prev;
 
-    TRACE("iface %p, render_target_idx %u, render_target %p, set_viewport %#x.\n",
-            iface, render_target_idx, render_target, set_viewport);
+    TRACE("device %p, render_target_idx %u, render_target %p, set_viewport %#x.\n",
+            device, render_target_idx, render_target, set_viewport);
 
     if (render_target_idx >= device->adapter->gl_info.limits.buffers)
     {
@@ -5176,54 +5241,54 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface,
-        struct wined3d_surface *depth_stencil)
+HRESULT CDECL wined3d_device_set_depth_stencil(IWineD3DDevice *iface, struct wined3d_surface *depth_stencil)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
     struct wined3d_surface *tmp;
 
-    TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n", This, depth_stencil, This->depth_stencil);
+    TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n",
+            device, depth_stencil, device->depth_stencil);
 
-    if (This->depth_stencil == depth_stencil)
+    if (device->depth_stencil == depth_stencil)
     {
         TRACE("Trying to do a NOP SetRenderTarget operation.\n");
         return WINED3D_OK;
     }
 
-    if (This->depth_stencil)
+    if (device->depth_stencil)
     {
-        if (This->swapchains[0]->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
-                || This->depth_stencil->flags & SFLAG_DISCARD)
+        if (device->swapchains[0]->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
+                || device->depth_stencil->flags & SFLAG_DISCARD)
         {
-            surface_modify_ds_location(This->depth_stencil, SFLAG_DS_DISCARDED,
-                    This->depth_stencil->resource.width,
-                    This->depth_stencil->resource.height);
-            if (This->depth_stencil == This->onscreen_depth_stencil)
+            surface_modify_ds_location(device->depth_stencil, SFLAG_DS_DISCARDED,
+                    device->depth_stencil->resource.width,
+                    device->depth_stencil->resource.height);
+            if (device->depth_stencil == device->onscreen_depth_stencil)
             {
-                wined3d_surface_decref(This->onscreen_depth_stencil);
-                This->onscreen_depth_stencil = NULL;
+                wined3d_surface_decref(device->onscreen_depth_stencil);
+                device->onscreen_depth_stencil = NULL;
             }
         }
     }
 
-    tmp = This->depth_stencil;
-    This->depth_stencil = depth_stencil;
-    if (This->depth_stencil)
-        wined3d_surface_incref(This->depth_stencil);
+    tmp = device->depth_stencil;
+    device->depth_stencil = depth_stencil;
+    if (device->depth_stencil)
+        wined3d_surface_incref(device->depth_stencil);
     if (tmp)
         wined3d_surface_decref(tmp);
 
     if ((!tmp && depth_stencil) || (!depth_stencil && tmp))
     {
         /* Swapping NULL / non NULL depth stencil affects the depth and tests */
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_ZENABLE));
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_STENCILENABLE));
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_STENCILWRITEMASK));
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_DEPTHBIAS));
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_ZENABLE));
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_STENCILENABLE));
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_STENCILWRITEMASK));
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_DEPTHBIAS));
     }
-    else if (tmp && tmp->resource.format->depth_size != This->depth_stencil->resource.format->depth_size)
+    else if (tmp && tmp->resource.format->depth_size != device->depth_stencil->resource.format->depth_size)
     {
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_DEPTHBIAS));
+        IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_DEPTHBIAS));
     }
 
     return WINED3D_OK;
@@ -5756,9 +5821,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
 
     /* Reset the depth stencil */
     if (pPresentationParameters->EnableAutoDepthStencil)
-        IWineD3DDevice_SetDepthStencilSurface(iface, This->auto_depth_stencil);
+        wined3d_device_set_depth_stencil(iface, This->auto_depth_stencil);
     else
-        IWineD3DDevice_SetDepthStencilSurface(iface, NULL);
+        wined3d_device_set_depth_stencil(iface, NULL);
 
     TRACE("Resetting stateblock\n");
     wined3d_stateblock_decref(This->updateStateBlock);
@@ -5935,29 +6000,31 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_GetCreationParameters(IWineD3DDevice
     return WINED3D_OK;
 }
 
-static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice *iface,
-        UINT iSwapChain, DWORD flags, const WINED3DGAMMARAMP *pRamp)
+void CDECL wined3d_device_set_gamma_ramp(IWineD3DDevice *iface,
+        UINT swapchain_idx, DWORD flags, const WINED3DGAMMARAMP *ramp)
 {
     struct wined3d_swapchain *swapchain;
 
-    TRACE("Relaying  to swapchain\n");
+    TRACE("iface %p, swapchain_idx %u, flags %#x, ramp %p.\n",
+            iface, swapchain_idx, flags, ramp);
 
-    if (SUCCEEDED(IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)))
+    if (SUCCEEDED(IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain)))
     {
-        wined3d_swapchain_set_gamma_ramp(swapchain, flags, pRamp);
+        wined3d_swapchain_set_gamma_ramp(swapchain, flags, ramp);
         wined3d_swapchain_decref(swapchain);
     }
 }
 
-static void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT iSwapChain, WINED3DGAMMARAMP* pRamp)
+void CDECL wined3d_device_get_gamma_ramp(IWineD3DDevice *iface, UINT swapchain_idx, WINED3DGAMMARAMP *ramp)
 {
     struct wined3d_swapchain *swapchain;
 
-    TRACE("Relaying  to swapchain\n");
+    TRACE("iface %p, swapchain_idx %u, ramp %p.\n",
+            iface, swapchain_idx, ramp);
 
-    if (SUCCEEDED(IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)))
+    if (SUCCEEDED(IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain)))
     {
-        wined3d_swapchain_get_gamma_ramp(swapchain, pRamp);
+        wined3d_swapchain_get_gamma_ramp(swapchain, ramp);
         wined3d_swapchain_decref(swapchain);
     }
 }
@@ -6162,71 +6229,6 @@ static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
     IWineD3DDeviceImpl_SetCursorProperties,
     IWineD3DDeviceImpl_SetCursorPosition,
     IWineD3DDeviceImpl_ShowCursor,
-    /*** Getters and setters **/
-    IWineD3DDeviceImpl_SetClipPlane,
-    IWineD3DDeviceImpl_GetClipPlane,
-    IWineD3DDeviceImpl_SetClipStatus,
-    IWineD3DDeviceImpl_GetClipStatus,
-    IWineD3DDeviceImpl_SetCurrentTexturePalette,
-    IWineD3DDeviceImpl_GetCurrentTexturePalette,
-    IWineD3DDeviceImpl_SetDepthStencilSurface,
-    IWineD3DDeviceImpl_GetDepthStencilSurface,
-    IWineD3DDeviceImpl_SetGammaRamp,
-    IWineD3DDeviceImpl_GetGammaRamp,
-    IWineD3DDeviceImpl_SetIndexBuffer,
-    IWineD3DDeviceImpl_GetIndexBuffer,
-    IWineD3DDeviceImpl_SetBaseVertexIndex,
-    IWineD3DDeviceImpl_GetBaseVertexIndex,
-    IWineD3DDeviceImpl_SetLight,
-    IWineD3DDeviceImpl_GetLight,
-    IWineD3DDeviceImpl_SetLightEnable,
-    IWineD3DDeviceImpl_GetLightEnable,
-    IWineD3DDeviceImpl_SetMaterial,
-    IWineD3DDeviceImpl_GetMaterial,
-    IWineD3DDeviceImpl_SetNPatchMode,
-    IWineD3DDeviceImpl_GetNPatchMode,
-    IWineD3DDeviceImpl_SetPaletteEntries,
-    IWineD3DDeviceImpl_GetPaletteEntries,
-    IWineD3DDeviceImpl_SetPixelShader,
-    IWineD3DDeviceImpl_GetPixelShader,
-    IWineD3DDeviceImpl_SetPixelShaderConstantB,
-    IWineD3DDeviceImpl_GetPixelShaderConstantB,
-    IWineD3DDeviceImpl_SetPixelShaderConstantI,
-    IWineD3DDeviceImpl_GetPixelShaderConstantI,
-    IWineD3DDeviceImpl_SetPixelShaderConstantF,
-    IWineD3DDeviceImpl_GetPixelShaderConstantF,
-    IWineD3DDeviceImpl_SetRenderState,
-    IWineD3DDeviceImpl_GetRenderState,
-    IWineD3DDeviceImpl_SetRenderTarget,
-    IWineD3DDeviceImpl_GetRenderTarget,
-    IWineD3DDeviceImpl_SetSamplerState,
-    IWineD3DDeviceImpl_GetSamplerState,
-    IWineD3DDeviceImpl_SetScissorRect,
-    IWineD3DDeviceImpl_GetScissorRect,
-    IWineD3DDeviceImpl_SetSoftwareVertexProcessing,
-    IWineD3DDeviceImpl_GetSoftwareVertexProcessing,
-    IWineD3DDeviceImpl_SetStreamSource,
-    IWineD3DDeviceImpl_GetStreamSource,
-    IWineD3DDeviceImpl_SetStreamSourceFreq,
-    IWineD3DDeviceImpl_GetStreamSourceFreq,
-    IWineD3DDeviceImpl_SetTexture,
-    IWineD3DDeviceImpl_GetTexture,
-    IWineD3DDeviceImpl_SetTextureStageState,
-    IWineD3DDeviceImpl_GetTextureStageState,
-    IWineD3DDeviceImpl_SetTransform,
-    IWineD3DDeviceImpl_GetTransform,
-    IWineD3DDeviceImpl_SetVertexDeclaration,
-    IWineD3DDeviceImpl_GetVertexDeclaration,
-    IWineD3DDeviceImpl_SetVertexShader,
-    IWineD3DDeviceImpl_GetVertexShader,
-    IWineD3DDeviceImpl_SetVertexShaderConstantB,
-    IWineD3DDeviceImpl_GetVertexShaderConstantB,
-    IWineD3DDeviceImpl_SetVertexShaderConstantI,
-    IWineD3DDeviceImpl_GetVertexShaderConstantI,
-    IWineD3DDeviceImpl_SetVertexShaderConstantF,
-    IWineD3DDeviceImpl_GetVertexShaderConstantF,
-    IWineD3DDeviceImpl_SetViewport,
-    IWineD3DDeviceImpl_GetViewport,
     IWineD3DDeviceImpl_MultiplyTransform,
     IWineD3DDeviceImpl_ValidateDevice,
     IWineD3DDeviceImpl_ProcessVertices,
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 8dfa232..d979ed9 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -897,8 +897,8 @@ static void apply_lights(IWineD3DDevice *device, const struct wined3d_state *sta
         {
             const struct wined3d_light_info *light = LIST_ENTRY(e, struct wined3d_light_info, entry);
 
-            IWineD3DDevice_SetLight(device, light->OriginalIndex, &light->OriginalParms);
-            IWineD3DDevice_SetLightEnable(device, light->OriginalIndex, light->glIndex != -1);
+            wined3d_device_set_light(device, light->OriginalIndex, &light->OriginalParms);
+            wined3d_device_set_light_enable(device, light->OriginalIndex, light->glIndex != -1);
         }
     }
 }
@@ -913,51 +913,51 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
     TRACE("Blocktype: %#x.\n", stateblock->blockType);
 
     if (stateblock->changed.vertexShader)
-        IWineD3DDevice_SetVertexShader(device, stateblock->state.vertex_shader);
+        wined3d_device_set_vertex_shader(device, stateblock->state.vertex_shader);
 
     /* Vertex Shader Constants. */
     for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
     {
-        IWineD3DDevice_SetVertexShaderConstantF(device, stateblock->contained_vs_consts_f[i],
+        wined3d_device_set_vs_consts_f(device, stateblock->contained_vs_consts_f[i],
                 stateblock->state.vs_consts_f + stateblock->contained_vs_consts_f[i] * 4, 1);
     }
     for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
     {
-        IWineD3DDevice_SetVertexShaderConstantI(device, stateblock->contained_vs_consts_i[i],
+        wined3d_device_set_vs_consts_i(device, stateblock->contained_vs_consts_i[i],
                 stateblock->state.vs_consts_i + stateblock->contained_vs_consts_i[i] * 4, 1);
     }
     for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
     {
-        IWineD3DDevice_SetVertexShaderConstantB(device, stateblock->contained_vs_consts_b[i],
+        wined3d_device_set_vs_consts_b(device, stateblock->contained_vs_consts_b[i],
                 stateblock->state.vs_consts_b + stateblock->contained_vs_consts_b[i], 1);
     }
 
     apply_lights(device, &stateblock->state);
 
     if (stateblock->changed.pixelShader)
-        IWineD3DDevice_SetPixelShader(device, stateblock->state.pixel_shader);
+        wined3d_device_set_pixel_shader(device, stateblock->state.pixel_shader);
 
     /* Pixel Shader Constants. */
     for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
     {
-        IWineD3DDevice_SetPixelShaderConstantF(device, stateblock->contained_ps_consts_f[i],
+        wined3d_device_set_ps_consts_f(device, stateblock->contained_ps_consts_f[i],
                 stateblock->state.ps_consts_f + stateblock->contained_ps_consts_f[i] * 4, 1);
     }
     for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
     {
-        IWineD3DDevice_SetPixelShaderConstantI(device, stateblock->contained_ps_consts_i[i],
+        wined3d_device_set_ps_consts_i(device, stateblock->contained_ps_consts_i[i],
                 stateblock->state.ps_consts_i + stateblock->contained_ps_consts_i[i] * 4, 1);
     }
     for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i)
     {
-        IWineD3DDevice_SetPixelShaderConstantB(device, stateblock->contained_ps_consts_b[i],
+        wined3d_device_set_ps_consts_b(device, stateblock->contained_ps_consts_b[i],
                 stateblock->state.ps_consts_b + stateblock->contained_ps_consts_b[i], 1);
     }
 
     /* Render states. */
     for (i = 0; i < stateblock->num_contained_render_states; ++i)
     {
-        IWineD3DDevice_SetRenderState(device, stateblock->contained_render_states[i],
+        wined3d_device_set_render_state(device, stateblock->contained_render_states[i],
                 stateblock->state.render_states[stateblock->contained_render_states[i]]);
     }
 
@@ -967,7 +967,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
         DWORD stage = stateblock->contained_tss_states[i].stage;
         DWORD state = stateblock->contained_tss_states[i].state;
 
-        IWineD3DDevice_SetTextureStageState(device, stage, state, stateblock->state.texture_states[stage][state]);
+        wined3d_device_set_texture_stage_state(device, stage, state, stateblock->state.texture_states[stage][state]);
     }
 
     /* Sampler states. */
@@ -978,13 +978,13 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
         DWORD value = stateblock->state.sampler_states[stage][state];
 
         if (stage >= MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS;
-        IWineD3DDevice_SetSamplerState(device, stage, state, value);
+        wined3d_device_set_sampler_state(device, stage, state, value);
     }
 
     /* Transform states. */
     for (i = 0; i < stateblock->num_contained_transform_states; ++i)
     {
-        IWineD3DDevice_SetTransform(device, stateblock->contained_transform_states[i],
+        wined3d_device_set_transform(device, stateblock->contained_transform_states[i],
                 &stateblock->state.transforms[stateblock->contained_transform_states[i]]);
     }
 
@@ -996,35 +996,27 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
 
     if (stateblock->changed.indices)
     {
-        IWineD3DDevice_SetIndexBuffer(device, stateblock->state.index_buffer, stateblock->state.index_format);
-        IWineD3DDevice_SetBaseVertexIndex(device, stateblock->state.base_vertex_index);
+        wined3d_device_set_index_buffer(device, stateblock->state.index_buffer, stateblock->state.index_format);
+        wined3d_device_set_base_vertex_index(device, stateblock->state.base_vertex_index);
     }
 
     if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration)
-    {
-        IWineD3DDevice_SetVertexDeclaration(device, stateblock->state.vertex_declaration);
-    }
+        wined3d_device_set_vertex_declaration(device, stateblock->state.vertex_declaration);
 
     if (stateblock->changed.material)
-    {
-        IWineD3DDevice_SetMaterial(device, &stateblock->state.material);
-    }
+        wined3d_device_set_material(device, &stateblock->state.material);
 
     if (stateblock->changed.viewport)
-    {
-        IWineD3DDevice_SetViewport(device, &stateblock->state.viewport);
-    }
+        wined3d_device_set_viewport(device, &stateblock->state.viewport);
 
     if (stateblock->changed.scissorRect)
-    {
-        IWineD3DDevice_SetScissorRect(device, &stateblock->state.scissor_rect);
-    }
+        wined3d_device_set_scissor_rect(device, &stateblock->state.scissor_rect);
 
     map = stateblock->changed.streamSource;
     for (i = 0; map; map >>= 1, ++i)
     {
         if (map & 1)
-            IWineD3DDevice_SetStreamSource(device, i,
+            wined3d_device_set_stream_source(device, i,
                     stateblock->state.streams[i].buffer,
                     0, stateblock->state.streams[i].stride);
     }
@@ -1033,7 +1025,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
     for (i = 0; map; map >>= 1, ++i)
     {
         if (map & 1)
-            IWineD3DDevice_SetStreamSourceFreq(device, i,
+            wined3d_device_set_stream_source_freq(device, i,
                     stateblock->state.streams[i].frequency | stateblock->state.streams[i].flags);
     }
 
@@ -1045,7 +1037,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
         if (!(map & 1)) continue;
 
         stage = i < MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - MAX_FRAGMENT_SAMPLERS;
-        IWineD3DDevice_SetTexture(device, stage, stateblock->state.textures[i]);
+        wined3d_device_set_texture(device, stage, stateblock->state.textures[i]);
     }
 
     map = stateblock->changed.clipplane;
@@ -1059,7 +1051,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
         clip[1] = (float) stateblock->state.clip_planes[i][1];
         clip[2] = (float) stateblock->state.clip_planes[i][2];
         clip[3] = (float) stateblock->state.clip_planes[i][3];
-        IWineD3DDevice_SetClipPlane(device, i, clip);
+        wined3d_device_set_clip_plane(device, i, clip);
     }
 
     stateblock->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1;
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 283d9fa..4185894 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -45,6 +45,70 @@
 @ cdecl wined3d_clipper_set_window(ptr long ptr)
 
 @ cdecl wined3d_device_create(ptr long long ptr long ptr ptr)
+@ cdecl wined3d_device_get_base_vertex_index(ptr)
+@ cdecl wined3d_device_get_clip_plane(ptr long ptr)
+@ cdecl wined3d_device_get_clip_status(ptr ptr)
+@ cdecl wined3d_device_get_current_texture_palette(ptr ptr)
+@ cdecl wined3d_device_get_depth_stencil(ptr ptr)
+@ cdecl wined3d_device_get_gamma_ramp(ptr long ptr)
+@ cdecl wined3d_device_get_index_buffer(ptr ptr)
+@ cdecl wined3d_device_get_light(ptr long ptr)
+@ cdecl wined3d_device_get_light_enable(ptr long ptr)
+@ cdecl wined3d_device_get_material(ptr ptr)
+@ cdecl wined3d_device_get_npatch_mode(ptr)
+@ cdecl wined3d_device_get_palette_entries(ptr long ptr)
+@ cdecl wined3d_device_get_pixel_shader(ptr)
+@ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long)
+@ cdecl wined3d_device_get_ps_consts_f(ptr long ptr long)
+@ cdecl wined3d_device_get_ps_consts_i(ptr long ptr long)
+@ cdecl wined3d_device_get_render_state(ptr long ptr)
+@ cdecl wined3d_device_get_render_target(ptr long ptr)
+@ cdecl wined3d_device_get_sampler_state(ptr long long ptr)
+@ cdecl wined3d_device_get_scissor_rect(ptr ptr)
+@ cdecl wined3d_device_get_software_vertex_processing(ptr)
+@ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr)
+@ cdecl wined3d_device_get_stream_source_freq(ptr long ptr)
+@ cdecl wined3d_device_get_texture(ptr long ptr)
+@ cdecl wined3d_device_get_texture_stage_state(ptr long long ptr)
+@ cdecl wined3d_device_get_transform(ptr long ptr)
+@ cdecl wined3d_device_get_vertex_declaration(ptr ptr)
+@ cdecl wined3d_device_get_vertex_shader(ptr)
+@ cdecl wined3d_device_get_viewport(ptr ptr)
+@ cdecl wined3d_device_get_vs_consts_b(ptr long ptr long)
+@ cdecl wined3d_device_get_vs_consts_f(ptr long ptr long)
+@ cdecl wined3d_device_get_vs_consts_i(ptr long ptr long)
+@ cdecl wined3d_device_set_base_vertex_index(ptr long)
+@ cdecl wined3d_device_set_clip_plane(ptr long ptr)
+@ cdecl wined3d_device_set_clip_status(ptr ptr)
+@ cdecl wined3d_device_set_current_texture_palette(ptr long)
+@ cdecl wined3d_device_set_depth_stencil(ptr ptr)
+@ cdecl wined3d_device_set_gamma_ramp(ptr long long ptr)
+@ cdecl wined3d_device_set_index_buffer(ptr ptr long)
+@ cdecl wined3d_device_set_light(ptr long ptr)
+@ cdecl wined3d_device_set_light_enable(ptr long long)
+@ cdecl wined3d_device_set_material(ptr ptr)
+@ cdecl wined3d_device_set_npatch_mode(ptr float)
+@ cdecl wined3d_device_set_palette_entries(ptr long ptr)
+@ cdecl wined3d_device_set_pixel_shader(ptr ptr)
+@ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long)
+@ cdecl wined3d_device_set_ps_consts_f(ptr long ptr long)
+@ cdecl wined3d_device_set_ps_consts_i(ptr long ptr long)
+@ cdecl wined3d_device_set_render_state(ptr long long)
+@ cdecl wined3d_device_set_render_target(ptr long ptr long)
+@ cdecl wined3d_device_set_sampler_state(ptr long long long)
+@ cdecl wined3d_device_set_scissor_rect(ptr ptr)
+@ cdecl wined3d_device_set_software_vertex_processing(ptr long)
+@ cdecl wined3d_device_set_stream_source(ptr long ptr long long)
+@ cdecl wined3d_device_set_stream_source_freq(ptr long long)
+@ cdecl wined3d_device_set_texture(ptr long ptr)
+@ cdecl wined3d_device_set_texture_stage_state(ptr long long long)
+@ cdecl wined3d_device_set_transform(ptr long ptr)
+@ cdecl wined3d_device_set_vertex_declaration(ptr ptr)
+@ cdecl wined3d_device_set_vertex_shader(ptr ptr)
+@ cdecl wined3d_device_set_viewport(ptr ptr)
+@ cdecl wined3d_device_set_vs_consts_b(ptr long ptr long)
+@ cdecl wined3d_device_set_vs_consts_f(ptr long ptr long)
+@ cdecl wined3d_device_set_vs_consts_i(ptr long ptr long)
 
 @ cdecl wined3d_palette_create(ptr long ptr ptr ptr)
 @ cdecl wined3d_palette_decref(ptr)
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 26ed5c6..79d4b3a 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2238,255 +2238,6 @@ interface IWineD3DDevice : IUnknown
     BOOL ShowCursor(
         [in] BOOL show
     );
-    HRESULT SetClipPlane(
-        [in] DWORD plane_idx,
-        [in] const float *plane
-    );
-    HRESULT GetClipPlane(
-        [in] DWORD plane_idx,
-        [out] float *plane
-    );
-    HRESULT SetClipStatus(
-        [in] const WINED3DCLIPSTATUS *clip_status
-    );
-    HRESULT GetClipStatus(
-        [out] WINED3DCLIPSTATUS *clip_status
-    );
-    HRESULT SetCurrentTexturePalette(
-        [in] UINT palette_number
-    );
-    HRESULT GetCurrentTexturePalette(
-        [out] UINT *palette_number
-    );
-    HRESULT SetDepthStencilSurface(
-        [in] struct wined3d_surface *depth_stencil
-    );
-    HRESULT GetDepthStencilSurface(
-        [out] struct wined3d_surface **depth_stencil
-    );
-    void SetGammaRamp(
-        [in] UINT swapchain_idx,
-        [in] DWORD flags,
-        [in] const WINED3DGAMMARAMP *ramp
-    );
-    void GetGammaRamp(
-        [in] UINT swapchain_idx,
-        [out] WINED3DGAMMARAMP *ramp
-    );
-    HRESULT SetIndexBuffer(
-        [in] struct wined3d_buffer *index_buffer,
-        [in] enum wined3d_format_id format_id
-    );
-    HRESULT GetIndexBuffer(
-        [out] struct wined3d_buffer **index_buffer
-    );
-    HRESULT SetBaseVertexIndex(
-        [in] INT base_index
-    );
-    HRESULT GetBaseVertexIndex(
-        [out] INT *base_index
-    );
-    HRESULT SetLight(
-        [in] DWORD light_idx,
-        [in] const WINED3DLIGHT *light
-    );
-    HRESULT GetLight(
-        [in] DWORD light_idx,
-        [out] WINED3DLIGHT *light
-    );
-    HRESULT SetLightEnable(
-        [in] DWORD light_idx,
-        [in] BOOL enable
-    );
-    HRESULT GetLightEnable(
-        [in] DWORD light_idx,
-        [out] BOOL *enable
-    );
-    HRESULT SetMaterial(
-        [in] const WINED3DMATERIAL *material
-    );
-    HRESULT GetMaterial(
-        [out] WINED3DMATERIAL *material
-    );
-    HRESULT SetNPatchMode(
-        [in] float segments
-    );
-    float GetNPatchMode(
-    );
-    HRESULT SetPaletteEntries(
-        [in] UINT palette_number,
-        [in] const PALETTEENTRY *entries
-    );
-    HRESULT GetPaletteEntries(
-        [in] UINT palette_number,
-        [out] PALETTEENTRY *entries
-    );
-    HRESULT SetPixelShader(
-        [in] struct wined3d_shader *shader
-    );
-    struct wined3d_shader *GetPixelShader(
-    );
-    HRESULT SetPixelShaderConstantB(
-        [in] UINT start_register,
-        [in] const BOOL *constants,
-        [in] UINT bool_count
-    );
-    HRESULT GetPixelShaderConstantB(
-        [in] UINT start_register,
-        [out] BOOL *constants,
-        [in] UINT bool_count
-    );
-    HRESULT SetPixelShaderConstantI(
-        [in] UINT start_register,
-        [in] const int *constants,
-        [in] UINT vector4i_count
-    );
-    HRESULT GetPixelShaderConstantI(
-        [in] UINT start_register,
-        [out] int *constants,
-        [in] UINT vector4i_count
-    );
-    HRESULT SetPixelShaderConstantF(
-        [in] UINT start_register,
-        [in] const float *constants,
-        [in] UINT vector4f_count
-    );
-    HRESULT GetPixelShaderConstantF(
-        [in] UINT start_register,
-        [out] float *constants,
-        [in] UINT vector4f_count
-    );
-    HRESULT SetRenderState(
-        [in] WINED3DRENDERSTATETYPE state,
-        [in] DWORD value
-    );
-    HRESULT GetRenderState(
-        [in] WINED3DRENDERSTATETYPE state,
-        [out] DWORD *value
-    );
-    HRESULT SetRenderTarget(
-        [in] DWORD render_target_idx,
-        [in] struct wined3d_surface *render_target,
-        [in] BOOL set_viewport
-    );
-    HRESULT GetRenderTarget(
-        [in] DWORD render_target_idx,
-        [out] struct wined3d_surface **render_target
-    );
-    HRESULT SetSamplerState(
-        [in] DWORD sampler_idx,
-        [in] WINED3DSAMPLERSTATETYPE state,
-        [in] DWORD value
-    );
-    HRESULT GetSamplerState(
-        [in] DWORD sampler_idx,
-        [in] WINED3DSAMPLERSTATETYPE state,
-        [out] DWORD *value
-    );
-    HRESULT SetScissorRect(
-        [in] const RECT *rect
-    );
-    HRESULT GetScissorRect(
-        [out] RECT *rect
-    );
-    HRESULT SetSoftwareVertexProcessing(
-        [in] BOOL software
-    );
-    BOOL GetSoftwareVertexProcessing(
-    );
-    HRESULT SetStreamSource(
-        [in] UINT stream_idx,
-        [in] struct wined3d_buffer *buffer,
-        [in] UINT offset,
-        [in] UINT stride
-    );
-    HRESULT GetStreamSource(
-        [in] UINT stream_idx,
-        [out] struct wined3d_buffer **buffer,
-        [out] UINT *offset,
-        [out] UINT *stride
-    );
-    HRESULT SetStreamSourceFreq(
-        [in] UINT stream_idx,
-        [in] UINT divider
-    );
-    HRESULT GetStreamSourceFreq(
-        [in] UINT stream_idx,
-        [out] UINT *divider
-    );
-    HRESULT SetTexture(
-        [in] DWORD stage,
-        [in] struct wined3d_texture *texture
-    );
-    HRESULT GetTexture(
-        [in] DWORD stage,
-        [out] struct wined3d_texture **texture
-    );
-    HRESULT SetTextureStageState(
-        [in] DWORD stage,
-        [in] WINED3DTEXTURESTAGESTATETYPE state,
-        [in] DWORD value
-    );
-    HRESULT GetTextureStageState(
-        [in] DWORD stage,
-        [in] WINED3DTEXTURESTAGESTATETYPE state,
-        [out] DWORD *value
-    );
-    HRESULT SetTransform(
-        [in] WINED3DTRANSFORMSTATETYPE state,
-        [in] const WINED3DMATRIX *matrix
-    );
-    HRESULT GetTransform(
-        [in] WINED3DTRANSFORMSTATETYPE state,
-        [out] WINED3DMATRIX *matrix
-    );
-    HRESULT SetVertexDeclaration(
-        [in] struct wined3d_vertex_declaration *declaration
-    );
-    HRESULT GetVertexDeclaration(
-        [out] struct wined3d_vertex_declaration **declaration
-    );
-    HRESULT SetVertexShader(
-        [in] struct wined3d_shader *shader
-    );
-    struct wined3d_shader *GetVertexShader(
-    );
-    HRESULT SetVertexShaderConstantB(
-        [in] UINT start_register,
-        [in] const BOOL *constants,
-        [in] UINT bool_count
-    );
-    HRESULT GetVertexShaderConstantB(
-        [in] UINT start_register,
-        [out] BOOL *constants,
-        [in] UINT bool_count
-    );
-    HRESULT SetVertexShaderConstantI(
-        [in] UINT start_register,
-        [in] const int *constants,
-        [in] UINT vector4i_count
-    );
-    HRESULT GetVertexShaderConstantI(
-        [in] UINT start_register,
-        [out] int *constants,
-        [in] UINT vector4i_count
-    );
-    HRESULT SetVertexShaderConstantF(
-        [in] UINT start_register,
-        [in] const float *constants,
-        [in] UINT vector4f_count
-    );
-    HRESULT GetVertexShaderConstantF(
-        [in] UINT start_register,
-        [out] float *constants,
-        [in] UINT vector4f_count
-    );
-    HRESULT SetViewport(
-        [in] const WINED3DVIEWPORT *viewport
-    );
-    HRESULT GetViewport(
-        [out] WINED3DVIEWPORT *viewport
-    );
     HRESULT MultiplyTransform(
         [in] WINED3DTRANSFORMSTATETYPE state,
         [in] const WINED3DMATRIX *matrix
@@ -2693,6 +2444,97 @@ HRESULT __cdecl wined3d_clipper_set_window(struct wined3d_clipper *clipper, DWOR
 HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
         WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags,
         IWineD3DDeviceParent *device_parent, IWineD3DDevice **device);
+INT __cdecl wined3d_device_get_base_vertex_index(IWineD3DDevice *device);
+HRESULT __cdecl wined3d_device_get_clip_plane(IWineD3DDevice *device, UINT plane_idx, float *plane);
+HRESULT __cdecl wined3d_device_get_clip_status(IWineD3DDevice *device, WINED3DCLIPSTATUS *clip_status);
+HRESULT __cdecl wined3d_device_get_current_texture_palette(IWineD3DDevice *device, UINT *palette_idx);
+HRESULT __cdecl wined3d_device_get_depth_stencil(IWineD3DDevice *device, struct wined3d_surface **depth_stencil);
+void __cdecl wined3d_device_get_gamma_ramp(IWineD3DDevice *device, UINT swapchain_idx, WINED3DGAMMARAMP *ramp);
+HRESULT __cdecl wined3d_device_get_index_buffer(IWineD3DDevice *device, struct wined3d_buffer **index_buffer);
+HRESULT __cdecl wined3d_device_get_light(IWineD3DDevice *device, UINT light_idx, WINED3DLIGHT *light);
+HRESULT __cdecl wined3d_device_get_light_enable(IWineD3DDevice *device, UINT light_idx, BOOL *enable);
+HRESULT __cdecl wined3d_device_get_material(IWineD3DDevice *device, WINED3DMATERIAL *material);
+float __cdecl wined3d_device_get_npatch_mode(IWineD3DDevice *device);
+HRESULT __cdecl wined3d_device_get_palette_entries(IWineD3DDevice *device, UINT palette_idx, PALETTEENTRY *entries);
+struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(IWineD3DDevice *device);
+HRESULT __cdecl wined3d_device_get_ps_consts_b(IWineD3DDevice *device,
+        UINT start_register, BOOL *constants, UINT bool_count);
+HRESULT __cdecl wined3d_device_get_ps_consts_f(IWineD3DDevice *device,
+        UINT start_register, float *constants, UINT vector4f_count);
+HRESULT __cdecl wined3d_device_get_ps_consts_i(IWineD3DDevice *device,
+        UINT start_register, int *constants, UINT vector4i_count);
+HRESULT __cdecl wined3d_device_get_render_state(IWineD3DDevice *device, WINED3DRENDERSTATETYPE state, DWORD *value);
+HRESULT __cdecl wined3d_device_get_render_target(IWineD3DDevice *device,
+        UINT render_target_idx, struct wined3d_surface **render_target);
+HRESULT __cdecl wined3d_device_get_sampler_state(IWineD3DDevice *device,
+        UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD *value);
+HRESULT __cdecl wined3d_device_get_scissor_rect(IWineD3DDevice *device, RECT *rect);
+BOOL __cdecl wined3d_device_get_software_vertex_processing(IWineD3DDevice *device);
+HRESULT __cdecl wined3d_device_get_stream_source(IWineD3DDevice *device,
+        UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride);
+HRESULT __cdecl wined3d_device_get_stream_source_freq(IWineD3DDevice *device, UINT stream_idx, UINT *divider);
+HRESULT __cdecl wined3d_device_get_texture(IWineD3DDevice *device, UINT stage, struct wined3d_texture **texture);
+HRESULT __cdecl wined3d_device_get_texture_stage_state(IWineD3DDevice *device,
+        UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD *value);
+HRESULT __cdecl wined3d_device_get_transform(IWineD3DDevice *device,
+        WINED3DTRANSFORMSTATETYPE state, WINED3DMATRIX *matrix);
+HRESULT __cdecl wined3d_device_get_vertex_declaration(IWineD3DDevice *device,
+        struct wined3d_vertex_declaration **declaration);
+struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(IWineD3DDevice *device);
+HRESULT __cdecl wined3d_device_get_viewport(IWineD3DDevice *device, WINED3DVIEWPORT *viewport);
+HRESULT __cdecl wined3d_device_get_vs_consts_b(IWineD3DDevice *device,
+        UINT start_register, BOOL *constants, UINT bool_count);
+HRESULT __cdecl wined3d_device_get_vs_consts_f(IWineD3DDevice *device,
+        UINT start_register, float *constants, UINT vector4f_count);
+HRESULT __cdecl wined3d_device_get_vs_consts_i(IWineD3DDevice *device,
+        UINT start_register, int *constants, UINT vector4i_count);
+HRESULT __cdecl wined3d_device_set_base_vertex_index(IWineD3DDevice *device, INT base_index);
+HRESULT __cdecl wined3d_device_set_clip_plane(IWineD3DDevice *device, UINT plane_idx, const float *plane);
+HRESULT __cdecl wined3d_device_set_clip_status(IWineD3DDevice *device, const WINED3DCLIPSTATUS *clip_status);
+HRESULT __cdecl wined3d_device_set_current_texture_palette(IWineD3DDevice *device, UINT palette_idx);
+HRESULT __cdecl wined3d_device_set_depth_stencil(IWineD3DDevice *device, struct wined3d_surface *depth_stencil);
+void __cdecl wined3d_device_set_gamma_ramp(IWineD3DDevice *device,
+        UINT swapchain_idx, DWORD flags, const WINED3DGAMMARAMP *ramp);
+HRESULT __cdecl wined3d_device_set_index_buffer(IWineD3DDevice *device,
+        struct wined3d_buffer *index_buffer, enum wined3d_format_id format_id);
+HRESULT __cdecl wined3d_device_set_light(IWineD3DDevice *device, UINT light_idx, const WINED3DLIGHT *light);
+HRESULT __cdecl wined3d_device_set_light_enable(IWineD3DDevice *device, UINT light_idx, BOOL enable);
+HRESULT __cdecl wined3d_device_set_material(IWineD3DDevice *device, const WINED3DMATERIAL *material);
+HRESULT __cdecl wined3d_device_set_npatch_mode(IWineD3DDevice *device, float segments);
+HRESULT __cdecl wined3d_device_set_palette_entries(IWineD3DDevice *device,
+        UINT palette_idx, const PALETTEENTRY *entries);
+HRESULT __cdecl wined3d_device_set_pixel_shader(IWineD3DDevice *device, struct wined3d_shader *shader);
+HRESULT __cdecl wined3d_device_set_ps_consts_b(IWineD3DDevice *device,
+        UINT start_register, const BOOL *constants, UINT bool_count);
+HRESULT __cdecl wined3d_device_set_ps_consts_f(IWineD3DDevice *device,
+        UINT start_register, const float *constants, UINT vector4f_count);
+HRESULT __cdecl wined3d_device_set_ps_consts_i(IWineD3DDevice *device,
+        UINT start_register, const int *constants, UINT vector4i_count);
+HRESULT __cdecl wined3d_device_set_render_state(IWineD3DDevice *device, WINED3DRENDERSTATETYPE state, DWORD value);
+HRESULT __cdecl wined3d_device_set_render_target(IWineD3DDevice *device,
+        UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport);
+HRESULT __cdecl wined3d_device_set_sampler_state(IWineD3DDevice *device,
+        UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD value);
+HRESULT __cdecl wined3d_device_set_scissor_rect(IWineD3DDevice *device, const RECT *rect);
+HRESULT __cdecl wined3d_device_set_software_vertex_processing(IWineD3DDevice *device, BOOL software);
+HRESULT __cdecl wined3d_device_set_stream_source(IWineD3DDevice *device,
+        UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride);
+HRESULT __cdecl wined3d_device_set_stream_source_freq(IWineD3DDevice *device, UINT stream_idx, UINT divider);
+HRESULT __cdecl wined3d_device_set_texture(IWineD3DDevice *device, UINT stage, struct wined3d_texture *texture);
+HRESULT __cdecl wined3d_device_set_texture_stage_state(IWineD3DDevice *device,
+        UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD value);
+HRESULT __cdecl wined3d_device_set_transform(IWineD3DDevice *device,
+        WINED3DTRANSFORMSTATETYPE state, const WINED3DMATRIX *matrix);
+HRESULT __cdecl wined3d_device_set_vertex_declaration(IWineD3DDevice *device,
+        struct wined3d_vertex_declaration *declaration);
+HRESULT __cdecl wined3d_device_set_vertex_shader(IWineD3DDevice *device, struct wined3d_shader *shader);
+HRESULT __cdecl wined3d_device_set_viewport(IWineD3DDevice *device, const WINED3DVIEWPORT *viewport);
+HRESULT __cdecl wined3d_device_set_vs_consts_b(IWineD3DDevice *device,
+        UINT start_register, const BOOL *constants, UINT bool_count);
+HRESULT __cdecl wined3d_device_set_vs_consts_f(IWineD3DDevice *device,
+        UINT start_register, const float *constants, UINT vector4f_count);
+HRESULT __cdecl wined3d_device_set_vs_consts_i(IWineD3DDevice *device,
+        UINT start_register, const int *constants, UINT vector4i_count);
 
 HRESULT __cdecl wined3d_palette_create(IWineD3DDevice *device, DWORD flags,
         const PALETTEENTRY *entries, void *parent, struct wined3d_palette **palette);
-- 
1.7.3.4




More information about the wine-patches mailing list