wined3d: Get rid of the IWineD3DVolume typedefs.

oldstable
Henri Verbeet 2011-04-14 22:41:48 +02:00 committed by Alexandre Julliard
parent 2c450571e5
commit 89a4e696a2
4 changed files with 31 additions and 39 deletions

View File

@ -1183,10 +1183,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height,
UINT Depth, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent,
const struct wined3d_parent_ops *parent_ops, IWineD3DVolume **ppVolume)
const struct wined3d_parent_ops *parent_ops, struct wined3d_volume **volume)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVolumeImpl *object;
struct wined3d_volume *object;
HRESULT hr;
TRACE("(%p) : W(%d) H(%d) D(%d), Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height,
@ -1196,7 +1196,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UIN
if (!object)
{
ERR("Out of memory\n");
*ppVolume = NULL;
*volume = NULL;
return WINED3DERR_OUTOFVIDEOMEMORY;
}
@ -1209,7 +1209,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UIN
}
TRACE("(%p) : Created volume %p.\n", This, object);
*ppVolume = (IWineD3DVolume *)object;
*volume = object;
return WINED3D_OK;
}
@ -5088,34 +5088,33 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev
/* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */
static HRESULT IWineD3DDeviceImpl_UpdateVolume(IWineD3DDevice *iface,
IWineD3DVolume *pSourceVolume, IWineD3DVolume *pDestinationVolume)
struct wined3d_volume *src_volume, struct wined3d_volume *dst_volume)
{
WINED3DLOCKED_BOX src;
WINED3DLOCKED_BOX dst;
HRESULT hr;
TRACE("iface %p, src_volume %p, dst_volume %p.\n",
iface, pSourceVolume, pDestinationVolume);
iface, src_volume, dst_volume);
/* TODO: Implement direct loading into the gl volume instead of using memcpy and
* dirtification to improve loading performance.
*/
hr = wined3d_volume_map(pSourceVolume, &src, NULL, WINED3DLOCK_READONLY);
/* TODO: Implement direct loading into the gl volume instead of using
* memcpy and dirtification to improve loading performance. */
hr = wined3d_volume_map(src_volume, &src, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr)) return hr;
hr = wined3d_volume_map(pDestinationVolume, &dst, NULL, WINED3DLOCK_DISCARD);
hr = wined3d_volume_map(dst_volume, &dst, NULL, WINED3DLOCK_DISCARD);
if (FAILED(hr))
{
wined3d_volume_unmap(pSourceVolume);
wined3d_volume_unmap(src_volume);
return hr;
}
memcpy(dst.pBits, src.pBits, ((IWineD3DVolumeImpl *) pDestinationVolume)->resource.size);
memcpy(dst.pBits, src.pBits, dst_volume->resource.size);
hr = wined3d_volume_unmap(pDestinationVolume);
hr = wined3d_volume_unmap(dst_volume);
if (FAILED(hr))
wined3d_volume_unmap(pSourceVolume);
wined3d_volume_unmap(src_volume);
else
hr = wined3d_volume_unmap(pSourceVolume);
hr = wined3d_volume_unmap(src_volume);
return hr;
}
@ -5208,14 +5207,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
case WINED3DRTYPE_VOLUMETEXTURE:
{
IWineD3DVolume *src_volume;
IWineD3DVolume *dst_volume;
for (i = 0; i < level_count; ++i)
{
src_volume = (IWineD3DVolume *)volume_from_resource(wined3d_texture_get_sub_resource(src_texture, i));
dst_volume = (IWineD3DVolume *)volume_from_resource(wined3d_texture_get_sub_resource(dst_texture, i));
hr = IWineD3DDeviceImpl_UpdateVolume(iface, src_volume, dst_volume);
hr = IWineD3DDeviceImpl_UpdateVolume(iface,
volume_from_resource(wined3d_texture_get_sub_resource(src_texture, i)),
volume_from_resource(wined3d_texture_get_sub_resource(dst_texture, i)));
if (FAILED(hr))
{
WARN("IWineD3DDeviceImpl_UpdateVolume failed, hr %#x.\n", hr);

View File

@ -1157,7 +1157,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
{
for (i = 0; i < texture->level_count; ++i)
{
IWineD3DVolumeImpl *volume = volume_from_resource(texture->sub_resources[i]);
struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i]);
volume_add_dirty_box(volume, NULL);
volume_load(volume, i, texture->flags & WINED3D_TEXTURE_IS_SRGB);
}
@ -1182,7 +1182,7 @@ static void texture3d_sub_resource_add_dirty_region(struct wined3d_resource *sub
static void texture3d_sub_resource_cleanup(struct wined3d_resource *sub_resource)
{
IWineD3DVolumeImpl *volume = volume_from_resource(sub_resource);
struct wined3d_volume *volume = volume_from_resource(sub_resource);
/* Cleanup the container. */
volume_set_container(volume, NULL);
@ -1289,7 +1289,7 @@ HRESULT volumetexture_init(struct wined3d_texture *texture, UINT width, UINT hei
for (i = 0; i < texture->level_count; ++i)
{
IWineD3DVolume *volume;
struct wined3d_volume *volume;
/* Create the volume. */
hr = IWineD3DDeviceParent_CreateVolume(device->device_parent, parent,
@ -1302,8 +1302,8 @@ HRESULT volumetexture_init(struct wined3d_texture *texture, UINT width, UINT hei
}
/* Set its container to this texture. */
volume_set_container((IWineD3DVolumeImpl *)volume, texture);
texture->sub_resources[i] = &((IWineD3DVolumeImpl *)volume)->resource;
volume_set_container(volume, texture);
texture->sub_resources[i] = &volume->resource;
/* Calculate the next mipmap level. */
tmp_w = max(1, tmp_w >> 1);

View File

@ -1,6 +1,4 @@
/*
* IWineD3DVolume implementation
*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
@ -85,7 +83,7 @@ void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty
}
}
void volume_set_container(IWineD3DVolumeImpl *volume, struct wined3d_texture *container)
void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container)
{
TRACE("volume %p, container %p.\n", volume, container);
@ -93,7 +91,7 @@ void volume_set_container(IWineD3DVolumeImpl *volume, struct wined3d_texture *co
}
/* Context activation is done by the caller. */
void volume_load(IWineD3DVolumeImpl *volume, UINT level, BOOL srgb_mode)
void volume_load(struct wined3d_volume *volume, UINT level, BOOL srgb_mode)
{
const struct wined3d_gl_info *gl_info = &volume->resource.device->adapter->gl_info;
const struct wined3d_format *format = volume->resource.format;
@ -287,7 +285,7 @@ static const struct wined3d_resource_ops volume_resource_ops =
volume_unload,
};
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
HRESULT volume_init(struct wined3d_volume *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)
{

View File

@ -54,8 +54,6 @@
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct wined3d_volume IWineD3DVolumeImpl;
typedef struct wined3d_volume IWineD3DVolume;
/* Texture format fixups */
@ -1955,17 +1953,17 @@ struct wined3d_volume
BOOL dirty;
};
static inline IWineD3DVolumeImpl *volume_from_resource(struct wined3d_resource *resource)
static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource)
{
return CONTAINING_RECORD(resource, IWineD3DVolumeImpl, resource);
return CONTAINING_RECORD(resource, struct wined3d_volume, resource);
}
void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN;
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
HRESULT volume_init(struct wined3d_volume *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;
void volume_load(IWineD3DVolumeImpl *volume, UINT level, BOOL srgb_mode) DECLSPEC_HIDDEN;
void volume_set_container(IWineD3DVolumeImpl *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN;
void volume_load(struct wined3d_volume *volume, UINT level, BOOL srgb_mode) DECLSPEC_HIDDEN;
void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN;
/*****************************************************************************
* Structure for DIB Surfaces (GetDC and GDI surfaces)