diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index b32e9efa0f4..d9a8d4b4c09 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c @@ -23,42 +23,42 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -static inline IDirect3DVertexBuffer9Impl *impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) +static inline struct d3d9_vertexbuffer *impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) { - return CONTAINING_RECORD(iface, IDirect3DVertexBuffer9Impl, IDirect3DVertexBuffer9_iface); + return CONTAINING_RECORD(iface, struct d3d9_vertexbuffer, IDirect3DVertexBuffer9_iface); } -static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface(IDirect3DVertexBuffer9 *iface, REFIID riid, void **object) +static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface(IDirect3DVertexBuffer9 *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_IDirect3DVertexBuffer9) || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IUnknown)) { IDirect3DVertexBuffer9_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_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); - ULONG refcount = InterlockedIncrement(&buffer->ref); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); + ULONG refcount = InterlockedIncrement(&buffer->refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); if (refcount == 1) { - IDirect3DDevice9Ex_AddRef(buffer->parentDevice); + IDirect3DDevice9Ex_AddRef(buffer->parent_device); wined3d_mutex_lock(); - wined3d_buffer_incref(buffer->wineD3DVertexBuffer); + wined3d_buffer_incref(buffer->wined3d_buffer); wined3d_mutex_unlock(); } @@ -67,17 +67,17 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); - ULONG refcount = InterlockedDecrement(&buffer->ref); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); + ULONG refcount = InterlockedDecrement(&buffer->refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) { - IDirect3DDevice9Ex *device = buffer->parentDevice; + IDirect3DDevice9Ex *device = buffer->parent_device; wined3d_mutex_lock(); - wined3d_buffer_decref(buffer->wineD3DVertexBuffer); + wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -87,14 +87,13 @@ static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface) return refcount; } -static HRESULT WINAPI d3d9_vertexbuffer_GetDevice(IDirect3DVertexBuffer9 *iface, - IDirect3DDevice9 **device) +static HRESULT WINAPI d3d9_vertexbuffer_GetDevice(IDirect3DVertexBuffer9 *iface, IDirect3DDevice9 **device) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); TRACE("iface %p, device %p.\n", iface, device); - *device = (IDirect3DDevice9 *)buffer->parentDevice; + *device = (IDirect3DDevice9 *)buffer->parent_device; IDirect3DDevice9_AddRef(*device); TRACE("Returning device %p.\n", *device); @@ -105,7 +104,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDevice(IDirect3DVertexBuffer9 *iface, static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); struct wined3d_resource *resource; HRESULT hr; @@ -113,7 +112,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *i iface, debugstr_guid(guid), data, data_size, flags); wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); wined3d_mutex_unlock(); @@ -123,7 +122,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *i static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); struct wined3d_resource *resource; HRESULT hr; @@ -131,7 +130,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *i iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); hr = wined3d_resource_get_private_data(resource, guid, data, data_size); wined3d_mutex_unlock(); @@ -140,14 +139,14 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *i static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); hr = wined3d_resource_free_private_data(resource, guid); wined3d_mutex_unlock(); @@ -156,13 +155,13 @@ static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 * static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, DWORD priority) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); DWORD previous; TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); - previous = wined3d_buffer_set_priority(buffer->wineD3DVertexBuffer, priority); + previous = wined3d_buffer_set_priority(buffer->wined3d_buffer, priority); wined3d_mutex_unlock(); return previous; @@ -170,13 +169,13 @@ static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, static DWORD WINAPI d3d9_vertexbuffer_GetPriority(IDirect3DVertexBuffer9 *iface) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); DWORD priority; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - priority = wined3d_buffer_get_priority(buffer->wineD3DVertexBuffer); + priority = wined3d_buffer_get_priority(buffer->wined3d_buffer); wined3d_mutex_unlock(); return priority; @@ -184,12 +183,12 @@ static DWORD WINAPI d3d9_vertexbuffer_GetPriority(IDirect3DVertexBuffer9 *iface) static void WINAPI d3d9_vertexbuffer_PreLoad(IDirect3DVertexBuffer9 *iface) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - wined3d_buffer_preload(buffer->wineD3DVertexBuffer); + wined3d_buffer_preload(buffer->wined3d_buffer); wined3d_mutex_unlock(); } @@ -203,14 +202,14 @@ static D3DRESOURCETYPE WINAPI d3d9_vertexbuffer_GetType(IDirect3DVertexBuffer9 * static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, UINT offset, UINT size, void **data, DWORD flags) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); HRESULT hr; TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n", iface, offset, size, data, flags); wined3d_mutex_lock(); - hr = wined3d_buffer_map(buffer->wineD3DVertexBuffer, offset, size, (BYTE **)data, flags); + hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, (BYTE **)data, flags); wined3d_mutex_unlock(); return hr; @@ -218,12 +217,12 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, UINT static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - wined3d_buffer_unmap(buffer->wineD3DVertexBuffer); + wined3d_buffer_unmap(buffer->wined3d_buffer); wined3d_mutex_unlock(); return D3D_OK; @@ -232,14 +231,14 @@ static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface) static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, D3DVERTEXBUFFER_DESC *desc) { - IDirect3DVertexBuffer9Impl *buffer = impl_from_IDirect3DVertexBuffer9(iface); + struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); struct wined3d_resource_desc wined3d_desc; struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); @@ -284,18 +283,18 @@ static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops = d3d9_vertexbuffer_wined3d_object_destroyed, }; -HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, struct d3d9_device *device, +HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *device, UINT size, UINT usage, DWORD fvf, D3DPOOL pool) { HRESULT hr; buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl; - buffer->ref = 1; + buffer->refcount = 1; buffer->fvf = fvf; wined3d_mutex_lock(); hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, - (enum wined3d_pool)pool, buffer, &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer); + (enum wined3d_pool)pool, buffer, &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -303,13 +302,13 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, struct d3d9_device return hr; } - buffer->parentDevice = &device->IDirect3DDevice9Ex_iface; - IDirect3DDevice9Ex_AddRef(buffer->parentDevice); + buffer->parent_device = &device->IDirect3DDevice9Ex_iface; + IDirect3DDevice9Ex_AddRef(buffer->parent_device); return D3D_OK; } -IDirect3DVertexBuffer9Impl *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) +struct d3d9_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) { if (!iface) return NULL; diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 93760ee207a..3fb6781496b 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -203,25 +203,18 @@ HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN; -/* ---------------------- */ -/* IDirect3DVertexBuffer9 */ -/* ---------------------- */ - -/***************************************************************************** - * IDirect3DVertexBuffer9 implementation structure - */ -typedef struct IDirect3DVertexBuffer9Impl +struct d3d9_vertexbuffer { IDirect3DVertexBuffer9 IDirect3DVertexBuffer9_iface; - LONG ref; - struct wined3d_buffer *wineD3DVertexBuffer; - IDirect3DDevice9Ex *parentDevice; + LONG refcount; + struct wined3d_buffer *wined3d_buffer; + IDirect3DDevice9Ex *parent_device; DWORD fvf; -} IDirect3DVertexBuffer9Impl; +}; -HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, struct d3d9_device *device, +HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *device, UINT size, UINT usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN; -IDirect3DVertexBuffer9Impl *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) DECLSPEC_HIDDEN; +struct d3d9_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) DECLSPEC_HIDDEN; /* --------------------- */ /* IDirect3DIndexBuffer9 */ diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 1c86729bf7a..3237e7ee66a 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -796,7 +796,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface, HANDLE *shared_handle) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - IDirect3DVertexBuffer9Impl *object; + struct d3d9_vertexbuffer *object; HRESULT hr; TRACE("iface %p, size %u, usage %#x, fvf %#x, pool %#x, buffer %p, shared_handle %p.\n", @@ -2018,7 +2018,7 @@ static HRESULT WINAPI d3d9_device_ProcessVertices(IDirect3DDevice9Ex *iface, IDirect3DVertexDeclaration9 *declaration, DWORD flags) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - IDirect3DVertexBuffer9Impl *dst_impl = unsafe_impl_from_IDirect3DVertexBuffer9(dst_buffer); + struct d3d9_vertexbuffer *dst_impl = unsafe_impl_from_IDirect3DVertexBuffer9(dst_buffer); IDirect3DVertexDeclaration9Impl *decl_impl = unsafe_impl_from_IDirect3DVertexDeclaration9(declaration); HRESULT hr; @@ -2027,7 +2027,7 @@ static HRESULT WINAPI d3d9_device_ProcessVertices(IDirect3DDevice9Ex *iface, wined3d_mutex_lock(); hr = wined3d_device_process_vertices(device->wined3d_device, src_start_idx, dst_idx, vertex_count, - dst_impl->wineD3DVertexBuffer, decl_impl ? decl_impl->wineD3DVertexDeclaration : NULL, + dst_impl->wined3d_buffer, decl_impl ? decl_impl->wineD3DVertexDeclaration : NULL, flags, dst_impl->fvf); wined3d_mutex_unlock(); @@ -2418,7 +2418,7 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface, UINT stream_idx, IDirect3DVertexBuffer9 *buffer, UINT offset, UINT stride) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - IDirect3DVertexBuffer9Impl *buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer9(buffer); + struct d3d9_vertexbuffer *buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer9(buffer); HRESULT hr; TRACE("iface %p, stream_idx %u, buffer %p, offset %u, stride %u.\n", @@ -2426,7 +2426,7 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface, wined3d_mutex_lock(); hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx, - buffer_impl ? buffer_impl->wineD3DVertexBuffer : NULL, offset, stride); + buffer_impl ? buffer_impl->wined3d_buffer : NULL, offset, stride); wined3d_mutex_unlock(); return hr; @@ -2436,7 +2436,7 @@ static HRESULT WINAPI d3d9_device_GetStreamSource(IDirect3DDevice9Ex *iface, UINT stream_idx, IDirect3DVertexBuffer9 **buffer, UINT *offset, UINT *stride) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - IDirect3DVertexBuffer9Impl *buffer_impl; + struct d3d9_vertexbuffer *buffer_impl; struct wined3d_buffer *wined3d_buffer; HRESULT hr;