Commit 2c450571 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove COM from the volume implementation.

parent 44c52c16
......@@ -1446,7 +1446,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
{
HRESULT hr;
......
......@@ -363,7 +363,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
hr = E_INVALIDARG;
else if (SUCCEEDED(hr = IWineD3DVolume_Map(wined3d_volume_from_resource(sub_resource),
else if (SUCCEEDED(hr = wined3d_volume_map(wined3d_volume_from_resource(sub_resource),
&wined3d_map_desc, NULL, 0)))
{
mapped_texture->pData = wined3d_map_desc.pBits;
......@@ -384,7 +384,7 @@ static void STDMETHODCALLTYPE d3d10_texture3d_Unmap(ID3D10Texture3D *iface, UINT
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
return;
IWineD3DVolume_Unmap(wined3d_volume_from_resource(sub_resource));
wined3d_volume_unmap(wined3d_volume_from_resource(sub_resource));
}
static void STDMETHODCALLTYPE d3d10_texture3d_GetDesc(ID3D10Texture3D *iface, D3D10_TEXTURE3D_DESC *desc)
......
......@@ -203,15 +203,9 @@ struct IDirect3DVolume8Impl
{
IDirect3DVolume8 IDirect3DVolume8_iface;
LONG ref;
/* IDirect3DVolume8 fields */
IWineD3DVolume *wineD3DVolume;
/* The volume container */
IUnknown *container;
/* If set forward refcounting to this object */
IUnknown *forwardReference;
struct wined3d_volume *wined3d_volume;
IUnknown *container;
IUnknown *forwardReference;
};
HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, UINT width, UINT height,
......
......@@ -2861,7 +2861,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
{
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
IDirect3DVolume8Impl *object;
......@@ -2887,8 +2887,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
return hr;
}
*volume = object->wineD3DVolume;
IWineD3DVolume_AddRef(*volume);
*volume = object->wined3d_volume;
wined3d_volume_incref(*volume);
IDirect3DVolume8_Release(&object->IDirect3DVolume8_iface);
object->container = container_parent;
......
......@@ -66,7 +66,7 @@ static ULONG WINAPI IDirect3DVolume8Impl_AddRef(IDirect3DVolume8 *iface)
if (ref == 1)
{
wined3d_mutex_lock();
IWineD3DVolume_AddRef(This->wineD3DVolume);
wined3d_volume_incref(This->wined3d_volume);
wined3d_mutex_unlock();
}
......@@ -93,7 +93,7 @@ static ULONG WINAPI IDirect3DVolume8Impl_Release(IDirect3DVolume8 *iface)
if (ref == 0) {
wined3d_mutex_lock();
IWineD3DVolume_Release(This->wineD3DVolume);
wined3d_volume_decref(This->wined3d_volume);
wined3d_mutex_unlock();
}
......@@ -132,7 +132,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(IDirect3DVolume8 *ifac
iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
wined3d_mutex_lock();
hr = IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags);
hr = wined3d_volume_set_private_data(This->wined3d_volume, refguid, pData, SizeOfData, Flags);
wined3d_mutex_unlock();
return hr;
......@@ -148,7 +148,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(IDirect3DVolume8 *ifac
iface, debugstr_guid(refguid), pData, pSizeOfData);
wined3d_mutex_lock();
hr = IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData);
hr = wined3d_volume_get_private_data(This->wined3d_volume, refguid, pData, pSizeOfData);
wined3d_mutex_unlock();
return hr;
......@@ -162,7 +162,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(IDirect3DVolume8 *ifa
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
wined3d_mutex_lock();
hr = IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid);
hr = wined3d_volume_free_private_data(This->wined3d_volume, refguid);
wined3d_mutex_unlock();
return hr;
......@@ -195,7 +195,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(IDirect3DVolume8 *iface, D3DV
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_resource = IWineD3DVolume_GetResource(This->wineD3DVolume);
wined3d_resource = wined3d_volume_get_resource(This->wined3d_volume);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
......@@ -221,7 +221,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_LockBox(IDirect3DVolume8 *iface,
iface, pLockedVolume, pBox, Flags);
wined3d_mutex_lock();
hr = IWineD3DVolume_Map(This->wineD3DVolume, (WINED3DLOCKED_BOX *)pLockedVolume,
hr = wined3d_volume_map(This->wined3d_volume, (WINED3DLOCKED_BOX *)pLockedVolume,
(const WINED3DBOX *)pBox, Flags);
wined3d_mutex_unlock();
......@@ -236,7 +236,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(IDirect3DVolume8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DVolume_Unmap(This->wineD3DVolume);
hr = wined3d_volume_unmap(This->wined3d_volume);
wined3d_mutex_unlock();
return hr;
......@@ -278,7 +278,7 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device,
volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage,
format, pool, volume, &d3d8_volume_wined3d_parent_ops, &volume->wineD3DVolume);
format, pool, volume, &d3d8_volume_wined3d_parent_ops, &volume->wined3d_volume);
if (FAILED(hr))
{
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
......
......@@ -190,15 +190,9 @@ typedef struct IDirect3DVolume9Impl
/* IUnknown fields */
const IDirect3DVolume9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DVolume9 fields */
IWineD3DVolume *wineD3DVolume;
/* The volume container */
IUnknown *container;
/* If set forward refcounting to this object */
IUnknown *forwardReference;
struct wined3d_volume *wined3d_volume;
IUnknown *container;
IUnknown *forwardReference;
} IDirect3DVolume9Impl;
HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height,
......
......@@ -3120,7 +3120,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
IDirect3DVolume9Impl *object;
......@@ -3146,8 +3146,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
return hr;
}
*volume = object->wineD3DVolume;
IWineD3DVolume_AddRef(*volume);
*volume = object->wined3d_volume;
wined3d_volume_incref(*volume);
IDirect3DVolume9_Release((IDirect3DVolume9 *)object);
object->container = container_parent;
......
......@@ -60,7 +60,7 @@ static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) {
if (ref == 1)
{
wined3d_mutex_lock();
IWineD3DVolume_AddRef(This->wineD3DVolume);
wined3d_volume_incref(This->wined3d_volume);
wined3d_mutex_unlock();
}
......@@ -85,7 +85,7 @@ static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) {
if (ref == 0) {
wined3d_mutex_lock();
IWineD3DVolume_Release(This->wineD3DVolume);
wined3d_volume_decref(This->wined3d_volume);
wined3d_mutex_unlock();
}
......@@ -122,9 +122,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 ifac
iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
wined3d_mutex_lock();
hr = IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags);
hr = wined3d_volume_set_private_data(This->wined3d_volume, refguid, pData, SizeOfData, Flags);
wined3d_mutex_unlock();
return hr;
......@@ -138,9 +136,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 ifac
iface, debugstr_guid(refguid), pData, pSizeOfData);
wined3d_mutex_lock();
hr = IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData);
hr = wined3d_volume_get_private_data(This->wined3d_volume, refguid, pData, pSizeOfData);
wined3d_mutex_unlock();
return hr;
......@@ -153,9 +149,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 ifa
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
wined3d_mutex_lock();
hr = IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid);
hr = wined3d_volume_free_private_data(This->wined3d_volume, refguid);
wined3d_mutex_unlock();
return hr;
......@@ -185,7 +179,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(IDirect3DVolume9 *iface, D3DV
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
wined3d_resource = IWineD3DVolume_GetResource(This->wineD3DVolume);
wined3d_resource = wined3d_volume_get_resource(This->wined3d_volume);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
......@@ -208,10 +202,8 @@ static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DL
iface, pLockedVolume, pBox, Flags);
wined3d_mutex_lock();
hr = IWineD3DVolume_Map(This->wineD3DVolume, (WINED3DLOCKED_BOX *)pLockedVolume,
hr = wined3d_volume_map(This->wined3d_volume, (WINED3DLOCKED_BOX *)pLockedVolume,
(const WINED3DBOX *)pBox, Flags);
wined3d_mutex_unlock();
return hr;
......@@ -224,9 +216,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) {
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DVolume_Unmap(This->wineD3DVolume);
hr = wined3d_volume_unmap(This->wined3d_volume);
wined3d_mutex_unlock();
return hr;
......@@ -268,7 +258,7 @@ HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device,
volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK,
format, pool, volume, &d3d9_volume_wined3d_parent_ops, &volume->wineD3DVolume);
format, pool, volume, &d3d9_volume_wined3d_parent_ops, &volume->wined3d_volume);
if (FAILED(hr))
{
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
......
......@@ -5877,7 +5877,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
{
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
iface, container_parent, width, height, depth, format, pool, usage, volume);
......
......@@ -5100,22 +5100,22 @@ static HRESULT IWineD3DDeviceImpl_UpdateVolume(IWineD3DDevice *iface,
/* TODO: Implement direct loading into the gl volume instead of using memcpy and
* dirtification to improve loading performance.
*/
hr = IWineD3DVolume_Map(pSourceVolume, &src, NULL, WINED3DLOCK_READONLY);
hr = wined3d_volume_map(pSourceVolume, &src, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr)) return hr;
hr = IWineD3DVolume_Map(pDestinationVolume, &dst, NULL, WINED3DLOCK_DISCARD);
hr = wined3d_volume_map(pDestinationVolume, &dst, NULL, WINED3DLOCK_DISCARD);
if (FAILED(hr))
{
IWineD3DVolume_Unmap(pSourceVolume);
wined3d_volume_unmap(pSourceVolume);
return hr;
}
memcpy(dst.pBits, src.pBits, ((IWineD3DVolumeImpl *) pDestinationVolume)->resource.size);
hr = IWineD3DVolume_Unmap(pDestinationVolume);
hr = wined3d_volume_unmap(pDestinationVolume);
if (FAILED(hr))
IWineD3DVolume_Unmap(pSourceVolume);
wined3d_volume_unmap(pSourceVolume);
else
hr = IWineD3DVolume_Unmap(pSourceVolume);
hr = wined3d_volume_unmap(pSourceVolume);
return hr;
}
......
......@@ -1186,7 +1186,7 @@ static void texture3d_sub_resource_cleanup(struct wined3d_resource *sub_resource
/* Cleanup the container. */
volume_set_container(volume, NULL);
IWineD3DVolume_Release((IWineD3DVolume *)volume);
wined3d_volume_decref(volume);
}
/* Do not call while under the GL lock. */
......
......@@ -114,4 +114,17 @@
@ cdecl wined3d_vertex_declaration_get_parent(ptr)
@ cdecl wined3d_vertex_declaration_incref(ptr)
@ cdecl wined3d_volume_decref(ptr)
@ cdecl wined3d_volume_free_private_data(ptr ptr)
@ cdecl wined3d_volume_from_resource(ptr)
@ cdecl wined3d_volume_get_parent(ptr)
@ cdecl wined3d_volume_get_priority(ptr)
@ cdecl wined3d_volume_get_private_data(ptr ptr ptr ptr)
@ cdecl wined3d_volume_get_resource(ptr)
@ cdecl wined3d_volume_get_type(ptr)
@ cdecl wined3d_volume_incref(ptr)
@ cdecl wined3d_volume_map(ptr ptr ptr long)
@ cdecl wined3d_volume_preload(ptr)
@ cdecl wined3d_volume_set_priority(ptr long)
@ cdecl wined3d_volume_set_private_data(ptr ptr ptr long long)
@ cdecl wined3d_volume_unmap(ptr)
......@@ -54,6 +54,8 @@
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct wined3d_volume IWineD3DVolumeImpl;
typedef struct wined3d_volume IWineD3DVolume;
/* Texture format fixups */
......@@ -1942,10 +1944,8 @@ HRESULT volumetexture_init(struct wined3d_texture *texture, UINT width, UINT hei
UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
typedef struct IWineD3DVolumeImpl
struct wined3d_volume
{
/* IUnknown & WineD3DResource fields */
const IWineD3DVolumeVtbl *lpVtbl;
struct wined3d_resource resource;
struct wined3d_texture *container;
BOOL lockable;
......@@ -1953,14 +1953,14 @@ typedef struct IWineD3DVolumeImpl
WINED3DBOX lockedBox;
WINED3DBOX dirtyBox;
BOOL dirty;
} IWineD3DVolumeImpl;
};
static inline IWineD3DVolumeImpl *volume_from_resource(struct wined3d_resource *resource)
{
return CONTAINING_RECORD(resource, IWineD3DVolumeImpl, resource);
}
void volume_add_dirty_box(struct IWineD3DVolumeImpl *volume, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN;
void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN;
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......
......@@ -2087,7 +2087,6 @@ struct wined3d_parent_ops
};
interface IWineD3DSurface;
interface IWineD3DVolume;
interface IWineD3DDevice;
struct wined3d;
struct wined3d_buffer;
......@@ -2101,6 +2100,7 @@ struct wined3d_stateblock;
struct wined3d_swapchain;
struct wined3d_texture;
struct wined3d_vertex_declaration;
struct wined3d_volume;
[
object,
......@@ -2154,7 +2154,7 @@ interface IWineD3DDeviceParent : IUnknown
[in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool,
[in] DWORD usage,
[out] IWineD3DVolume **volume
[out] struct wined3d_volume **volume
);
HRESULT CreateSwapChain(
......@@ -2310,24 +2310,6 @@ interface IWineD3DSurface : IWineD3DResource
[
object,
local,
uuid(24769ed8-6f30-11d9-c687-00046142c14f)
]
interface IWineD3DVolume : IWineD3DResource
{
struct wined3d_resource *GetResource(
);
HRESULT Map(
[out] WINED3DLOCKED_BOX *locked_box,
[in] const WINED3DBOX *box,
[in] DWORD flags
);
HRESULT Unmap(
);
}
[
object,
local,
uuid(6d10a2ce-09d0-4a53-a427-11388f9f8ca5)
]
interface IWineD3DDevice : IUnknown
......@@ -2412,7 +2394,7 @@ interface IWineD3DDevice : IUnknown
[in] WINED3DPOOL pool,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DVolume **volume
[out] struct wined3d_volume **volume
);
HRESULT CreateCubeTexture(
[in] UINT edge_length,
......@@ -3083,4 +3065,20 @@ ULONG __cdecl wined3d_vertex_declaration_decref(struct wined3d_vertex_declaratio
void * __cdecl wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_declaration *declaration);
ULONG __cdecl wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration);
IWineD3DVolume * __cdecl wined3d_volume_from_resource(struct wined3d_resource *resource);
ULONG __cdecl wined3d_volume_decref(struct wined3d_volume *volume);
HRESULT __cdecl wined3d_volume_free_private_data(struct wined3d_volume *volume, REFGUID guid);
struct wined3d_volume * __cdecl wined3d_volume_from_resource(struct wined3d_resource *resource);
void * __cdecl wined3d_volume_get_parent(const struct wined3d_volume *volume);
DWORD __cdecl wined3d_volume_get_priority(const struct wined3d_volume *volume);
HRESULT __cdecl wined3d_volume_get_private_data(const struct wined3d_volume *volume,
REFGUID guid, void *data, DWORD *data_size);
struct wined3d_resource * __cdecl wined3d_volume_get_resource(struct wined3d_volume *volume);
WINED3DRESOURCETYPE __cdecl wined3d_volume_get_type(const struct wined3d_volume *volume);
ULONG __cdecl wined3d_volume_incref(struct wined3d_volume *volume);
HRESULT __cdecl wined3d_volume_map(struct wined3d_volume *volume,
WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags);
void __cdecl wined3d_volume_preload(struct wined3d_volume *volume);
DWORD __cdecl wined3d_volume_set_priority(struct wined3d_volume *volume, DWORD new_priority);
HRESULT __cdecl wined3d_volume_set_private_data(struct wined3d_volume *volume,
REFGUID guid, const void *data, DWORD data_size, DWORD flags);
HRESULT __cdecl wined3d_volume_unmap(struct wined3d_volume *volume);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment