[PATCH 4/5] d3d8: Get rid of IDirect3DDevice8Impl.
Henri Verbeet
hverbeet at codeweavers.com
Mon May 21 13:48:36 CDT 2012
---
dlls/d3d8/buffer.c | 4 +-
dlls/d3d8/d3d8_private.h | 29 +-
dlls/d3d8/device.c | 1655 ++++++++++++++++++++---------------------
dlls/d3d8/directx.c | 2 +-
dlls/d3d8/shader.c | 6 +-
dlls/d3d8/surface.c | 2 +-
dlls/d3d8/swapchain.c | 2 +-
dlls/d3d8/texture.c | 6 +-
dlls/d3d8/vertexdeclaration.c | 4 +-
dlls/d3d8/volume.c | 2 +-
10 files changed, 835 insertions(+), 877 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c
index 9ff787d..d1cffa6 100644
--- a/dlls/d3d8/buffer.c
+++ b/dlls/d3d8/buffer.c
@@ -282,7 +282,7 @@ static const struct wined3d_parent_ops d3d8_vertexbuffer_wined3d_parent_ops =
d3d8_vertexbuffer_wined3d_object_destroyed,
};
-HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
+HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, struct d3d8_device *device,
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool)
{
HRESULT hr;
@@ -576,7 +576,7 @@ static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops =
d3d8_indexbuffer_wined3d_object_destroyed,
};
-HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
+HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, struct d3d8_device *device,
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{
HRESULT hr;
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 32703f0..1ebdfa5 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -100,7 +100,6 @@
void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN;
-typedef struct IDirect3DDevice8Impl IDirect3DDevice8Impl;
typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl;
typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
@@ -151,7 +150,7 @@ struct FvfToDecl
struct d3d8_vertex_declaration *declaration;
};
-struct IDirect3DDevice8Impl
+struct d3d8_device
{
/* IUnknown fields */
IDirect3DDevice8 IDirect3DDevice8_iface;
@@ -170,7 +169,7 @@ struct IDirect3DDevice8Impl
BOOL lost;
};
-HRESULT device_init(IDirect3DDevice8Impl *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter,
+HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter,
D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN;
/* ---------------- */
@@ -189,7 +188,7 @@ struct IDirect3DVolume8Impl
IUnknown *forwardReference;
};
-HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, UINT width, UINT height,
+HRESULT volume_init(IDirect3DVolume8Impl *volume, struct d3d8_device *device, UINT width, UINT height,
UINT depth, DWORD usage, enum wined3d_format_id format, enum wined3d_pool pool) DECLSPEC_HIDDEN;
/* ------------------- */
@@ -208,7 +207,7 @@ struct IDirect3DSwapChain8Impl
IDirect3DDevice8 *parentDevice;
};
-HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl *device,
+HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, struct d3d8_device *device,
D3DPRESENT_PARAMETERS *present_parameters) DECLSPEC_HIDDEN;
/* ----------------- */
@@ -232,7 +231,7 @@ struct IDirect3DSurface8Impl
IUnknown *forwardReference;
};
-HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *device,
+HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device,
UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
@@ -253,7 +252,7 @@ struct IDirect3DVertexBuffer8Impl
DWORD fvf;
};
-HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
+HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, struct d3d8_device *device,
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN;
@@ -273,7 +272,7 @@ struct IDirect3DIndexBuffer8Impl
enum wined3d_format_id format;
};
-HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
+HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, struct d3d8_device *device,
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DIndexBuffer8Impl *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) DECLSPEC_HIDDEN;
@@ -285,11 +284,11 @@ struct d3d8_texture
IDirect3DDevice8 *parent_device;
};
-HRESULT cubetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
+HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *device,
UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
-HRESULT texture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
+HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
-HRESULT volumetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
+HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *device,
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
struct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface) DECLSPEC_HIDDEN;
@@ -303,9 +302,9 @@ struct d3d8_vertex_declaration
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration) DECLSPEC_HIDDEN;
HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration,
- IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle) DECLSPEC_HIDDEN;
+ struct d3d8_device *device, const DWORD *elements, DWORD shader_handle) DECLSPEC_HIDDEN;
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration,
- IDirect3DDevice8Impl *device, DWORD fvf) DECLSPEC_HIDDEN;
+ struct d3d8_device *device, DWORD fvf) DECLSPEC_HIDDEN;
struct d3d8_vertex_shader
{
@@ -314,7 +313,7 @@ struct d3d8_vertex_shader
};
void d3d8_vertex_shader_destroy(struct d3d8_vertex_shader *shader) DECLSPEC_HIDDEN;
-HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, IDirect3DDevice8Impl *device,
+HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_device *device,
const DWORD *declaration, const DWORD *byte_code, DWORD shader_handle, DWORD usage) DECLSPEC_HIDDEN;
#define D3D8_MAX_VERTEX_SHADER_CONSTANTF 256
@@ -326,7 +325,7 @@ struct d3d8_pixel_shader
};
void d3d8_pixel_shader_destroy(struct d3d8_pixel_shader *shader) DECLSPEC_HIDDEN;
-HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, IDirect3DDevice8Impl *device,
+HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_device *device,
const DWORD *byte_code, DWORD shader_handle) DECLSPEC_HIDDEN;
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 0219cf9..2bde4df 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -254,72 +254,74 @@ static void *d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d
return entry->object;
}
-static inline IDirect3DDevice8Impl *impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
+static inline struct d3d8_device *impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
{
- return CONTAINING_RECORD(iface, IDirect3DDevice8Impl, IDirect3DDevice8_iface);
+ return CONTAINING_RECORD(iface, struct d3d8_device, IDirect3DDevice8_iface);
}
-static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(IDirect3DDevice8 *iface, REFIID riid,
- void **ppobj)
+static HRESULT WINAPI d3d8_device_QueryInterface(IDirect3DDevice8 *iface, REFIID riid, void **out)
{
- TRACE("iface %p, riid %s, object %p.\n",
- iface, debugstr_guid(riid), ppobj);
+ TRACE("iface %p, riid %s, out %p.\n",
+ iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DDevice8)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
- *ppobj = iface;
+ *out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
- *ppobj = NULL;
+ *out = NULL;
return E_NOINTERFACE;
}
-static ULONG WINAPI IDirect3DDevice8Impl_AddRef(IDirect3DDevice8 *iface)
+static ULONG WINAPI d3d8_device_AddRef(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- ULONG ref = InterlockedIncrement(&This->ref);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ ULONG ref = InterlockedIncrement(&device->ref);
TRACE("%p increasing refcount to %u.\n", iface, ref);
return ref;
}
-static ULONG WINAPI IDirect3DDevice8Impl_Release(IDirect3DDevice8 *iface)
+static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
ULONG ref;
- if (This->inDestruction) return 0;
- ref = InterlockedDecrement(&This->ref);
+ if (device->inDestruction)
+ return 0;
+
+ ref = InterlockedDecrement(&device->ref);
TRACE("%p decreasing refcount to %u.\n", iface, ref);
- if (ref == 0) {
+ if (!ref)
+ {
+ IDirect3D8 *parent = device->d3d_parent;
unsigned i;
- IDirect3D8 *parent = This->d3d_parent;
- TRACE("Releasing wined3d device %p.\n", This->wined3d_device);
+ TRACE("Releasing wined3d device %p.\n", device->wined3d_device);
wined3d_mutex_lock();
- This->inDestruction = TRUE;
+ device->inDestruction = TRUE;
- for (i = 0; i < This->numConvertedDecls; ++i)
+ for (i = 0; i < device->numConvertedDecls; ++i)
{
- d3d8_vertex_declaration_destroy(This->decls[i].declaration);
+ d3d8_vertex_declaration_destroy(device->decls[i].declaration);
}
- HeapFree(GetProcessHeap(), 0, This->decls);
+ HeapFree(GetProcessHeap(), 0, device->decls);
- wined3d_device_uninit_3d(This->wined3d_device);
- wined3d_device_release_focus_window(This->wined3d_device);
- wined3d_device_decref(This->wined3d_device);
- HeapFree(GetProcessHeap(), 0, This->handle_table.entries);
- HeapFree(GetProcessHeap(), 0, This);
+ wined3d_device_uninit_3d(device->wined3d_device);
+ wined3d_device_release_focus_window(device->wined3d_device);
+ wined3d_device_decref(device->wined3d_device);
+ HeapFree(GetProcessHeap(), 0, device->handle_table.entries);
+ HeapFree(GetProcessHeap(), 0, device);
wined3d_mutex_unlock();
@@ -328,10 +330,9 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(IDirect3DDevice8 *iface)
return ref;
}
-/* IDirect3DDevice Interface follow: */
-static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(IDirect3DDevice8 *iface)
+static HRESULT WINAPI d3d8_device_TestCooperativeLevel(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
TRACE("iface %p.\n", iface);
@@ -344,163 +345,159 @@ static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(IDirect3DDevice8
return D3D_OK;
}
-static UINT WINAPI IDirect3DDevice8Impl_GetAvailableTextureMem(IDirect3DDevice8 *iface)
+static UINT WINAPI d3d8_device_GetAvailableTextureMem(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
- hr = wined3d_device_get_available_texture_mem(This->wined3d_device);
+ hr = wined3d_device_get_available_texture_mem(device->wined3d_device);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(IDirect3DDevice8 *iface,
- DWORD Bytes)
+static HRESULT WINAPI d3d8_device_ResourceManagerDiscardBytes(IDirect3DDevice8 *iface, DWORD byte_count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+
+ TRACE("iface %p, byte_count %u.\n", iface, byte_count);
- TRACE("iface %p, byte_count %u.\n", iface, Bytes);
- if (Bytes) FIXME("Byte count ignored.\n");
+ if (byte_count)
+ FIXME("Byte count ignored.\n");
wined3d_mutex_lock();
- wined3d_device_evict_managed_resources(This->wined3d_device);
+ wined3d_device_evict_managed_resources(device->wined3d_device);
wined3d_mutex_unlock();
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **ppD3D8)
+static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **d3d8)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
- TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8);
+ TRACE("iface %p, d3d8 %p.\n", iface, d3d8);
- if (NULL == ppD3D8) {
+ if (!d3d8)
return D3DERR_INVALIDCALL;
- }
- return IDirect3D8_QueryInterface(This->d3d_parent, &IID_IDirect3D8, (void **)ppD3D8);
+ return IDirect3D8_QueryInterface(device->d3d_parent, &IID_IDirect3D8, (void **)d3d8);
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *pCaps)
+static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- HRESULT hrc = D3D_OK;
- WINED3DCAPS *pWineCaps;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ WINED3DCAPS *wined3d_caps;
+ HRESULT hr;
- TRACE("iface %p, caps %p.\n", iface, pCaps);
+ TRACE("iface %p, caps %p.\n", iface, caps);
- if(NULL == pCaps){
+ if (!caps)
return D3DERR_INVALIDCALL;
- }
- pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS));
- if(pWineCaps == NULL){
+
+ if (!(wined3d_caps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wined3d_caps))))
return D3DERR_INVALIDCALL; /* well this is what MSDN says to return */
- }
wined3d_mutex_lock();
- hrc = wined3d_device_get_device_caps(This->wined3d_device, pWineCaps);
+ hr = wined3d_device_get_device_caps(device->wined3d_device, wined3d_caps);
wined3d_mutex_unlock();
- fixup_caps(pWineCaps);
- WINECAPSTOD3D8CAPS(pCaps, pWineCaps)
- HeapFree(GetProcessHeap(), 0, pWineCaps);
+ fixup_caps(wined3d_caps);
+ WINECAPSTOD3D8CAPS(caps, wined3d_caps)
+ HeapFree(GetProcessHeap(), 0, wined3d_caps);
- TRACE("Returning %p %p\n", This, pCaps);
- return hrc;
+ return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetDisplayMode(IDirect3DDevice8 *iface,
- D3DDISPLAYMODE *pMode)
+static HRESULT WINAPI d3d8_device_GetDisplayMode(IDirect3DDevice8 *iface, D3DDISPLAYMODE *mode)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, mode %p.\n", iface, pMode);
+ TRACE("iface %p, mode %p.\n", iface, mode);
wined3d_mutex_lock();
- hr = wined3d_device_get_display_mode(This->wined3d_device, 0, (struct wined3d_display_mode *)pMode);
+ hr = wined3d_device_get_display_mode(device->wined3d_device, 0, (struct wined3d_display_mode *)mode);
wined3d_mutex_unlock();
- if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
+ if (SUCCEEDED(hr))
+ mode->Format = d3dformat_from_wined3dformat(mode->Format);
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetCreationParameters(IDirect3DDevice8 *iface,
- D3DDEVICE_CREATION_PARAMETERS *pParameters)
+static HRESULT WINAPI d3d8_device_GetCreationParameters(IDirect3DDevice8 *iface,
+ D3DDEVICE_CREATION_PARAMETERS *parameters)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, parameters %p.\n", iface, pParameters);
+ TRACE("iface %p, parameters %p.\n", iface, parameters);
wined3d_mutex_lock();
- hr = wined3d_device_get_creation_parameters(This->wined3d_device,
- (struct wined3d_device_creation_parameters *)pParameters);
+ hr = wined3d_device_get_creation_parameters(device->wined3d_device,
+ (struct wined3d_device_creation_parameters *)parameters);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(IDirect3DDevice8 *iface,
- UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8 *pCursorBitmap)
+static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface,
+ UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- IDirect3DSurface8Impl *pSurface = unsafe_impl_from_IDirect3DSurface8(pCursorBitmap);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ IDirect3DSurface8Impl *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap);
HRESULT hr;
TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
- iface, XHotSpot, YHotSpot, pCursorBitmap);
+ iface, hotspot_x, hotspot_y, bitmap);
- if (!pCursorBitmap)
+ if (!bitmap)
{
WARN("No cursor bitmap, returning D3DERR_INVALIDCALL.\n");
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
- hr = wined3d_device_set_cursor_properties(This->wined3d_device, XHotSpot, YHotSpot, pSurface->wined3d_surface);
+ hr = wined3d_device_set_cursor_properties(device->wined3d_device,
+ hotspot_x, hotspot_y, bitmap_impl->wined3d_surface);
wined3d_mutex_unlock();
return hr;
}
-static void WINAPI IDirect3DDevice8Impl_SetCursorPosition(IDirect3DDevice8 *iface,
- UINT XScreenSpace, UINT YScreenSpace, DWORD Flags)
+static void WINAPI d3d8_device_SetCursorPosition(IDirect3DDevice8 *iface, UINT x, UINT y, DWORD flags)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
- TRACE("iface %p, x %u, y %u, flags %#x.\n",
- iface, XScreenSpace, YScreenSpace, Flags);
+ TRACE("iface %p, x %u, y %u, flags %#x.\n", iface, x, y, flags);
wined3d_mutex_lock();
- wined3d_device_set_cursor_position(This->wined3d_device, XScreenSpace, YScreenSpace, Flags);
+ wined3d_device_set_cursor_position(device->wined3d_device, x, y, flags);
wined3d_mutex_unlock();
}
-static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(IDirect3DDevice8 *iface, BOOL bShow)
+static BOOL WINAPI d3d8_device_ShowCursor(IDirect3DDevice8 *iface, BOOL show)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
BOOL ret;
- TRACE("iface %p, show %#x.\n", iface, bShow);
+ TRACE("iface %p, show %#x.\n", iface, show);
wined3d_mutex_lock();
- ret = wined3d_device_show_cursor(This->wined3d_device, bShow);
+ ret = wined3d_device_show_cursor(device->wined3d_device, show);
wined3d_mutex_unlock();
return ret;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *iface,
D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain8 **swapchain)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DSwapChain8Impl *object;
HRESULT hr;
@@ -514,7 +511,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(IDirect3DDe
return E_OUTOFMEMORY;
}
- hr = swapchain_init(object, This, present_parameters);
+ hr = swapchain_init(object, device, present_parameters);
if (FAILED(hr))
{
WARN("Failed to initialize swapchain, hr %#x.\n", hr);
@@ -556,83 +553,82 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface,
- D3DPRESENT_PARAMETERS *pPresentationParameters)
+static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
+ D3DPRESENT_PARAMETERS *present_parameters)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_swapchain_desc swapchain_desc;
HRESULT hr;
- TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters);
+ TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
wined3d_mutex_lock();
- swapchain_desc.backbuffer_width = pPresentationParameters->BackBufferWidth;
- swapchain_desc.backbuffer_height = pPresentationParameters->BackBufferHeight;
- swapchain_desc.backbuffer_format = wined3dformat_from_d3dformat(pPresentationParameters->BackBufferFormat);
- swapchain_desc.backbuffer_count = pPresentationParameters->BackBufferCount;
- swapchain_desc.multisample_type = pPresentationParameters->MultiSampleType;
+ swapchain_desc.backbuffer_width = present_parameters->BackBufferWidth;
+ swapchain_desc.backbuffer_height = present_parameters->BackBufferHeight;
+ swapchain_desc.backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
+ swapchain_desc.backbuffer_count = present_parameters->BackBufferCount;
+ swapchain_desc.multisample_type = present_parameters->MultiSampleType;
swapchain_desc.multisample_quality = 0; /* d3d9 only */
- swapchain_desc.swap_effect = pPresentationParameters->SwapEffect;
- swapchain_desc.device_window = pPresentationParameters->hDeviceWindow;
- swapchain_desc.windowed = pPresentationParameters->Windowed;
- swapchain_desc.enable_auto_depth_stencil = pPresentationParameters->EnableAutoDepthStencil;
- swapchain_desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);
- swapchain_desc.flags = pPresentationParameters->Flags;
- swapchain_desc.refresh_rate = pPresentationParameters->FullScreen_RefreshRateInHz;
- swapchain_desc.swap_interval = pPresentationParameters->FullScreen_PresentationInterval;
+ swapchain_desc.swap_effect = present_parameters->SwapEffect;
+ swapchain_desc.device_window = present_parameters->hDeviceWindow;
+ swapchain_desc.windowed = present_parameters->Windowed;
+ swapchain_desc.enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
+ swapchain_desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
+ swapchain_desc.flags = present_parameters->Flags;
+ swapchain_desc.refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
+ swapchain_desc.swap_interval = present_parameters->FullScreen_PresentationInterval;
swapchain_desc.auto_restore_display_mode = TRUE;
- hr = wined3d_device_reset(This->wined3d_device, &swapchain_desc, reset_enum_callback);
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, reset_enum_callback)))
{
- hr = wined3d_device_set_render_state(This->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
- This->lost = FALSE;
+ hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
+ device->lost = FALSE;
}
else
{
- This->lost = TRUE;
+ device->lost = TRUE;
}
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_Present(IDirect3DDevice8 *iface, const RECT *pSourceRect,
- const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion)
+static HRESULT WINAPI d3d8_device_Present(IDirect3DDevice8 *iface, const RECT *src_rect,
+ const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p.\n",
- iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
+ TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n",
+ iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region);
wined3d_mutex_lock();
- hr = wined3d_device_present(This->wined3d_device, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
+ hr = wined3d_device_present(device->wined3d_device, src_rect, dst_rect, dst_window_override, dirty_region);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(IDirect3DDevice8 *iface,
- UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer)
+static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface,
+ UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface8 **backbuffer)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_surface *wined3d_surface = NULL;
IDirect3DSurface8Impl *surface_impl;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
- iface, BackBuffer, Type, ppBackBuffer);
+ iface, backbuffer_idx, backbuffer_type, backbuffer);
wined3d_mutex_lock();
- hr = wined3d_device_get_back_buffer(This->wined3d_device, 0,
- BackBuffer, (enum wined3d_backbuffer_type)Type, &wined3d_surface);
- if (SUCCEEDED(hr) && wined3d_surface && ppBackBuffer)
+ hr = wined3d_device_get_back_buffer(device->wined3d_device, 0, backbuffer_idx,
+ (enum wined3d_backbuffer_type)backbuffer_type, &wined3d_surface);
+ if (SUCCEEDED(hr) && wined3d_surface && backbuffer)
{
surface_impl = wined3d_surface_get_parent(wined3d_surface);
- *ppBackBuffer = &surface_impl->IDirect3DSurface8_iface;
- IDirect3DSurface8_AddRef(*ppBackBuffer);
+ *backbuffer = &surface_impl->IDirect3DSurface8_iface;
+ IDirect3DSurface8_AddRef(*backbuffer);
wined3d_surface_decref(wined3d_surface);
}
wined3d_mutex_unlock();
@@ -640,51 +636,49 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(IDirect3DDevice8 *iface
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(IDirect3DDevice8 *iface,
- D3DRASTER_STATUS *pRasterStatus)
+static HRESULT WINAPI d3d8_device_GetRasterStatus(IDirect3DDevice8 *iface, D3DRASTER_STATUS *raster_status)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus);
+ TRACE("iface %p, raster_status %p.\n", iface, raster_status);
wined3d_mutex_lock();
- hr = wined3d_device_get_raster_status(This->wined3d_device, 0, (struct wined3d_raster_status *)pRasterStatus);
+ hr = wined3d_device_get_raster_status(device->wined3d_device, 0, (struct wined3d_raster_status *)raster_status);
wined3d_mutex_unlock();
return hr;
}
-static void WINAPI IDirect3DDevice8Impl_SetGammaRamp(IDirect3DDevice8 *iface, DWORD Flags,
- const D3DGAMMARAMP *pRamp)
+static void WINAPI d3d8_device_SetGammaRamp(IDirect3DDevice8 *iface, DWORD flags, const D3DGAMMARAMP *ramp)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
- TRACE("iface %p, flags %#x, ramp %p.\n", iface, Flags, pRamp);
+ TRACE("iface %p, flags %#x, ramp %p.\n", iface, flags, ramp);
/* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
wined3d_mutex_lock();
- wined3d_device_set_gamma_ramp(This->wined3d_device, 0, Flags, (const struct wined3d_gamma_ramp *)pRamp);
+ wined3d_device_set_gamma_ramp(device->wined3d_device, 0, flags, (const struct wined3d_gamma_ramp *)ramp);
wined3d_mutex_unlock();
}
-static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(IDirect3DDevice8 *iface, D3DGAMMARAMP *pRamp)
+static void WINAPI d3d8_device_GetGammaRamp(IDirect3DDevice8 *iface, D3DGAMMARAMP *ramp)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
- TRACE("iface %p, ramp %p.\n", iface, pRamp);
+ TRACE("iface %p, ramp %p.\n", iface, ramp);
/* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
wined3d_mutex_lock();
- wined3d_device_get_gamma_ramp(This->wined3d_device, 0, (struct wined3d_gamma_ramp *)pRamp);
+ wined3d_device_get_gamma_ramp(device->wined3d_device, 0, (struct wined3d_gamma_ramp *)ramp);
wined3d_mutex_unlock();
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format,
D3DPOOL pool, IDirect3DTexture8 **texture)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *object;
HRESULT hr;
@@ -698,7 +692,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface
return D3DERR_OUTOFVIDEOMEMORY;
}
- hr = texture_init(object, This, width, height, levels, usage, format, pool);
+ hr = texture_init(object, device, width, height, levels, usage, format, pool);
if (FAILED(hr))
{
WARN("Failed to initialize texture, hr %#x.\n", hr);
@@ -712,11 +706,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_CreateVolumeTexture(IDirect3DDevice8 *iface,
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format,
D3DPOOL pool, IDirect3DVolumeTexture8 **texture)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *object;
HRESULT hr;
@@ -730,7 +724,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8
return D3DERR_OUTOFVIDEOMEMORY;
}
- hr = volumetexture_init(object, This, width, height, depth, levels, usage, format, pool);
+ hr = volumetexture_init(object, device, width, height, depth, levels, usage, format, pool);
if (FAILED(hr))
{
WARN("Failed to initialize volume texture, hr %#x.\n", hr);
@@ -744,10 +738,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(IDirect3DDevice8 *iface, UINT edge_length,
+static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UINT edge_length,
UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DCubeTexture8 **texture)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *object;
HRESULT hr;
@@ -761,7 +755,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(IDirect3DDevice8 *i
return D3DERR_OUTOFVIDEOMEMORY;
}
- hr = cubetexture_init(object, This, edge_length, levels, usage, format, pool);
+ hr = cubetexture_init(object, device, edge_length, levels, usage, format, pool);
if (FAILED(hr))
{
WARN("Failed to initialize cube texture, hr %#x.\n", hr);
@@ -775,10 +769,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(IDirect3DDevice8 *i
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(IDirect3DDevice8 *iface, UINT size,
+static HRESULT WINAPI d3d8_device_CreateVertexBuffer(IDirect3DDevice8 *iface, UINT size,
DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DVertexBuffer8Impl *object;
HRESULT hr;
@@ -792,7 +786,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(IDirect3DDevice8 *
return D3DERR_OUTOFVIDEOMEMORY;
}
- hr = vertexbuffer_init(object, This, size, usage, fvf, pool);
+ hr = vertexbuffer_init(object, device, size, usage, fvf, pool);
if (FAILED(hr))
{
WARN("Failed to initialize vertex buffer, hr %#x.\n", hr);
@@ -806,10 +800,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(IDirect3DDevice8 *
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *iface, UINT size,
+static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UINT size,
DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DIndexBuffer8Impl *object;
HRESULT hr;
@@ -823,7 +817,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *i
return D3DERR_OUTOFVIDEOMEMORY;
}
- hr = indexbuffer_init(object, This, size, usage, format, pool);
+ hr = indexbuffer_init(object, device, size, usage, format, pool);
if (FAILED(hr))
{
WARN("Failed to initialize index buffer, hr %#x.\n", hr);
@@ -837,18 +831,18 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *i
return D3D_OK;
}
-static HRESULT IDirect3DDevice8Impl_CreateSurface(IDirect3DDevice8Impl *device, UINT Width,
- UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level,
- IDirect3DSurface8 **ppSurface, UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample,
- DWORD MultisampleQuality)
+static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width,
+ UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
+ IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type,
+ DWORD multisample_quality)
{
IDirect3DSurface8Impl *object;
HRESULT hr;
TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n"
"\tusage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n",
- device, Width, Height, Format, Lockable, Discard, Level, ppSurface,
- Usage, Pool, MultiSample, MultisampleQuality);
+ device, width, height, format, lockable, discard, level, surface,
+ usage, pool, multisample_type, multisample_quality);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl));
if (!object)
@@ -857,8 +851,8 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(IDirect3DDevice8Impl *device,
return D3DERR_OUTOFVIDEOMEMORY;
}
- hr = surface_init(object, device, Width, Height, Format, Lockable, Discard, Level, Usage,
- Pool, MultiSample, MultisampleQuality);
+ hr = surface_init(object, device, width, height, format, lockable, discard, level, usage,
+ pool, multisample_type, multisample_quality);
if (FAILED(hr))
{
WARN("Failed to initialize surface, hr %#x.\n", hr);
@@ -867,118 +861,115 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(IDirect3DDevice8Impl *device,
}
TRACE("Created surface %p.\n", object);
- *ppSurface = &object->IDirect3DSurface8_iface;
+ *surface = &object->IDirect3DSurface8_iface;
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateRenderTarget(IDirect3DDevice8 *iface, UINT Width,
- UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable,
- IDirect3DSurface8 **ppSurface)
+static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UINT width,
+ UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, BOOL lockable,
+ IDirect3DSurface8 **surface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n",
- iface, Width, Height, Format, MultiSample, Lockable, ppSurface);
+ iface, width, height, format, multisample_type, lockable, surface);
- hr = IDirect3DDevice8Impl_CreateSurface(This, Width, Height, Format, Lockable,
- FALSE /* Discard */, 0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT,
- MultiSample, 0);
+ hr = d3d8_device_CreateSurface(device, width, height, format, lockable,
+ FALSE, 0, surface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT,
+ multisample_type, 0);
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(IDirect3DDevice8 *iface,
- UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
- IDirect3DSurface8 **ppSurface)
+static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *iface,
+ UINT width, UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type,
+ IDirect3DSurface8 **surface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n",
- iface, Width, Height, Format, MultiSample, ppSurface);
+ iface, width, height, format, multisample_type, surface);
/* TODO: Verify that Discard is false */
- hr = IDirect3DDevice8Impl_CreateSurface(This, Width, Height, Format, TRUE /* Lockable */, FALSE,
- 0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, 0);
+ hr = d3d8_device_CreateSurface(device, width, height, format, TRUE, FALSE,
+ 0, surface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, multisample_type, 0);
return hr;
}
/* IDirect3DDevice8Impl::CreateImageSurface returns surface with pool type SYSTEMMEM */
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(IDirect3DDevice8 *iface, UINT Width,
- UINT Height, D3DFORMAT Format, IDirect3DSurface8 **ppSurface)
+static HRESULT WINAPI d3d8_device_CreateImageSurface(IDirect3DDevice8 *iface, UINT width,
+ UINT height, D3DFORMAT format, IDirect3DSurface8 **surface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n",
- iface, Width, Height, Format, ppSurface);
+ iface, width, height, format, surface);
- hr = IDirect3DDevice8Impl_CreateSurface(This, Width, Height, Format, TRUE /* Lockable */,
- FALSE /* Discard */, 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */,
- D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
+ hr = d3d8_device_CreateSurface(device, width, height, format, TRUE, FALSE,
+ 0, surface, 0, D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0);
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface,
- IDirect3DSurface8 *pSourceSurface, const RECT *pSourceRects, UINT cRects,
- IDirect3DSurface8 *pDestinationSurface, const POINT *pDestPoints)
+static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
+ IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count,
+ IDirect3DSurface8 *dst_surface, const POINT *dst_points)
{
- IDirect3DSurface8Impl *Source = unsafe_impl_from_IDirect3DSurface8(pSourceSurface);
- IDirect3DSurface8Impl *Dest = unsafe_impl_from_IDirect3DSurface8(pDestinationSurface);
- enum wined3d_format_id srcFormat, destFormat;
+ IDirect3DSurface8Impl *src = unsafe_impl_from_IDirect3DSurface8(src_surface);
+ IDirect3DSurface8Impl *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface);
+ enum wined3d_format_id src_format, dst_format;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
UINT src_w, src_h;
HRESULT hr;
TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n",
- iface, pSourceSurface, pSourceRects, cRects, pDestinationSurface, pDestPoints);
+ iface, src_surface, src_rects, rect_count, dst_surface, dst_points);
/* Check that the source texture is in WINED3D_POOL_SYSTEM_MEM and the
* destination texture is in WINED3D_POOL_DEFAULT. */
wined3d_mutex_lock();
- wined3d_resource = wined3d_surface_get_resource(Source->wined3d_surface);
+ wined3d_resource = wined3d_surface_get_resource(src->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
if (wined3d_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
- WARN("Source %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n",
- pSourceSurface);
+ WARN("Source %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", src_surface);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- srcFormat = wined3d_desc.format;
+ src_format = wined3d_desc.format;
src_w = wined3d_desc.width;
src_h = wined3d_desc.height;
- wined3d_resource = wined3d_surface_get_resource(Dest->wined3d_surface);
+ wined3d_resource = wined3d_surface_get_resource(dst->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
if (wined3d_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
- WARN("Dest %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n",
- pDestinationSurface);
+ WARN("Destination %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", dst_surface);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- destFormat = wined3d_desc.format;
+ dst_format = wined3d_desc.format;
/* Check that the source and destination formats match */
- if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat)
+ if (src_format != dst_format && WINED3DFMT_UNKNOWN != dst_format)
{
- WARN("Source %p format must match the dest %p format, returning D3DERR_INVALIDCALL.\n",
- pSourceSurface, pDestinationSurface);
+ WARN("Source %p format must match the destination %p format, returning D3DERR_INVALIDCALL.\n",
+ src_surface, dst_surface);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- else if (WINED3DFMT_UNKNOWN == destFormat)
+ else if (WINED3DFMT_UNKNOWN == dst_format)
{
- TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", iface);
- if (FAILED(hr = wined3d_surface_update_desc(Dest->wined3d_surface, wined3d_desc.width, wined3d_desc.height,
- srcFormat, wined3d_desc.multisample_type, wined3d_desc.multisample_quality)))
+ TRACE("Converting destination surface from WINED3DFMT_UNKNOWN to the source format.\n");
+ if (FAILED(hr = wined3d_surface_update_desc(dst->wined3d_surface, wined3d_desc.width, wined3d_desc.height,
+ src_format, wined3d_desc.multisample_type, wined3d_desc.multisample_quality)))
{
WARN("Failed to update surface desc, hr %#x.\n", hr);
wined3d_mutex_unlock();
@@ -987,39 +978,39 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface,
}
/* Quick if complete copy ... */
- if (!cRects && !pSourceRects && !pDestPoints)
+ if (!rect_count && !src_rects && !dst_points)
{
RECT rect = {0, 0, src_w, src_h};
- wined3d_surface_blt(Dest->wined3d_surface, &rect,
- Source->wined3d_surface, &rect, 0, NULL, WINED3D_TEXF_POINT);
+ wined3d_surface_blt(dst->wined3d_surface, &rect,
+ src->wined3d_surface, &rect, 0, NULL, WINED3D_TEXF_POINT);
}
else
{
unsigned int i;
/* Copy rect by rect */
- if (pSourceRects && pDestPoints)
+ if (src_rects && dst_points)
{
- for (i = 0; i < cRects; ++i)
+ for (i = 0; i < rect_count; ++i)
{
- UINT w = pSourceRects[i].right - pSourceRects[i].left;
- UINT h = pSourceRects[i].bottom - pSourceRects[i].top;
- RECT dst_rect = {pDestPoints[i].x, pDestPoints[i].y,
- pDestPoints[i].x + w, pDestPoints[i].y + h};
+ UINT w = src_rects[i].right - src_rects[i].left;
+ UINT h = src_rects[i].bottom - src_rects[i].top;
+ RECT dst_rect = {dst_points[i].x, dst_points[i].y,
+ dst_points[i].x + w, dst_points[i].y + h};
- wined3d_surface_blt(Dest->wined3d_surface, &dst_rect,
- Source->wined3d_surface, &pSourceRects[i], 0, NULL, WINED3D_TEXF_POINT);
+ wined3d_surface_blt(dst->wined3d_surface, &dst_rect,
+ src->wined3d_surface, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
}
}
else
{
- for (i = 0; i < cRects; ++i)
+ for (i = 0; i < rect_count; ++i)
{
- UINT w = pSourceRects[i].right - pSourceRects[i].left;
- UINT h = pSourceRects[i].bottom - pSourceRects[i].top;
+ UINT w = src_rects[i].right - src_rects[i].left;
+ UINT h = src_rects[i].bottom - src_rects[i].top;
RECT dst_rect = {0, 0, w, h};
- wined3d_surface_blt(Dest->wined3d_surface, &dst_rect,
- Source->wined3d_surface, &pSourceRects[i], 0, NULL, WINED3D_TEXF_POINT);
+ wined3d_surface_blt(dst->wined3d_surface, &dst_rect,
+ src->wined3d_surface, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
}
}
}
@@ -1028,10 +1019,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface,
return WINED3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_UpdateTexture(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_UpdateTexture(IDirect3DDevice8 *iface,
IDirect3DBaseTexture8 *src_texture, IDirect3DBaseTexture8 *dst_texture)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *src_impl, *dst_impl;
HRESULT hr;
@@ -1041,57 +1032,57 @@ static HRESULT WINAPI IDirect3DDevice8Impl_UpdateTexture(IDirect3DDevice8 *iface
dst_impl = unsafe_impl_from_IDirect3DBaseTexture8(dst_texture);
wined3d_mutex_lock();
- hr = wined3d_device_update_texture(This->wined3d_device,
+ hr = wined3d_device_update_texture(device->wined3d_device,
src_impl->wined3d_texture, dst_impl->wined3d_texture);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(IDirect3DDevice8 *iface,
- IDirect3DSurface8 *pDestSurface)
+static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- IDirect3DSurface8Impl *destSurface = unsafe_impl_from_IDirect3DSurface8(pDestSurface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ IDirect3DSurface8Impl *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
HRESULT hr;
- TRACE("iface %p, dst_surface %p.\n", iface, pDestSurface);
+ TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
- if (pDestSurface == NULL) {
- WARN("(%p) : Caller passed NULL as pDestSurface returning D3DERR_INVALIDCALL\n", This);
+ if (!dst_surface)
+ {
+ WARN("Invalid destination surface passed.\n");
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
- hr = wined3d_device_get_front_buffer_data(This->wined3d_device, 0, destSurface->wined3d_surface);
+ hr = wined3d_device_get_front_buffer_data(device->wined3d_device, 0, dst_impl->wined3d_surface);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *iface,
- IDirect3DSurface8 *pRenderTarget, IDirect3DSurface8 *pNewZStencil)
+static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
+ IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- IDirect3DSurface8Impl *pSurface = unsafe_impl_from_IDirect3DSurface8(pRenderTarget);
- IDirect3DSurface8Impl *pZSurface = unsafe_impl_from_IDirect3DSurface8(pNewZStencil);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ IDirect3DSurface8Impl *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
+ IDirect3DSurface8Impl *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil);
struct wined3d_surface *original_ds = NULL;
HRESULT hr;
- TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, pRenderTarget, pNewZStencil);
+ TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil);
wined3d_mutex_lock();
- if (pZSurface)
+ if (ds_impl)
{
struct wined3d_resource_desc ds_desc, rt_desc;
struct wined3d_resource *wined3d_resource;
struct wined3d_surface *original_rt = NULL;
/* If no render target is passed in check the size against the current RT */
- if (!pRenderTarget)
+ if (!render_target)
{
- hr = wined3d_device_get_render_target(This->wined3d_device, 0, &original_rt);
+ hr = wined3d_device_get_render_target(device->wined3d_device, 0, &original_rt);
if (FAILED(hr) || !original_rt)
{
wined3d_mutex_unlock();
@@ -1101,10 +1092,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
wined3d_surface_decref(original_rt);
}
else
- wined3d_resource = wined3d_surface_get_resource(pSurface->wined3d_surface);
+ wined3d_resource = wined3d_surface_get_resource(rt_impl->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &rt_desc);
- wined3d_resource = wined3d_surface_get_resource(pZSurface->wined3d_surface);
+ wined3d_resource = wined3d_surface_get_resource(ds_impl->wined3d_surface);
wined3d_resource_get_desc(wined3d_resource, &ds_desc);
if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height)
@@ -1115,15 +1106,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
}
}
- hr = wined3d_device_get_depth_stencil(This->wined3d_device, &original_ds);
+ hr = wined3d_device_get_depth_stencil(device->wined3d_device, &original_ds);
if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND)
{
- hr = wined3d_device_set_depth_stencil(This->wined3d_device, pZSurface ? pZSurface->wined3d_surface : NULL);
- if (SUCCEEDED(hr) && pRenderTarget)
+ hr = wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL);
+ if (SUCCEEDED(hr) && render_target)
{
- hr = wined3d_device_set_render_target(This->wined3d_device, 0, pSurface->wined3d_surface, TRUE);
+ hr = wined3d_device_set_render_target(device->wined3d_device, 0, rt_impl->wined3d_surface, TRUE);
if (FAILED(hr))
- wined3d_device_set_depth_stencil(This->wined3d_device, original_ds);
+ wined3d_device_set_depth_stencil(device->wined3d_device, original_ds);
}
}
if (original_ds)
@@ -1134,102 +1125,98 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *iface,
- IDirect3DSurface8 **ppRenderTarget)
+static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDirect3DSurface8 **render_target)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_surface *wined3d_surface;
IDirect3DSurface8Impl *surface_impl;
HRESULT hr;
- TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget);
+ TRACE("iface %p, render_target %p.\n", iface, render_target);
- if (ppRenderTarget == NULL) {
+ if (!render_target)
return D3DERR_INVALIDCALL;
- }
wined3d_mutex_lock();
- hr = wined3d_device_get_render_target(This->wined3d_device, 0, &wined3d_surface);
+ hr = wined3d_device_get_render_target(device->wined3d_device, 0, &wined3d_surface);
if (SUCCEEDED(hr) && wined3d_surface)
{
surface_impl = wined3d_surface_get_parent(wined3d_surface);
- *ppRenderTarget = &surface_impl->IDirect3DSurface8_iface;
- IDirect3DSurface8_AddRef(*ppRenderTarget);
+ *render_target = &surface_impl->IDirect3DSurface8_iface;
+ IDirect3DSurface8_AddRef(*render_target);
wined3d_surface_decref(wined3d_surface);
}
else
{
- FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
- *ppRenderTarget = NULL;
+ ERR("Failed to get wined3d render target, hr %#x.\n", hr);
+ *render_target = NULL;
}
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevice8 *iface,
- IDirect3DSurface8 **ppZStencilSurface)
+static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface, IDirect3DSurface8 **depth_stencil)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_surface *wined3d_surface;
IDirect3DSurface8Impl *surface_impl;
HRESULT hr;
- TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
+ TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
- if(ppZStencilSurface == NULL){
+ if (!depth_stencil)
return D3DERR_INVALIDCALL;
- }
wined3d_mutex_lock();
- hr = wined3d_device_get_depth_stencil(This->wined3d_device, &wined3d_surface);
+ hr = wined3d_device_get_depth_stencil(device->wined3d_device, &wined3d_surface);
if (SUCCEEDED(hr))
{
surface_impl = wined3d_surface_get_parent(wined3d_surface);
- *ppZStencilSurface = &surface_impl->IDirect3DSurface8_iface;
- IDirect3DSurface8_AddRef(*ppZStencilSurface);
+ *depth_stencil = &surface_impl->IDirect3DSurface8_iface;
+ IDirect3DSurface8_AddRef(*depth_stencil);
wined3d_surface_decref(wined3d_surface);
}
else
{
if (hr != WINED3DERR_NOTFOUND)
- FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
- *ppZStencilSurface = NULL;
+ ERR("Failed to get wined3d depth stencil, hr %#x.\n", hr);
+ *depth_stencil = NULL;
}
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_BeginScene(IDirect3DDevice8 *iface)
+static HRESULT WINAPI d3d8_device_BeginScene(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
- hr = wined3d_device_begin_scene(This->wined3d_device);
+ hr = wined3d_device_begin_scene(device->wined3d_device);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(IDirect3DDevice8 *iface)
+static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_device_EndScene(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
- hr = wined3d_device_end_scene(This->wined3d_device);
+ hr = wined3d_device_end_scene(device->wined3d_device);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD rect_count,
+static HRESULT WINAPI d3d8_device_Clear(IDirect3DDevice8 *iface, DWORD rect_count,
const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
{
const struct wined3d_color c =
@@ -1239,296 +1226,286 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
iface, rect_count, rects, flags, color, z, stencil);
wined3d_mutex_lock();
- hr = wined3d_device_clear(This->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
+ hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(IDirect3DDevice8 *iface,
- D3DTRANSFORMSTATETYPE State, const D3DMATRIX *lpMatrix)
+static HRESULT WINAPI d3d8_device_SetTransform(IDirect3DDevice8 *iface,
+ D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, state %#x, matrix %p.\n", iface, State, lpMatrix);
+ TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
wined3d_mutex_lock();
- hr = wined3d_device_set_transform(This->wined3d_device, State, (const struct wined3d_matrix *)lpMatrix);
+ hr = wined3d_device_set_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetTransform(IDirect3DDevice8 *iface,
- D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix)
+static HRESULT WINAPI d3d8_device_GetTransform(IDirect3DDevice8 *iface,
+ D3DTRANSFORMSTATETYPE state, D3DMATRIX *matrix)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix);
+ TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
wined3d_mutex_lock();
- hr = wined3d_device_get_transform(This->wined3d_device, State, (struct wined3d_matrix *)pMatrix);
+ hr = wined3d_device_get_transform(device->wined3d_device, state, (struct wined3d_matrix *)matrix);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_MultiplyTransform(IDirect3DDevice8 *iface,
- D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix)
+static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface,
+ D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix);
+ TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
wined3d_mutex_lock();
- hr = wined3d_device_multiply_transform(This->wined3d_device, State, (const struct wined3d_matrix *)pMatrix);
+ hr = wined3d_device_multiply_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(IDirect3DDevice8 *iface,
- const D3DVIEWPORT8 *pViewport)
+static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, viewport %p.\n", iface, pViewport);
+ TRACE("iface %p, viewport %p.\n", iface, viewport);
/* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock();
- hr = wined3d_device_set_viewport(This->wined3d_device, (const struct wined3d_viewport *)pViewport);
+ hr = wined3d_device_set_viewport(device->wined3d_device, (const struct wined3d_viewport *)viewport);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetViewport(IDirect3DDevice8 *iface,
- D3DVIEWPORT8 *pViewport)
+static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPORT8 *viewport)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, viewport %p.\n", iface, pViewport);
+ TRACE("iface %p, viewport %p.\n", iface, viewport);
/* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock();
- hr = wined3d_device_get_viewport(This->wined3d_device, (struct wined3d_viewport *)pViewport);
+ hr = wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(IDirect3DDevice8 *iface,
- const D3DMATERIAL8 *pMaterial)
+static HRESULT WINAPI d3d8_device_SetMaterial(IDirect3DDevice8 *iface, const D3DMATERIAL8 *material)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, material %p.\n", iface, pMaterial);
+ TRACE("iface %p, material %p.\n", iface, material);
/* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
wined3d_mutex_lock();
- hr = wined3d_device_set_material(This->wined3d_device, (const struct wined3d_material *)pMaterial);
+ hr = wined3d_device_set_material(device->wined3d_device, (const struct wined3d_material *)material);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(IDirect3DDevice8 *iface,
- D3DMATERIAL8 *pMaterial)
+static HRESULT WINAPI d3d8_device_GetMaterial(IDirect3DDevice8 *iface, D3DMATERIAL8 *material)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, material %p.\n", iface, pMaterial);
+ TRACE("iface %p, material %p.\n", iface, material);
/* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
wined3d_mutex_lock();
- hr = wined3d_device_get_material(This->wined3d_device, (struct wined3d_material *)pMaterial);
+ hr = wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetLight(IDirect3DDevice8 *iface, DWORD Index,
- const D3DLIGHT8 *pLight)
+static HRESULT WINAPI d3d8_device_SetLight(IDirect3DDevice8 *iface, DWORD index, const D3DLIGHT8 *light)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight);
+ TRACE("iface %p, index %u, light %p.\n", iface, index, light);
/* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
wined3d_mutex_lock();
- hr = wined3d_device_set_light(This->wined3d_device, Index, (const struct wined3d_light *)pLight);
+ hr = wined3d_device_set_light(device->wined3d_device, index, (const struct wined3d_light *)light);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetLight(IDirect3DDevice8 *iface, DWORD Index,
- D3DLIGHT8 *pLight)
+static HRESULT WINAPI d3d8_device_GetLight(IDirect3DDevice8 *iface, DWORD index, D3DLIGHT8 *light)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight);
+ TRACE("iface %p, index %u, light %p.\n", iface, index, light);
/* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
wined3d_mutex_lock();
- hr = wined3d_device_get_light(This->wined3d_device, Index, (struct wined3d_light *)pLight);
+ hr = wined3d_device_get_light(device->wined3d_device, index, (struct wined3d_light *)light);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(IDirect3DDevice8 *iface, DWORD Index,
- BOOL Enable)
+static HRESULT WINAPI d3d8_device_LightEnable(IDirect3DDevice8 *iface, DWORD index, BOOL enable)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, index %u, enable %#x.\n", iface, Index, Enable);
+ TRACE("iface %p, index %u, enable %#x.\n", iface, index, enable);
wined3d_mutex_lock();
- hr = wined3d_device_set_light_enable(This->wined3d_device, Index, Enable);
+ hr = wined3d_device_set_light_enable(device->wined3d_device, index, enable);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(IDirect3DDevice8 *iface, DWORD Index,
- BOOL *pEnable)
+static HRESULT WINAPI d3d8_device_GetLightEnable(IDirect3DDevice8 *iface, DWORD index, BOOL *enable)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, index %u, enable %p.\n", iface, Index, pEnable);
+ TRACE("iface %p, index %u, enable %p.\n", iface, index, enable);
wined3d_mutex_lock();
- hr = wined3d_device_get_light_enable(This->wined3d_device, Index, pEnable);
+ hr = wined3d_device_get_light_enable(device->wined3d_device, index, enable);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetClipPlane(IDirect3DDevice8 *iface, DWORD Index,
- const float *pPlane)
+static HRESULT WINAPI d3d8_device_SetClipPlane(IDirect3DDevice8 *iface, DWORD index, const float *plane)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
+ TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
wined3d_mutex_lock();
- hr = wined3d_device_set_clip_plane(This->wined3d_device, Index, pPlane);
+ hr = wined3d_device_set_clip_plane(device->wined3d_device, index, plane);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetClipPlane(IDirect3DDevice8 *iface, DWORD Index,
- float *pPlane)
+static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD index, float *plane)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
+ TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
wined3d_mutex_lock();
- hr = wined3d_device_get_clip_plane(This->wined3d_device, Index, pPlane);
+ hr = wined3d_device_get_clip_plane(device->wined3d_device, index, plane);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(IDirect3DDevice8 *iface,
- D3DRENDERSTATETYPE State, DWORD Value)
+static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface,
+ D3DRENDERSTATETYPE state, DWORD value)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, state %#x, value %#x.\n", iface, State, Value);
+ TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
wined3d_mutex_lock();
- switch (State)
+ switch (state)
{
case D3DRS_ZBIAS:
- hr = wined3d_device_set_render_state(This->wined3d_device, WINED3D_RS_DEPTHBIAS, Value);
+ hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
break;
default:
- hr = wined3d_device_set_render_state(This->wined3d_device, State, Value);
+ hr = wined3d_device_set_render_state(device->wined3d_device, state, value);
}
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderState(IDirect3DDevice8 *iface,
- D3DRENDERSTATETYPE State, DWORD *pValue)
+static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface,
+ D3DRENDERSTATETYPE state, DWORD *value)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, state %#x, value %p.\n", iface, State, pValue);
+ TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
wined3d_mutex_lock();
- switch (State)
+ switch (state)
{
case D3DRS_ZBIAS:
- hr = wined3d_device_get_render_state(This->wined3d_device, WINED3D_RS_DEPTHBIAS, pValue);
+ hr = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
break;
default:
- hr = wined3d_device_get_render_state(This->wined3d_device, State, pValue);
+ hr = wined3d_device_get_render_state(device->wined3d_device, state, value);
}
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_BeginStateBlock(IDirect3DDevice8 *iface)
+static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
- hr = wined3d_device_begin_stateblock(This->wined3d_device);
+ hr = wined3d_device_begin_stateblock(device->wined3d_device);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface, DWORD *pToken)
+static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD *token)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_stateblock *stateblock;
HRESULT hr;
- TRACE("iface %p, token %p.\n", iface, pToken);
+ TRACE("iface %p, token %p.\n", iface, token);
/* Tell wineD3D to endstateblock before anything else (in case we run out
* of memory later and cause locking problems)
*/
wined3d_mutex_lock();
- hr = wined3d_device_end_stateblock(This->wined3d_device, &stateblock);
+ hr = wined3d_device_end_stateblock(device->wined3d_device, &stateblock);
if (FAILED(hr))
{
WARN("IWineD3DDevice_EndStateBlock returned an error\n");
@@ -1536,10 +1513,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface
return hr;
}
- *pToken = d3d8_allocate_handle(&This->handle_table, stateblock, D3D8_HANDLE_SB);
+ *token = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
wined3d_mutex_unlock();
- if (*pToken == D3D8_INVALID_HANDLE)
+ if (*token == D3D8_INVALID_HANDLE)
{
ERR("Failed to create a handle\n");
wined3d_mutex_lock();
@@ -1547,28 +1524,29 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface
wined3d_mutex_unlock();
return E_FAIL;
}
- ++*pToken;
+ ++*token;
- TRACE("Returning %#x (%p).\n", *pToken, stateblock);
+ TRACE("Returning %#x (%p).\n", *token, stateblock);
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD Token)
+static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD token)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_stateblock *stateblock;
HRESULT hr;
- TRACE("iface %p, token %#x.\n", iface, Token);
+ TRACE("iface %p, token %#x.\n", iface, token);
- if (!Token) return D3D_OK;
+ if (!token)
+ return D3D_OK;
wined3d_mutex_lock();
- stateblock = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB);
+ stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
if (!stateblock)
{
- WARN("Invalid handle (%#x) passed.\n", Token);
+ WARN("Invalid handle (%#x) passed.\n", token);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
@@ -1578,19 +1556,19 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(IDirect3DDevice8 *ifa
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(IDirect3DDevice8 *iface, DWORD Token)
+static HRESULT WINAPI d3d8_device_CaptureStateBlock(IDirect3DDevice8 *iface, DWORD token)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_stateblock *stateblock;
HRESULT hr;
- TRACE("iface %p, token %#x.\n", iface, Token);
+ TRACE("iface %p, token %#x.\n", iface, token);
wined3d_mutex_lock();
- stateblock = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB);
+ stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
if (!stateblock)
{
- WARN("Invalid handle (%#x) passed.\n", Token);
+ WARN("Invalid handle (%#x) passed.\n", token);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
@@ -1600,19 +1578,19 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(IDirect3DDevice8 *i
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(IDirect3DDevice8 *iface, DWORD Token)
+static HRESULT WINAPI d3d8_device_DeleteStateBlock(IDirect3DDevice8 *iface, DWORD token)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_stateblock *stateblock;
- TRACE("iface %p, token %#x.\n", iface, Token);
+ TRACE("iface %p, token %#x.\n", iface, token);
wined3d_mutex_lock();
- stateblock = d3d8_free_handle(&This->handle_table, Token - 1, D3D8_HANDLE_SB);
+ stateblock = d3d8_free_handle(&device->handle_table, token - 1, D3D8_HANDLE_SB);
if (!stateblock)
{
- WARN("Invalid handle (%#x) passed.\n", Token);
+ WARN("Invalid handle (%#x) passed.\n", token);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
@@ -1626,25 +1604,25 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(IDirect3DDevice8 *if
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *iface,
- D3DSTATEBLOCKTYPE Type, DWORD *handle)
+static HRESULT WINAPI d3d8_device_CreateStateBlock(IDirect3DDevice8 *iface,
+ D3DSTATEBLOCKTYPE type, DWORD *handle)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_stateblock *stateblock;
HRESULT hr;
- TRACE("iface %p, type %#x, handle %p.\n", iface, Type, handle);
+ TRACE("iface %p, type %#x, handle %p.\n", iface, type, handle);
- if (Type != D3DSBT_ALL
- && Type != D3DSBT_PIXELSTATE
- && Type != D3DSBT_VERTEXSTATE)
+ if (type != D3DSBT_ALL
+ && type != D3DSBT_PIXELSTATE
+ && type != D3DSBT_VERTEXSTATE)
{
WARN("Unexpected stateblock type, returning D3DERR_INVALIDCALL\n");
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
- hr = wined3d_stateblock_create(This->wined3d_device, (enum wined3d_stateblock_type)Type, &stateblock);
+ hr = wined3d_stateblock_create(device->wined3d_device, (enum wined3d_stateblock_type)type, &stateblock);
if (FAILED(hr))
{
wined3d_mutex_unlock();
@@ -1652,7 +1630,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if
return hr;
}
- *handle = d3d8_allocate_handle(&This->handle_table, stateblock, D3D8_HANDLE_SB);
+ *handle = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
wined3d_mutex_unlock();
if (*handle == D3D8_INVALID_HANDLE)
@@ -1670,81 +1648,76 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetClipStatus(IDirect3DDevice8 *iface,
- const D3DCLIPSTATUS8 *pClipStatus)
+static HRESULT WINAPI d3d8_device_SetClipStatus(IDirect3DDevice8 *iface, const D3DCLIPSTATUS8 *clip_status)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, clip_status %p.\n", iface, pClipStatus);
+ TRACE("iface %p, clip_status %p.\n", iface, clip_status);
/* FIXME: Verify that D3DCLIPSTATUS8 ~= struct wined3d_clip_status. */
wined3d_mutex_lock();
- hr = wined3d_device_set_clip_status(This->wined3d_device, (const struct wined3d_clip_status *)pClipStatus);
+ hr = wined3d_device_set_clip_status(device->wined3d_device, (const struct wined3d_clip_status *)clip_status);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(IDirect3DDevice8 *iface,
- D3DCLIPSTATUS8 *pClipStatus)
+static HRESULT WINAPI d3d8_device_GetClipStatus(IDirect3DDevice8 *iface, D3DCLIPSTATUS8 *clip_status)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, clip_status %p.\n", iface, pClipStatus);
+ TRACE("iface %p, clip_status %p.\n", iface, clip_status);
wined3d_mutex_lock();
- hr = wined3d_device_get_clip_status(This->wined3d_device, (struct wined3d_clip_status *)pClipStatus);
+ hr = wined3d_device_get_clip_status(device->wined3d_device, (struct wined3d_clip_status *)clip_status);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface,
- DWORD Stage, IDirect3DBaseTexture8 **ppTexture)
+static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 **texture)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_texture *wined3d_texture;
struct d3d8_texture *texture_impl;
HRESULT hr;
- TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, ppTexture);
+ TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
- if(ppTexture == NULL){
+ if (!texture)
return D3DERR_INVALIDCALL;
- }
wined3d_mutex_lock();
- hr = wined3d_device_get_texture(This->wined3d_device, Stage, &wined3d_texture);
+ hr = wined3d_device_get_texture(device->wined3d_device, stage, &wined3d_texture);
if (FAILED(hr))
{
- WARN("Failed to get texture for stage %u, hr %#x.\n", Stage, hr);
+ WARN("Failed to get texture for stage %u, hr %#x.\n", stage, hr);
wined3d_mutex_unlock();
- *ppTexture = NULL;
+ *texture = NULL;
return hr;
}
if (wined3d_texture)
{
texture_impl = wined3d_texture_get_parent(wined3d_texture);
- *ppTexture = &texture_impl->IDirect3DBaseTexture8_iface;
- IDirect3DBaseTexture8_AddRef(*ppTexture);
+ *texture = &texture_impl->IDirect3DBaseTexture8_iface;
+ IDirect3DBaseTexture8_AddRef(*texture);
wined3d_texture_decref(wined3d_texture);
}
else
{
- *ppTexture = NULL;
+ *texture = NULL;
}
wined3d_mutex_unlock();
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(IDirect3DDevice8 *iface, DWORD stage,
- IDirect3DBaseTexture8 *texture)
+static HRESULT WINAPI d3d8_device_SetTexture(IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 *texture)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_texture *texture_impl;
HRESULT hr;
@@ -1753,7 +1726,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(IDirect3DDevice8 *iface, D
texture_impl = unsafe_impl_from_IDirect3DBaseTexture8(texture);
wined3d_mutex_lock();
- hr = wined3d_device_set_texture(This->wined3d_device, stage,
+ hr = wined3d_device_set_texture(device->wined3d_device, stage,
texture_impl ? texture_impl->wined3d_texture : NULL);
wined3d_mutex_unlock();
@@ -1798,14 +1771,14 @@ tss_lookup[] =
{FALSE, WINED3D_TSS_RESULT_ARG}, /* 28, D3DTSS_RESULTARG */
};
-static HRESULT WINAPI IDirect3DDevice8Impl_GetTextureStageState(IDirect3DDevice8 *iface,
- DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue)
+static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
+ DWORD stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *value)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
const struct tss_lookup *l;
HRESULT hr;
- TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, Stage, Type, pValue);
+ TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value);
if (Type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
{
@@ -1817,57 +1790,56 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTextureStageState(IDirect3DDevic
wined3d_mutex_lock();
if (l->sampler_state)
- hr = wined3d_device_get_sampler_state(This->wined3d_device, Stage, l->state, pValue);
+ hr = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state, value);
else
- hr = wined3d_device_get_texture_stage_state(This->wined3d_device, Stage, l->state, pValue);
+ hr = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state, value);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(IDirect3DDevice8 *iface,
- DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value)
+static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
+ DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
const struct tss_lookup *l;
HRESULT hr;
- TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, Stage, Type, Value);
+ TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, type, value);
- if (Type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
+ if (type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
{
- WARN("Invalid Type %#x passed.\n", Type);
+ WARN("Invalid type %#x passed.\n", type);
return D3D_OK;
}
- l = &tss_lookup[Type];
+ l = &tss_lookup[type];
wined3d_mutex_lock();
if (l->sampler_state)
- hr = wined3d_device_set_sampler_state(This->wined3d_device, Stage, l->state, Value);
+ hr = wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value);
else
- hr = wined3d_device_set_texture_stage_state(This->wined3d_device, Stage, l->state, Value);
+ hr = wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_ValidateDevice(IDirect3DDevice8 *iface,
- DWORD *pNumPasses)
+static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD *pass_count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, pass_count %p.\n", iface, pNumPasses);
+ TRACE("iface %p, pass_count %p.\n", iface, pass_count);
wined3d_mutex_lock();
- hr = wined3d_device_validate_device(This->wined3d_device, pNumPasses);
+ hr = wined3d_device_validate_device(device->wined3d_device, pass_count);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetInfo(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface,
DWORD info_id, void *info, DWORD info_size)
{
FIXME("iface %p, info_id %#x, info %p, info_size %u stub!\n", iface, info_id, info, info_size);
@@ -1875,10 +1847,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetInfo(IDirect3DDevice8 *iface,
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(IDirect3DDevice8 *iface,
- UINT PaletteNumber, const PALETTEENTRY *pEntries)
+static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface,
+ UINT palette_idx, const PALETTEENTRY *entries)
{
- FIXME("iface %p, palette_idx %u, entries %p unimplemented\n", iface, PaletteNumber, pEntries);
+ FIXME("iface %p, palette_idx %u, entries %p unimplemented\n", iface, palette_idx, entries);
/* GPUs stopped supporting palettized textures with the Shader Model 1 generation. Wined3d
* does not have a d3d8/9-style palette API */
@@ -1886,133 +1858,130 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(IDirect3DDevice8 *i
return D3DERR_INVALIDCALL;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(IDirect3DDevice8 *iface,
- UINT PaletteNumber, PALETTEENTRY *pEntries)
+static HRESULT WINAPI d3d8_device_GetPaletteEntries(IDirect3DDevice8 *iface,
+ UINT palette_idx, PALETTEENTRY *entries)
{
- FIXME("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, PaletteNumber, pEntries);
+ FIXME("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, palette_idx, entries);
return D3DERR_INVALIDCALL;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(IDirect3DDevice8 *iface,
- UINT PaletteNumber)
+static HRESULT WINAPI d3d8_device_SetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT palette_idx)
{
- FIXME("iface %p, palette_idx %u unimplemented.\n", iface, PaletteNumber);
+ FIXME("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx);
return D3DERR_INVALIDCALL;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetCurrentTexturePalette(IDirect3DDevice8 *iface,
- UINT *PaletteNumber)
+static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT *palette_idx)
{
- FIXME("iface %p, palette_idx %p unimplemented.\n", iface, PaletteNumber);
+ FIXME("iface %p, palette_idx %p unimplemented.\n", iface, palette_idx);
return D3DERR_INVALIDCALL;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(IDirect3DDevice8 *iface,
- D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount)
+static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface,
+ D3DPRIMITIVETYPE primitive_type, UINT start_vertex, UINT primitive_count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n",
- iface, PrimitiveType, StartVertex, PrimitiveCount);
+ iface, primitive_type, start_vertex, primitive_count);
wined3d_mutex_lock();
- wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType);
- hr = wined3d_device_draw_primitive(This->wined3d_device, StartVertex,
- vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount));
+ wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
+ hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex,
+ vertex_count_from_primitive_count(primitive_type, primitive_count));
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
- D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT startIndex,
- UINT primCount)
+static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
+ D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count,
+ UINT start_idx, UINT primitive_count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n",
- iface, PrimitiveType, MinVertexIndex, NumVertices, startIndex, primCount);
+ iface, primitive_type, min_vertex_idx, vertex_count, start_idx, primitive_count);
wined3d_mutex_lock();
- wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType);
- hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, startIndex,
- vertex_count_from_primitive_count(PrimitiveType, primCount));
+ wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
+ hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx,
+ vertex_count_from_primitive_count(primitive_type, primitive_count));
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(IDirect3DDevice8 *iface,
- D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData,
- UINT VertexStreamZeroStride)
+static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
+ D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data,
+ UINT stride)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n",
- iface, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
+ iface, primitive_type, primitive_count, data, stride);
wined3d_mutex_lock();
- wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType);
- hr = wined3d_device_draw_primitive_up(This->wined3d_device,
- vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount),
- pVertexStreamZeroData, VertexStreamZeroStride);
+ wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
+ hr = wined3d_device_draw_primitive_up(device->wined3d_device,
+ vertex_count_from_primitive_count(primitive_type, primitive_count),
+ data, stride);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface,
- D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices,
- UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat,
- const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
+static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface,
+ D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT index_count,
+ UINT primitive_count, const void *index_data, D3DFORMAT index_format,
+ const void *vertex_data, UINT vertex_stride)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n"
"index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n",
- iface, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount,
- pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
+ iface, primitive_type, min_vertex_idx, index_count, primitive_count,
+ index_data, index_format, vertex_data, vertex_stride);
wined3d_mutex_lock();
- wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType);
- hr = wined3d_device_draw_indexed_primitive_up(This->wined3d_device,
- vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData,
- wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride);
+ wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
+ hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device,
+ vertex_count_from_primitive_count(primitive_type, primitive_count), index_data,
+ wined3dformat_from_d3dformat(index_format), vertex_data, vertex_stride);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(IDirect3DDevice8 *iface,
- UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer8 *pDestBuffer,
- DWORD Flags)
+static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT src_start_idx,
+ UINT dst_idx, UINT vertex_count, IDirect3DVertexBuffer8 *dst_buffer, DWORD flags)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- IDirect3DVertexBuffer8Impl *dest = unsafe_impl_from_IDirect3DVertexBuffer8(pDestBuffer);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ IDirect3DVertexBuffer8Impl *dst = unsafe_impl_from_IDirect3DVertexBuffer8(dst_buffer);
HRESULT hr;
TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n",
- iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags);
+ iface, src_start_idx, dst_idx, vertex_count, dst_buffer, flags);
wined3d_mutex_lock();
- hr = wined3d_device_process_vertices(This->wined3d_device, SrcStartIndex, DestIndex,
- VertexCount, dest->wineD3DVertexBuffer, NULL, Flags, dest->fvf);
+ hr = wined3d_device_process_vertices(device->wined3d_device, src_start_idx, dst_idx,
+ vertex_count, dst->wineD3DVertexBuffer, NULL, flags, dst->fvf);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface,
const DWORD *declaration, const DWORD *byte_code, DWORD *shader, DWORD usage)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_vertex_shader *object;
DWORD shader_handle;
DWORD handle;
@@ -2030,7 +1999,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(IDirect3DDevice8 *
}
wined3d_mutex_lock();
- handle = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_VS);
+ handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_VS);
wined3d_mutex_unlock();
if (handle == D3D8_INVALID_HANDLE)
{
@@ -2042,12 +2011,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(IDirect3DDevice8 *
shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
- hr = d3d8_vertex_shader_init(object, This, declaration, byte_code, shader_handle, usage);
+ hr = d3d8_vertex_shader_init(object, device, declaration, byte_code, shader_handle, usage);
if (FAILED(hr))
{
WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
wined3d_mutex_lock();
- d3d8_free_handle(&This->handle_table, handle, D3D8_HANDLE_VS);
+ d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_VS);
wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, object);
*shader = 0;
@@ -2060,86 +2029,90 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(IDirect3DDevice8 *
return D3D_OK;
}
-static struct d3d8_vertex_declaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf)
+static struct d3d8_vertex_declaration *d3d8_device_get_fvf_declaration(struct d3d8_device *device, DWORD fvf)
{
struct d3d8_vertex_declaration *d3d8_declaration;
- HRESULT hr;
+ struct FvfToDecl *convertedDecls = device->decls;
int p, low, high; /* deliberately signed */
- struct FvfToDecl *convertedDecls = This->decls;
+ HRESULT hr;
TRACE("Searching for declaration for fvf %08x... ", fvf);
low = 0;
- high = This->numConvertedDecls - 1;
- while(low <= high) {
+ high = device->numConvertedDecls - 1;
+ while (low <= high)
+ {
p = (low + high) >> 1;
TRACE("%d ", p);
+
if (convertedDecls[p].fvf == fvf)
{
TRACE("found %p\n", convertedDecls[p].declaration);
return convertedDecls[p].declaration;
}
- else if (convertedDecls[p].fvf < fvf)
- {
+
+ if (convertedDecls[p].fvf < fvf)
low = p + 1;
- } else {
+ else
high = p - 1;
- }
}
TRACE("not found. Creating and inserting at position %d.\n", low);
- d3d8_declaration = HeapAlloc(GetProcessHeap(), 0, sizeof(*d3d8_declaration));
- if (!d3d8_declaration)
+ if (!(d3d8_declaration = HeapAlloc(GetProcessHeap(), 0, sizeof(*d3d8_declaration))))
{
ERR("Memory allocation failed.\n");
return NULL;
}
- hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, This, fvf);
- if (FAILED(hr))
+ if (FAILED(hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, device, fvf)))
{
WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, d3d8_declaration);
return NULL;
}
- if(This->declArraySize == This->numConvertedDecls) {
- int grow = This->declArraySize / 2;
+ if (device->declArraySize == device->numConvertedDecls)
+ {
+ UINT grow = device->declArraySize / 2;
+
convertedDecls = HeapReAlloc(GetProcessHeap(), 0, convertedDecls,
- sizeof(convertedDecls[0]) * (This->numConvertedDecls + grow));
+ sizeof(*convertedDecls) * (device->numConvertedDecls + grow));
if (!convertedDecls)
{
d3d8_vertex_declaration_destroy(d3d8_declaration);
return NULL;
}
- This->decls = convertedDecls;
- This->declArraySize += grow;
+ device->decls = convertedDecls;
+ device->declArraySize += grow;
}
- memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
+ memmove(convertedDecls + low + 1, convertedDecls + low,
+ sizeof(*convertedDecls) * (device->numConvertedDecls - low));
convertedDecls[low].declaration = d3d8_declaration;
convertedDecls[low].fvf = fvf;
- This->numConvertedDecls++;
+ ++device->numConvertedDecls;
+
+ TRACE("Returning %p. %u decls in array.\n", d3d8_declaration, device->numConvertedDecls);
- TRACE("Returning %p. %u decls in array\n", d3d8_declaration, This->numConvertedDecls);
return d3d8_declaration;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *iface, DWORD pShader)
+static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct d3d8_vertex_shader *shader;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_vertex_shader *shader_impl;
HRESULT hr;
- TRACE("iface %p, shader %#x.\n", iface, pShader);
+ TRACE("iface %p, shader %#x.\n", iface, shader);
- if (VS_HIGHESTFIXEDFXF >= pShader) {
- TRACE("Setting FVF, %#x\n", pShader);
+ if (VS_HIGHESTFIXEDFXF >= shader)
+ {
+ TRACE("Setting FVF, %#x\n", shader);
wined3d_mutex_lock();
- wined3d_device_set_vertex_declaration(This->wined3d_device,
- IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration);
- wined3d_device_set_vertex_shader(This->wined3d_device, NULL);
+ wined3d_device_set_vertex_declaration(device->wined3d_device,
+ d3d8_device_get_fvf_declaration(device, shader)->wined3d_vertex_declaration);
+ wined3d_device_set_vertex_shader(device->wined3d_device, NULL);
wined3d_mutex_unlock();
return D3D_OK;
@@ -2148,19 +2121,18 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *ifa
TRACE("Setting shader\n");
wined3d_mutex_lock();
- shader = d3d8_get_object(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
- if (!shader)
+ if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
{
- WARN("Invalid handle (%#x) passed.\n", pShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- hr = wined3d_device_set_vertex_declaration(This->wined3d_device,
- shader->vertex_declaration->wined3d_vertex_declaration);
+ hr = wined3d_device_set_vertex_declaration(device->wined3d_device,
+ shader_impl->vertex_declaration->wined3d_vertex_declaration);
if (SUCCEEDED(hr))
- hr = wined3d_device_set_vertex_shader(This->wined3d_device, shader->wined3d_shader);
+ hr = wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
wined3d_mutex_unlock();
TRACE("Returning hr %#x\n", hr);
@@ -2168,199 +2140,195 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *ifa
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *iface, DWORD *ppShader)
+static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD *shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_vertex_declaration *wined3d_declaration;
struct d3d8_vertex_declaration *d3d8_declaration;
HRESULT hr;
- TRACE("iface %p, shader %p.\n", iface, ppShader);
+ TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock();
- hr = wined3d_device_get_vertex_declaration(This->wined3d_device, &wined3d_declaration);
- if (FAILED(hr))
+ if (FAILED(hr = wined3d_device_get_vertex_declaration(device->wined3d_device, &wined3d_declaration)))
{
wined3d_mutex_unlock();
- WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n",
- This, hr, This->wined3d_device);
+ WARN("Failed to get wined3d vertex declaration, hr %#x.\n", hr);
return hr;
}
if (!wined3d_declaration)
{
wined3d_mutex_unlock();
- *ppShader = 0;
+ *shader = 0;
return D3D_OK;
}
d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
wined3d_vertex_declaration_decref(wined3d_declaration);
wined3d_mutex_unlock();
- *ppShader = d3d8_declaration->shader_handle;
+ *shader = d3d8_declaration->shader_handle;
- TRACE("(%p) : returning %#x\n", This, *ppShader);
+ TRACE("Returning %#x.\n", *shader);
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(IDirect3DDevice8 *iface, DWORD pShader)
+static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DWORD shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct d3d8_vertex_shader *shader;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_vertex_shader *shader_impl;
struct wined3d_shader *cur;
- TRACE("iface %p, shader %#x.\n", iface, pShader);
+ TRACE("iface %p, shader %#x.\n", iface, shader);
wined3d_mutex_lock();
- shader = d3d8_free_handle(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
- if (!shader)
+ if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
{
- WARN("Invalid handle (%#x) passed.\n", pShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- cur = wined3d_device_get_vertex_shader(This->wined3d_device);
- if (cur)
+ if ((cur = wined3d_device_get_vertex_shader(device->wined3d_device)))
{
- if (cur == shader->wined3d_shader)
+ if (cur == shader_impl->wined3d_shader)
IDirect3DDevice8_SetVertexShader(iface, 0);
wined3d_shader_decref(cur);
}
wined3d_mutex_unlock();
- d3d8_vertex_shader_destroy(shader);
+ d3d8_vertex_shader_destroy(shader_impl);
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(IDirect3DDevice8 *iface,
- DWORD Register, const void *pConstantData, DWORD ConstantCount)
+static HRESULT WINAPI d3d8_device_SetVertexShaderConstant(IDirect3DDevice8 *iface,
+ DWORD start_register, const void *data, DWORD count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, register %u, data %p, count %u.\n",
- iface, Register, pConstantData, ConstantCount);
+ TRACE("iface %p, start_register %u, data %p, count %u.\n",
+ iface, start_register, data, count);
- if(Register + ConstantCount > D3D8_MAX_VERTEX_SHADER_CONSTANTF) {
+ if (start_register + count > D3D8_MAX_VERTEX_SHADER_CONSTANTF)
+ {
WARN("Trying to access %u constants, but d3d8 only supports %u\n",
- Register + ConstantCount, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
+ start_register + count, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
- hr = wined3d_device_set_vs_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount);
+ hr = wined3d_device_set_vs_consts_f(device->wined3d_device, start_register, data, count);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderConstant(IDirect3DDevice8 *iface,
- DWORD Register, void *pConstantData, DWORD ConstantCount)
+static HRESULT WINAPI d3d8_device_GetVertexShaderConstant(IDirect3DDevice8 *iface,
+ DWORD start_register, void *data, DWORD count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, register %u, data %p, count %u.\n",
- iface, Register, pConstantData, ConstantCount);
+ TRACE("iface %p, start_register %u, data %p, count %u.\n",
+ iface, start_register, data, count);
- if(Register + ConstantCount > D3D8_MAX_VERTEX_SHADER_CONSTANTF) {
+ if (start_register + count > D3D8_MAX_VERTEX_SHADER_CONSTANTF)
+ {
WARN("Trying to access %u constants, but d3d8 only supports %u\n",
- Register + ConstantCount, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
+ start_register + count, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
- hr = wined3d_device_get_vs_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount);
+ hr = wined3d_device_get_vs_consts_f(device->wined3d_device, start_register, data, count);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(IDirect3DDevice8 *iface,
- DWORD pVertexShader, void *pData, DWORD *pSizeOfData)
+static HRESULT WINAPI d3d8_device_GetVertexShaderDeclaration(IDirect3DDevice8 *iface,
+ DWORD shader, void *data, DWORD *data_size)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_vertex_declaration *declaration;
- struct d3d8_vertex_shader *shader;
+ struct d3d8_vertex_shader *shader_impl;
TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
- iface, pVertexShader, pData, pSizeOfData);
+ iface, shader, data, data_size);
wined3d_mutex_lock();
- shader = d3d8_get_object(&This->handle_table, pVertexShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
+ shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
wined3d_mutex_unlock();
- if (!shader)
+ if (!shader_impl)
{
- WARN("Invalid handle (%#x) passed.\n", pVertexShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
return D3DERR_INVALIDCALL;
}
- declaration = shader->vertex_declaration;
+ declaration = shader_impl->vertex_declaration;
- /* If pData is NULL, we just return the required size of the buffer. */
- if (!pData) {
- *pSizeOfData = declaration->elements_size;
+ if (!data)
+ {
+ *data_size = declaration->elements_size;
return D3D_OK;
}
- /* MSDN claims that if *pSizeOfData is smaller than the required size
+ /* MSDN claims that if *data_size is smaller than the required size
* we should write the required size and return D3DERR_MOREDATA.
* That's not actually true. */
- if (*pSizeOfData < declaration->elements_size) {
+ if (*data_size < declaration->elements_size)
return D3DERR_INVALIDCALL;
- }
- CopyMemory(pData, declaration->elements, declaration->elements_size);
+ memcpy(data, declaration->elements, declaration->elements_size);
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(IDirect3DDevice8 *iface,
- DWORD pVertexShader, void *pData, DWORD *pSizeOfData)
+static HRESULT WINAPI d3d8_device_GetVertexShaderFunction(IDirect3DDevice8 *iface,
+ DWORD shader, void *data, DWORD *data_size)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct d3d8_vertex_shader *shader = NULL;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_vertex_shader *shader_impl = NULL;
HRESULT hr;
TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
- iface, pVertexShader, pData, pSizeOfData);
+ iface, shader, data, data_size);
wined3d_mutex_lock();
- shader = d3d8_get_object(&This->handle_table, pVertexShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
- if (!shader)
+ if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
{
- WARN("Invalid handle (%#x) passed.\n", pVertexShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- if (!shader->wined3d_shader)
+ if (!shader_impl->wined3d_shader)
{
wined3d_mutex_unlock();
- *pSizeOfData = 0;
+ *data_size = 0;
return D3D_OK;
}
- hr = wined3d_shader_get_byte_code(shader->wined3d_shader, pData, pSizeOfData);
+ hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, data_size);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(IDirect3DDevice8 *iface,
- IDirect3DIndexBuffer8 *pIndexData, UINT baseVertexIndex)
+static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
+ IDirect3DIndexBuffer8 *buffer, UINT base_vertex_idx)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- IDirect3DIndexBuffer8Impl *ib = unsafe_impl_from_IDirect3DIndexBuffer8(pIndexData);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ IDirect3DIndexBuffer8Impl *ib = unsafe_impl_from_IDirect3DIndexBuffer8(buffer);
HRESULT hr;
- TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, pIndexData, baseVertexIndex);
+ TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, buffer, base_vertex_idx);
/* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that
* the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large
@@ -2369,8 +2337,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(IDirect3DDevice8 *iface,
* problem)
*/
wined3d_mutex_lock();
- wined3d_device_set_base_vertex_index(This->wined3d_device, baseVertexIndex);
- hr = wined3d_device_set_index_buffer(This->wined3d_device,
+ wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx);
+ hr = wined3d_device_set_index_buffer(device->wined3d_device,
ib ? ib->wineD3DIndexBuffer : NULL,
ib ? ib->format : WINED3DFMT_UNKNOWN);
wined3d_mutex_unlock();
@@ -2378,43 +2346,45 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(IDirect3DDevice8 *iface,
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface,
- IDirect3DIndexBuffer8 **ppIndexData, UINT *pBaseVertexIndex)
+static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
+ IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct wined3d_buffer *retIndexData = NULL;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct wined3d_buffer *wined3d_buffer = NULL;
IDirect3DIndexBuffer8Impl *buffer_impl;
HRESULT hr;
- TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, ppIndexData, pBaseVertexIndex);
+ TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index);
- if(ppIndexData == NULL){
+ if (!buffer)
return D3DERR_INVALIDCALL;
- }
/* The case from UINT to INT is safe because d3d8 will never set negative values */
wined3d_mutex_lock();
- *pBaseVertexIndex = wined3d_device_get_base_vertex_index(This->wined3d_device);
- hr = wined3d_device_get_index_buffer(This->wined3d_device, &retIndexData);
- if (SUCCEEDED(hr) && retIndexData)
+ *base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device);
+ hr = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_buffer);
+ if (SUCCEEDED(hr) && wined3d_buffer)
+ {
+ buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
+ *buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;
+ IDirect3DIndexBuffer8_AddRef(*buffer);
+ wined3d_buffer_decref(wined3d_buffer);
+ }
+ else
{
- buffer_impl = wined3d_buffer_get_parent(retIndexData);
- *ppIndexData = &buffer_impl->IDirect3DIndexBuffer8_iface;
- IDirect3DIndexBuffer8_AddRef(*ppIndexData);
- wined3d_buffer_decref(retIndexData);
- } else {
- if (FAILED(hr)) FIXME("Call to GetIndices failed\n");
- *ppIndexData = NULL;
+ if (FAILED(hr))
+ ERR("Failed to get wined3d index buffer, hr %#x.", hr);
+ *buffer = NULL;
}
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *iface,
+static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface,
const DWORD *byte_code, DWORD *shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_pixel_shader *object;
DWORD shader_handle;
DWORD handle;
@@ -2423,10 +2393,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *i
TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader);
if (!shader)
- {
- TRACE("(%p) Invalid call\n", This);
return D3DERR_INVALIDCALL;
- }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -2436,7 +2403,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *i
}
wined3d_mutex_lock();
- handle = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_PS);
+ handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_PS);
wined3d_mutex_unlock();
if (handle == D3D8_INVALID_HANDLE)
{
@@ -2447,12 +2414,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *i
shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
- hr = d3d8_pixel_shader_init(object, This, byte_code, shader_handle);
+ hr = d3d8_pixel_shader_init(object, device, byte_code, shader_handle);
if (FAILED(hr))
{
WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
wined3d_mutex_lock();
- d3d8_free_handle(&This->handle_table, handle, D3D8_HANDLE_PS);
+ d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_PS);
wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, object);
*shader = 0;
@@ -2465,366 +2432,358 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *i
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(IDirect3DDevice8 *iface, DWORD pShader)
+static HRESULT WINAPI d3d8_device_SetPixelShader(IDirect3DDevice8 *iface, DWORD shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct d3d8_pixel_shader *shader;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_pixel_shader *shader_impl;
HRESULT hr;
- TRACE("iface %p, shader %#x.\n", iface, pShader);
+ TRACE("iface %p, shader %#x.\n", iface, shader);
wined3d_mutex_lock();
- if (!pShader)
+ if (!shader)
{
- hr = wined3d_device_set_pixel_shader(This->wined3d_device, NULL);
+ hr = wined3d_device_set_pixel_shader(device->wined3d_device, NULL);
wined3d_mutex_unlock();
return hr;
}
- shader = d3d8_get_object(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS);
- if (!shader)
+ if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
{
- WARN("Invalid handle (%#x) passed.\n", pShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- TRACE("(%p) : Setting shader %p\n", This, shader);
- hr = wined3d_device_set_pixel_shader(This->wined3d_device, shader->wined3d_shader);
+ TRACE("Setting shader %p.\n", shader_impl);
+ hr = wined3d_device_set_pixel_shader(device->wined3d_device, shader_impl->wined3d_shader);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *iface, DWORD *ppShader)
+static HRESULT WINAPI d3d8_device_GetPixelShader(IDirect3DDevice8 *iface, DWORD *shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_shader *object;
- TRACE("iface %p, shader %p.\n", iface, ppShader);
+ TRACE("iface %p, shader %p.\n", iface, shader);
- if (NULL == ppShader) {
- TRACE("(%p) Invalid call\n", This);
+ if (!shader)
return D3DERR_INVALIDCALL;
- }
wined3d_mutex_lock();
- object = wined3d_device_get_pixel_shader(This->wined3d_device);
- if (object)
+ if ((object = wined3d_device_get_pixel_shader(device->wined3d_device)))
{
struct d3d8_pixel_shader *d3d8_shader;
d3d8_shader = wined3d_shader_get_parent(object);
wined3d_shader_decref(object);
- *ppShader = d3d8_shader->handle;
+ *shader = d3d8_shader->handle;
}
else
{
- *ppShader = 0;
+ *shader = 0;
}
wined3d_mutex_unlock();
- TRACE("(%p) : returning %#x\n", This, *ppShader);
+ TRACE("Returning %#x.\n", *shader);
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(IDirect3DDevice8 *iface, DWORD pShader)
+static HRESULT WINAPI d3d8_device_DeletePixelShader(IDirect3DDevice8 *iface, DWORD shader)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct d3d8_pixel_shader *shader;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_pixel_shader *shader_impl;
struct wined3d_shader *cur;
- TRACE("iface %p, shader %#x.\n", iface, pShader);
+ TRACE("iface %p, shader %#x.\n", iface, shader);
wined3d_mutex_lock();
- shader = d3d8_free_handle(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS);
- if (!shader)
+ if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
{
- WARN("Invalid handle (%#x) passed.\n", pShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- cur = wined3d_device_get_pixel_shader(This->wined3d_device);
- if (cur)
+ if ((cur = wined3d_device_get_pixel_shader(device->wined3d_device)))
{
- if (cur == shader->wined3d_shader)
+ if (cur == shader_impl->wined3d_shader)
IDirect3DDevice8_SetPixelShader(iface, 0);
wined3d_shader_decref(cur);
}
wined3d_mutex_unlock();
- d3d8_pixel_shader_destroy(shader);
+ d3d8_pixel_shader_destroy(shader_impl);
return D3D_OK;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShaderConstant(IDirect3DDevice8 *iface,
- DWORD Register, const void *pConstantData, DWORD ConstantCount)
+static HRESULT WINAPI d3d8_device_SetPixelShaderConstant(IDirect3DDevice8 *iface,
+ DWORD start_register, const void *data, DWORD count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, register %u, data %p, count %u.\n",
- iface, Register, pConstantData, ConstantCount);
+ TRACE("iface %p, start_register %u, data %p, count %u.\n",
+ iface, start_register, data, count);
wined3d_mutex_lock();
- hr = wined3d_device_set_ps_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount);
+ hr = wined3d_device_set_ps_consts_f(device->wined3d_device, start_register, data, count);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderConstant(IDirect3DDevice8 *iface,
- DWORD Register, void *pConstantData, DWORD ConstantCount)
+static HRESULT WINAPI d3d8_device_GetPixelShaderConstant(IDirect3DDevice8 *iface,
+ DWORD start_register, void *data, DWORD count)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, register %u, data %p, count %u.\n",
- iface, Register, pConstantData, ConstantCount);
+ TRACE("iface %p, start_register %u, data %p, count %u.\n",
+ iface, start_register, data, count);
wined3d_mutex_lock();
- hr = wined3d_device_get_ps_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount);
+ hr = wined3d_device_get_ps_consts_f(device->wined3d_device, start_register, data, count);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(IDirect3DDevice8 *iface,
- DWORD pPixelShader, void *pData, DWORD *pSizeOfData)
+static HRESULT WINAPI d3d8_device_GetPixelShaderFunction(IDirect3DDevice8 *iface,
+ DWORD shader, void *data, DWORD *data_size)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- struct d3d8_pixel_shader *shader = NULL;
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_pixel_shader *shader_impl = NULL;
HRESULT hr;
TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
- iface, pPixelShader, pData, pSizeOfData);
+ iface, shader, data, data_size);
wined3d_mutex_lock();
- shader = d3d8_get_object(&This->handle_table, pPixelShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS);
- if (!shader)
+ if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
{
- WARN("Invalid handle (%#x) passed.\n", pPixelShader);
+ WARN("Invalid handle (%#x) passed.\n", shader);
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
- hr = wined3d_shader_get_byte_code(shader->wined3d_shader, pData, pSizeOfData);
+ hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, data_size);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawRectPatch(IDirect3DDevice8 *iface, UINT Handle,
- const float *pNumSegs, const D3DRECTPATCH_INFO *pRectPatchInfo)
+static HRESULT WINAPI d3d8_device_DrawRectPatch(IDirect3DDevice8 *iface, UINT handle,
+ const float *segment_count, const D3DRECTPATCH_INFO *patch_info)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n",
- iface, Handle, pNumSegs, pRectPatchInfo);
+ iface, handle, segment_count, patch_info);
wined3d_mutex_lock();
- hr = wined3d_device_draw_rect_patch(This->wined3d_device, Handle,
- pNumSegs, (const struct wined3d_rect_patch_info *)pRectPatchInfo);
+ hr = wined3d_device_draw_rect_patch(device->wined3d_device, handle,
+ segment_count, (const struct wined3d_rect_patch_info *)patch_info);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawTriPatch(IDirect3DDevice8 *iface, UINT Handle,
- const float *pNumSegs, const D3DTRIPATCH_INFO *pTriPatchInfo)
+static HRESULT WINAPI d3d8_device_DrawTriPatch(IDirect3DDevice8 *iface, UINT handle,
+ const float *segment_count, const D3DTRIPATCH_INFO *patch_info)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n",
- iface, Handle, pNumSegs, pTriPatchInfo);
+ iface, handle, segment_count, patch_info);
wined3d_mutex_lock();
- hr = wined3d_device_draw_tri_patch(This->wined3d_device, Handle,
- pNumSegs, (const struct wined3d_tri_patch_info *)pTriPatchInfo);
+ hr = wined3d_device_draw_tri_patch(device->wined3d_device, handle,
+ segment_count, (const struct wined3d_tri_patch_info *)patch_info);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DeletePatch(IDirect3DDevice8 *iface, UINT Handle)
+static HRESULT WINAPI d3d8_device_DeletePatch(IDirect3DDevice8 *iface, UINT handle)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
- TRACE("iface %p, handle %#x.\n", iface, Handle);
+ TRACE("iface %p, handle %#x.\n", iface, handle);
wined3d_mutex_lock();
- hr = wined3d_device_delete_patch(This->wined3d_device, Handle);
+ hr = wined3d_device_delete_patch(device->wined3d_device, handle);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *iface,
- UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData, UINT Stride)
+static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
+ UINT stream_idx, IDirect3DVertexBuffer8 *buffer, UINT stride)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
- IDirect3DVertexBuffer8Impl *streamdata = unsafe_impl_from_IDirect3DVertexBuffer8(pStreamData);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+ IDirect3DVertexBuffer8Impl *buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer8(buffer);
HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
- iface, StreamNumber, pStreamData, Stride);
+ iface, stream_idx, buffer, stride);
wined3d_mutex_lock();
- hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber,
- streamdata ? streamdata->wineD3DVertexBuffer : NULL, 0/* Offset in bytes */, Stride);
+ hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
+ buffer_impl ? buffer_impl->wineD3DVertexBuffer : NULL, 0, stride);
wined3d_mutex_unlock();
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *iface,
- UINT StreamNumber, IDirect3DVertexBuffer8 **pStream, UINT *pStride)
+static HRESULT WINAPI d3d8_device_GetStreamSource(IDirect3DDevice8 *iface,
+ UINT stream_idx, IDirect3DVertexBuffer8 **buffer, UINT *stride)
{
- IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
+ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DVertexBuffer8Impl *buffer_impl;
- struct wined3d_buffer *retStream = NULL;
+ struct wined3d_buffer *wined3d_buffer = NULL;
HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
- iface, StreamNumber, pStream, pStride);
+ iface, stream_idx, buffer, stride);
- if(pStream == NULL){
+ if (!buffer)
return D3DERR_INVALIDCALL;
- }
wined3d_mutex_lock();
- hr = wined3d_device_get_stream_source(This->wined3d_device, StreamNumber,
- &retStream, 0 /* Offset in bytes */, pStride);
- if (SUCCEEDED(hr) && retStream)
+ hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer, 0, stride);
+ if (SUCCEEDED(hr) && wined3d_buffer)
{
- buffer_impl = wined3d_buffer_get_parent(retStream);
- *pStream = &buffer_impl->IDirect3DVertexBuffer8_iface;
- IDirect3DVertexBuffer8_AddRef(*pStream);
- wined3d_buffer_decref(retStream);
+ buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
+ *buffer = &buffer_impl->IDirect3DVertexBuffer8_iface;
+ IDirect3DVertexBuffer8_AddRef(*buffer);
+ wined3d_buffer_decref(wined3d_buffer);
}
else
{
- if (FAILED(hr)) FIXME("Call to GetStreamSource failed, hr %#x.\n", hr);
- *pStream = NULL;
- }
- wined3d_mutex_unlock();
-
- return hr;
-}
-
-static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =
-{
- IDirect3DDevice8Impl_QueryInterface,
- IDirect3DDevice8Impl_AddRef,
- IDirect3DDevice8Impl_Release,
- IDirect3DDevice8Impl_TestCooperativeLevel,
- IDirect3DDevice8Impl_GetAvailableTextureMem,
- IDirect3DDevice8Impl_ResourceManagerDiscardBytes,
- IDirect3DDevice8Impl_GetDirect3D,
- IDirect3DDevice8Impl_GetDeviceCaps,
- IDirect3DDevice8Impl_GetDisplayMode,
- IDirect3DDevice8Impl_GetCreationParameters,
- IDirect3DDevice8Impl_SetCursorProperties,
- IDirect3DDevice8Impl_SetCursorPosition,
- IDirect3DDevice8Impl_ShowCursor,
- IDirect3DDevice8Impl_CreateAdditionalSwapChain,
- IDirect3DDevice8Impl_Reset,
- IDirect3DDevice8Impl_Present,
- IDirect3DDevice8Impl_GetBackBuffer,
- IDirect3DDevice8Impl_GetRasterStatus,
- IDirect3DDevice8Impl_SetGammaRamp,
- IDirect3DDevice8Impl_GetGammaRamp,
- IDirect3DDevice8Impl_CreateTexture,
- IDirect3DDevice8Impl_CreateVolumeTexture,
- IDirect3DDevice8Impl_CreateCubeTexture,
- IDirect3DDevice8Impl_CreateVertexBuffer,
- IDirect3DDevice8Impl_CreateIndexBuffer,
- IDirect3DDevice8Impl_CreateRenderTarget,
- IDirect3DDevice8Impl_CreateDepthStencilSurface,
- IDirect3DDevice8Impl_CreateImageSurface,
- IDirect3DDevice8Impl_CopyRects,
- IDirect3DDevice8Impl_UpdateTexture,
- IDirect3DDevice8Impl_GetFrontBuffer,
- IDirect3DDevice8Impl_SetRenderTarget,
- IDirect3DDevice8Impl_GetRenderTarget,
- IDirect3DDevice8Impl_GetDepthStencilSurface,
- IDirect3DDevice8Impl_BeginScene,
- IDirect3DDevice8Impl_EndScene,
- IDirect3DDevice8Impl_Clear,
- IDirect3DDevice8Impl_SetTransform,
- IDirect3DDevice8Impl_GetTransform,
- IDirect3DDevice8Impl_MultiplyTransform,
- IDirect3DDevice8Impl_SetViewport,
- IDirect3DDevice8Impl_GetViewport,
- IDirect3DDevice8Impl_SetMaterial,
- IDirect3DDevice8Impl_GetMaterial,
- IDirect3DDevice8Impl_SetLight,
- IDirect3DDevice8Impl_GetLight,
- IDirect3DDevice8Impl_LightEnable,
- IDirect3DDevice8Impl_GetLightEnable,
- IDirect3DDevice8Impl_SetClipPlane,
- IDirect3DDevice8Impl_GetClipPlane,
- IDirect3DDevice8Impl_SetRenderState,
- IDirect3DDevice8Impl_GetRenderState,
- IDirect3DDevice8Impl_BeginStateBlock,
- IDirect3DDevice8Impl_EndStateBlock,
- IDirect3DDevice8Impl_ApplyStateBlock,
- IDirect3DDevice8Impl_CaptureStateBlock,
- IDirect3DDevice8Impl_DeleteStateBlock,
- IDirect3DDevice8Impl_CreateStateBlock,
- IDirect3DDevice8Impl_SetClipStatus,
- IDirect3DDevice8Impl_GetClipStatus,
- IDirect3DDevice8Impl_GetTexture,
- IDirect3DDevice8Impl_SetTexture,
- IDirect3DDevice8Impl_GetTextureStageState,
- IDirect3DDevice8Impl_SetTextureStageState,
- IDirect3DDevice8Impl_ValidateDevice,
- IDirect3DDevice8Impl_GetInfo,
- IDirect3DDevice8Impl_SetPaletteEntries,
- IDirect3DDevice8Impl_GetPaletteEntries,
- IDirect3DDevice8Impl_SetCurrentTexturePalette,
- IDirect3DDevice8Impl_GetCurrentTexturePalette,
- IDirect3DDevice8Impl_DrawPrimitive,
- IDirect3DDevice8Impl_DrawIndexedPrimitive,
- IDirect3DDevice8Impl_DrawPrimitiveUP,
- IDirect3DDevice8Impl_DrawIndexedPrimitiveUP,
- IDirect3DDevice8Impl_ProcessVertices,
- IDirect3DDevice8Impl_CreateVertexShader,
- IDirect3DDevice8Impl_SetVertexShader,
- IDirect3DDevice8Impl_GetVertexShader,
- IDirect3DDevice8Impl_DeleteVertexShader,
- IDirect3DDevice8Impl_SetVertexShaderConstant,
- IDirect3DDevice8Impl_GetVertexShaderConstant,
- IDirect3DDevice8Impl_GetVertexShaderDeclaration,
- IDirect3DDevice8Impl_GetVertexShaderFunction,
- IDirect3DDevice8Impl_SetStreamSource,
- IDirect3DDevice8Impl_GetStreamSource,
- IDirect3DDevice8Impl_SetIndices,
- IDirect3DDevice8Impl_GetIndices,
- IDirect3DDevice8Impl_CreatePixelShader,
- IDirect3DDevice8Impl_SetPixelShader,
- IDirect3DDevice8Impl_GetPixelShader,
- IDirect3DDevice8Impl_DeletePixelShader,
- IDirect3DDevice8Impl_SetPixelShaderConstant,
- IDirect3DDevice8Impl_GetPixelShaderConstant,
- IDirect3DDevice8Impl_GetPixelShaderFunction,
- IDirect3DDevice8Impl_DrawRectPatch,
- IDirect3DDevice8Impl_DrawTriPatch,
- IDirect3DDevice8Impl_DeletePatch
+ if (FAILED(hr))
+ ERR("Failed to get wined3d stream source, hr %#x.\n", hr);
+ *buffer = NULL;
+ }
+ wined3d_mutex_unlock();
+
+ return hr;
+}
+
+static const struct IDirect3DDevice8Vtbl d3d8_device_vtbl =
+{
+ d3d8_device_QueryInterface,
+ d3d8_device_AddRef,
+ d3d8_device_Release,
+ d3d8_device_TestCooperativeLevel,
+ d3d8_device_GetAvailableTextureMem,
+ d3d8_device_ResourceManagerDiscardBytes,
+ d3d8_device_GetDirect3D,
+ d3d8_device_GetDeviceCaps,
+ d3d8_device_GetDisplayMode,
+ d3d8_device_GetCreationParameters,
+ d3d8_device_SetCursorProperties,
+ d3d8_device_SetCursorPosition,
+ d3d8_device_ShowCursor,
+ d3d8_device_CreateAdditionalSwapChain,
+ d3d8_device_Reset,
+ d3d8_device_Present,
+ d3d8_device_GetBackBuffer,
+ d3d8_device_GetRasterStatus,
+ d3d8_device_SetGammaRamp,
+ d3d8_device_GetGammaRamp,
+ d3d8_device_CreateTexture,
+ d3d8_device_CreateVolumeTexture,
+ d3d8_device_CreateCubeTexture,
+ d3d8_device_CreateVertexBuffer,
+ d3d8_device_CreateIndexBuffer,
+ d3d8_device_CreateRenderTarget,
+ d3d8_device_CreateDepthStencilSurface,
+ d3d8_device_CreateImageSurface,
+ d3d8_device_CopyRects,
+ d3d8_device_UpdateTexture,
+ d3d8_device_GetFrontBuffer,
+ d3d8_device_SetRenderTarget,
+ d3d8_device_GetRenderTarget,
+ d3d8_device_GetDepthStencilSurface,
+ d3d8_device_BeginScene,
+ d3d8_device_EndScene,
+ d3d8_device_Clear,
+ d3d8_device_SetTransform,
+ d3d8_device_GetTransform,
+ d3d8_device_MultiplyTransform,
+ d3d8_device_SetViewport,
+ d3d8_device_GetViewport,
+ d3d8_device_SetMaterial,
+ d3d8_device_GetMaterial,
+ d3d8_device_SetLight,
+ d3d8_device_GetLight,
+ d3d8_device_LightEnable,
+ d3d8_device_GetLightEnable,
+ d3d8_device_SetClipPlane,
+ d3d8_device_GetClipPlane,
+ d3d8_device_SetRenderState,
+ d3d8_device_GetRenderState,
+ d3d8_device_BeginStateBlock,
+ d3d8_device_EndStateBlock,
+ d3d8_device_ApplyStateBlock,
+ d3d8_device_CaptureStateBlock,
+ d3d8_device_DeleteStateBlock,
+ d3d8_device_CreateStateBlock,
+ d3d8_device_SetClipStatus,
+ d3d8_device_GetClipStatus,
+ d3d8_device_GetTexture,
+ d3d8_device_SetTexture,
+ d3d8_device_GetTextureStageState,
+ d3d8_device_SetTextureStageState,
+ d3d8_device_ValidateDevice,
+ d3d8_device_GetInfo,
+ d3d8_device_SetPaletteEntries,
+ d3d8_device_GetPaletteEntries,
+ d3d8_device_SetCurrentTexturePalette,
+ d3d8_device_GetCurrentTexturePalette,
+ d3d8_device_DrawPrimitive,
+ d3d8_device_DrawIndexedPrimitive,
+ d3d8_device_DrawPrimitiveUP,
+ d3d8_device_DrawIndexedPrimitiveUP,
+ d3d8_device_ProcessVertices,
+ d3d8_device_CreateVertexShader,
+ d3d8_device_SetVertexShader,
+ d3d8_device_GetVertexShader,
+ d3d8_device_DeleteVertexShader,
+ d3d8_device_SetVertexShaderConstant,
+ d3d8_device_GetVertexShaderConstant,
+ d3d8_device_GetVertexShaderDeclaration,
+ d3d8_device_GetVertexShaderFunction,
+ d3d8_device_SetStreamSource,
+ d3d8_device_GetStreamSource,
+ d3d8_device_SetIndices,
+ d3d8_device_GetIndices,
+ d3d8_device_CreatePixelShader,
+ d3d8_device_SetPixelShader,
+ d3d8_device_GetPixelShader,
+ d3d8_device_DeletePixelShader,
+ d3d8_device_SetPixelShaderConstant,
+ d3d8_device_GetPixelShaderConstant,
+ d3d8_device_GetPixelShaderFunction,
+ d3d8_device_DrawRectPatch,
+ d3d8_device_DrawTriPatch,
+ d3d8_device_DeletePatch,
};
-static inline IDirect3DDevice8Impl *device_from_device_parent(struct wined3d_device_parent *device_parent)
+static inline struct d3d8_device *device_from_device_parent(struct wined3d_device_parent *device_parent)
{
- return CONTAINING_RECORD(device_parent, IDirect3DDevice8Impl, device_parent);
+ return CONTAINING_RECORD(device_parent, struct d3d8_device, device_parent);
}
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
@@ -2842,7 +2801,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
{
- IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
+ struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DSurface8Impl *d3d_surface;
BOOL lockable = TRUE;
HRESULT hr;
@@ -2855,7 +2814,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
if (pool == WINED3D_POOL_DEFAULT && !(usage & WINED3DUSAGE_DYNAMIC))
lockable = FALSE;
- hr = IDirect3DDevice8Impl_CreateSurface(device, width, height,
+ hr = d3d8_device_CreateSurface(device, width, height,
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
(IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
if (FAILED(hr))
@@ -2882,7 +2841,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
enum wined3d_multisample_type multisample_type, DWORD multisample_quality, BOOL lockable,
struct wined3d_surface **surface)
{
- IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
+ struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DSurface8Impl *d3d_surface;
HRESULT hr;
@@ -2913,7 +2872,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
{
- IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
+ struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DSurface8Impl *d3d_surface;
HRESULT hr;
@@ -2943,7 +2902,7 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
{
- IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
+ struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DVolume8Impl *object;
HRESULT hr;
@@ -2984,7 +2943,7 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
{
- IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
+ struct d3d8_device *device = device_from_device_parent(device_parent);
D3DPRESENT_PARAMETERS local_parameters;
IDirect3DSwapChain8 *d3d_swapchain;
HRESULT hr;
@@ -3065,13 +3024,13 @@ static void setup_fpu(void)
#endif
}
-HRESULT device_init(IDirect3DDevice8Impl *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter,
+HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter,
D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters)
{
struct wined3d_swapchain_desc swapchain_desc;
HRESULT hr;
- device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl;
+ device->IDirect3DDevice8_iface.lpVtbl = &d3d8_device_vtbl;
device->device_parent.ops = &d3d8_wined3d_device_parent_ops;
device->ref = 1;
device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index 7eee9fa..224a063 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -343,7 +343,7 @@ static HRESULT WINAPI d3d8_CreateDevice(IDirect3D8 *iface, UINT adapter,
IDirect3DDevice8 **device)
{
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
- IDirect3DDevice8Impl *object;
+ struct d3d8_device *object;
HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, device %p.\n",
diff --git a/dlls/d3d8/shader.c b/dlls/d3d8/shader.c
index 546bf40..db36120 100644
--- a/dlls/d3d8/shader.c
+++ b/dlls/d3d8/shader.c
@@ -50,7 +50,7 @@ static const struct wined3d_parent_ops d3d8_vertexshader_wined3d_parent_ops =
d3d8_vertexshader_wined3d_object_destroyed,
};
-static HRESULT d3d8_vertexshader_create_vertexdeclaration(IDirect3DDevice8Impl *device,
+static HRESULT d3d8_vertexshader_create_vertexdeclaration(struct d3d8_device *device,
const DWORD *declaration, DWORD shader_handle, struct d3d8_vertex_declaration **decl_ptr)
{
struct d3d8_vertex_declaration *object;
@@ -80,7 +80,7 @@ static HRESULT d3d8_vertexshader_create_vertexdeclaration(IDirect3DDevice8Impl *
return D3D_OK;
}
-HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, IDirect3DDevice8Impl *device,
+HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_device *device,
const DWORD *declaration, const DWORD *byte_code, DWORD shader_handle, DWORD usage)
{
const DWORD *token = declaration;
@@ -152,7 +152,7 @@ static const struct wined3d_parent_ops d3d8_pixelshader_wined3d_parent_ops =
d3d8_pixelshader_wined3d_object_destroyed,
};
-HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, IDirect3DDevice8Impl *device,
+HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_device *device,
const DWORD *byte_code, DWORD shader_handle)
{
HRESULT hr;
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 7b887e3..89597f0 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -320,7 +320,7 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops =
surface_wined3d_object_destroyed,
};
-HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *device,
+HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device,
UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality)
{
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c
index 9d2da09..fa6aa0b 100644
--- a/dlls/d3d8/swapchain.c
+++ b/dlls/d3d8/swapchain.c
@@ -150,7 +150,7 @@ static const struct wined3d_parent_ops d3d8_swapchain_wined3d_parent_ops =
d3d8_swapchain_wined3d_object_released,
};
-HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl *device,
+HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, struct d3d8_device *device,
D3DPRESENT_PARAMETERS *present_parameters)
{
struct wined3d_swapchain_desc desc;
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index 2720fe2..49605d2 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -1157,7 +1157,7 @@ static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops =
d3d8_texture_wined3d_object_destroyed,
};
-HRESULT texture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
+HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{
HRESULT hr;
@@ -1182,7 +1182,7 @@ HRESULT texture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
return D3D_OK;
}
-HRESULT cubetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
+HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *device,
UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{
HRESULT hr;
@@ -1207,7 +1207,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *dev
return D3D_OK;
}
-HRESULT volumetexture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
+HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *device,
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{
HRESULT hr;
diff --git a/dlls/d3d8/vertexdeclaration.c b/dlls/d3d8/vertexdeclaration.c
index 9ca2870..3675deb 100644
--- a/dlls/d3d8/vertexdeclaration.c
+++ b/dlls/d3d8/vertexdeclaration.c
@@ -331,7 +331,7 @@ static const struct wined3d_parent_ops d3d8_vertexdeclaration_wined3d_parent_ops
};
HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration,
- IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle)
+ struct d3d8_device *device, const DWORD *elements, DWORD shader_handle)
{
struct wined3d_vertex_element *wined3d_elements;
UINT wined3d_element_count;
@@ -366,7 +366,7 @@ HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration
}
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration,
- IDirect3DDevice8Impl *device, DWORD fvf)
+ struct d3d8_device *device, DWORD fvf)
{
HRESULT hr;
diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c
index 2c5c5d6..d622198 100644
--- a/dlls/d3d8/volume.c
+++ b/dlls/d3d8/volume.c
@@ -279,7 +279,7 @@ static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops =
volume_wined3d_object_destroyed,
};
-HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, UINT width, UINT height,
+HRESULT volume_init(IDirect3DVolume8Impl *volume, struct d3d8_device *device, UINT width, UINT height,
UINT depth, DWORD usage, enum wined3d_format_id format, enum wined3d_pool pool)
{
HRESULT hr;
--
1.7.3.4
More information about the wine-patches
mailing list