[PATCH 1/5] d3d9: Get rid of IDirect3DVertexShader9Impl.
Henri Verbeet
hverbeet at codeweavers.com
Tue Jun 12 10:03:46 CDT 2012
---
dlls/d3d9/d3d9_private.h | 24 +++++++++---------------
dlls/d3d9/device.c | 6 +++---
dlls/d3d9/shader.c | 43 +++++++++++++++++++++----------------------
3 files changed, 33 insertions(+), 40 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index f386eb5..d1d177d 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -272,23 +272,17 @@ HRESULT d3d9_vertex_declaration_create(struct d3d9_device *device,
struct d3d9_vertex_declaration *unsafe_impl_from_IDirect3DVertexDeclaration9(
IDirect3DVertexDeclaration9 *iface) DECLSPEC_HIDDEN;
-/* ---------------------- */
-/* IDirect3DVertexShader9 */
-/* ---------------------- */
+struct d3d9_vertexshader
+{
+ IDirect3DVertexShader9 IDirect3DVertexShader9_iface;
+ LONG refcount;
+ struct wined3d_shader *wined3d_shader;
+ IDirect3DDevice9Ex *parent_device;
+};
-/*****************************************************************************
- * IDirect3DVertexShader implementation structure
- */
-typedef struct IDirect3DVertexShader9Impl {
- IDirect3DVertexShader9 IDirect3DVertexShader9_iface;
- LONG ref;
- struct wined3d_shader *wined3d_shader;
- IDirect3DDevice9Ex *parentDevice;
-} IDirect3DVertexShader9Impl;
-
-HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader,
+HRESULT vertexshader_init(struct d3d9_vertexshader *shader,
struct d3d9_device *device, const DWORD *byte_code) DECLSPEC_HIDDEN;
-IDirect3DVertexShader9Impl *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface) DECLSPEC_HIDDEN;
+struct d3d9_vertexshader *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface) DECLSPEC_HIDDEN;
#define D3D9_MAX_VERTEX_SHADER_CONSTANTF 256
#define D3D9_MAX_SIMULTANEOUS_RENDERTARGETS 4
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 80349cd..2e5eb3d 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2240,7 +2240,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface,
const DWORD *byte_code, IDirect3DVertexShader9 **shader)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
- IDirect3DVertexShader9Impl *object;
+ struct d3d9_vertexshader *object;
HRESULT hr;
TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader);
@@ -2269,7 +2269,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface,
static HRESULT WINAPI d3d9_device_SetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 *shader)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
- IDirect3DVertexShader9Impl *shader_obj = unsafe_impl_from_IDirect3DVertexShader9(shader);
+ struct d3d9_vertexshader *shader_obj = unsafe_impl_from_IDirect3DVertexShader9(shader);
HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, shader);
@@ -2285,7 +2285,7 @@ static HRESULT WINAPI d3d9_device_SetVertexShader(IDirect3DDevice9Ex *iface, IDi
static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 **shader)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
- IDirect3DVertexShader9Impl *shader_impl;
+ struct d3d9_vertexshader *shader_impl;
struct wined3d_shader *wined3d_shader;
TRACE("iface %p, shader %p.\n", iface, shader);
diff --git a/dlls/d3d9/shader.c b/dlls/d3d9/shader.c
index b4d8a3d..7020d15 100644
--- a/dlls/d3d9/shader.c
+++ b/dlls/d3d9/shader.c
@@ -22,39 +22,39 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
-static inline IDirect3DVertexShader9Impl *impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
+static inline struct d3d9_vertexshader *impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
{
- return CONTAINING_RECORD(iface, IDirect3DVertexShader9Impl, IDirect3DVertexShader9_iface);
+ return CONTAINING_RECORD(iface, struct d3d9_vertexshader, IDirect3DVertexShader9_iface);
}
-static HRESULT WINAPI d3d9_vertexshader_QueryInterface(IDirect3DVertexShader9 *iface, REFIID riid, void **object)
+static HRESULT WINAPI d3d9_vertexshader_QueryInterface(IDirect3DVertexShader9 *iface, REFIID riid, void **out)
{
- TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
+ TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DVertexShader9)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IDirect3DVertexShader9_AddRef(iface);
- *object = iface;
+ *out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
- *object = NULL;
+ *out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI d3d9_vertexshader_AddRef(IDirect3DVertexShader9 *iface)
{
- IDirect3DVertexShader9Impl *shader = impl_from_IDirect3DVertexShader9(iface);
- ULONG refcount = InterlockedIncrement(&shader->ref);
+ struct d3d9_vertexshader *shader = impl_from_IDirect3DVertexShader9(iface);
+ ULONG refcount = InterlockedIncrement(&shader->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
if (refcount == 1)
{
- IDirect3DDevice9Ex_AddRef(shader->parentDevice);
+ IDirect3DDevice9Ex_AddRef(shader->parent_device);
wined3d_mutex_lock();
wined3d_shader_incref(shader->wined3d_shader);
wined3d_mutex_unlock();
@@ -65,14 +65,14 @@ static ULONG WINAPI d3d9_vertexshader_AddRef(IDirect3DVertexShader9 *iface)
static ULONG WINAPI d3d9_vertexshader_Release(IDirect3DVertexShader9 *iface)
{
- IDirect3DVertexShader9Impl *shader = impl_from_IDirect3DVertexShader9(iface);
- ULONG refcount = InterlockedDecrement(&shader->ref);
+ struct d3d9_vertexshader *shader = impl_from_IDirect3DVertexShader9(iface);
+ ULONG refcount = InterlockedDecrement(&shader->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
{
- IDirect3DDevice9Ex *device = shader->parentDevice;
+ IDirect3DDevice9Ex *device = shader->parent_device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader);
@@ -87,11 +87,11 @@ static ULONG WINAPI d3d9_vertexshader_Release(IDirect3DVertexShader9 *iface)
static HRESULT WINAPI d3d9_vertexshader_GetDevice(IDirect3DVertexShader9 *iface, IDirect3DDevice9 **device)
{
- IDirect3DVertexShader9Impl *shader = impl_from_IDirect3DVertexShader9(iface);
+ struct d3d9_vertexshader *shader = impl_from_IDirect3DVertexShader9(iface);
TRACE("iface %p, device %p.\n", iface, device);
- *device = (IDirect3DDevice9 *)shader->parentDevice;
+ *device = (IDirect3DDevice9 *)shader->parent_device;
IDirect3DDevice9_AddRef(*device);
TRACE("Returning device %p.\n", *device);
@@ -99,10 +99,9 @@ static HRESULT WINAPI d3d9_vertexshader_GetDevice(IDirect3DVertexShader9 *iface,
return D3D_OK;
}
-static HRESULT WINAPI d3d9_vertexshader_GetFunction(IDirect3DVertexShader9 *iface,
- void *data, UINT *data_size)
+static HRESULT WINAPI d3d9_vertexshader_GetFunction(IDirect3DVertexShader9 *iface, void *data, UINT *data_size)
{
- IDirect3DVertexShader9Impl *shader = impl_from_IDirect3DVertexShader9(iface);
+ struct d3d9_vertexshader *shader = impl_from_IDirect3DVertexShader9(iface);
HRESULT hr;
TRACE("iface %p, data %p, data_size %p.\n", iface, data, data_size);
@@ -135,11 +134,11 @@ static const struct wined3d_parent_ops d3d9_vertexshader_wined3d_parent_ops =
d3d9_vertexshader_wined3d_object_destroyed,
};
-HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, struct d3d9_device *device, const DWORD *byte_code)
+HRESULT vertexshader_init(struct d3d9_vertexshader *shader, struct d3d9_device *device, const DWORD *byte_code)
{
HRESULT hr;
- shader->ref = 1;
+ shader->refcount = 1;
shader->IDirect3DVertexShader9_iface.lpVtbl = &d3d9_vertexshader_vtbl;
wined3d_mutex_lock();
@@ -152,13 +151,13 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, struct d3d9_device
return hr;
}
- shader->parentDevice = &device->IDirect3DDevice9Ex_iface;
- IDirect3DDevice9Ex_AddRef(shader->parentDevice);
+ shader->parent_device = &device->IDirect3DDevice9Ex_iface;
+ IDirect3DDevice9Ex_AddRef(shader->parent_device);
return D3D_OK;
}
-IDirect3DVertexShader9Impl *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
+struct d3d9_vertexshader *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
{
if (!iface)
return NULL;
--
1.7.3.4
More information about the wine-patches
mailing list