From 4be256a47c4f0ab91cfb0a72b4cbc67182f6179d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 9 Mar 2011 19:16:15 +0100 Subject: [PATCH] wined3d: Introduce wined3d_resource_get_desc() to retrieve the resource desc. --- dlls/wined3d/buffer.c | 11 +---------- dlls/wined3d/cubetexture.c | 2 +- dlls/wined3d/resource.c | 14 ++++++++++++++ dlls/wined3d/surface_base.c | 11 +---------- dlls/wined3d/texture.c | 2 +- dlls/wined3d/volume.c | 11 +---------- dlls/wined3d/volumetexture.c | 2 +- dlls/wined3d/wined3d_private.h | 2 ++ 8 files changed, 22 insertions(+), 33 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index e665311c86a..8d65ffb3215 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1399,16 +1399,7 @@ void CDECL wined3d_buffer_get_desc(const struct wined3d_buffer *buffer, struct w { TRACE("buffer %p, desc %p.\n", buffer, desc); - desc->format = buffer->resource.format->id; - desc->resource_type = buffer->resource.resourceType; - desc->usage = buffer->resource.usage; - desc->pool = buffer->resource.pool; - desc->size = buffer->resource.size; - desc->multisample_type = WINED3DMULTISAMPLE_NONE; - desc->multisample_quality = 0; - desc->width = buffer->resource.size; - desc->height = 1; - desc->depth = 1; + wined3d_resource_get_desc(&buffer->resource, desc); } static const struct wined3d_resource_ops buffer_resource_ops = diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index d4e5d211531..3e673df88bf 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -340,7 +340,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetSubResourceDesc(IWineD3DCubeTex return WINED3DERR_INVALIDCALL; } - IWineD3DSurface_GetDesc((IWineD3DSurface *)surface_from_resource(sub_resource), desc); + wined3d_resource_get_desc(sub_resource, desc); return WINED3D_OK; } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 66c2e622997..5a73df2f4b4 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -282,3 +282,17 @@ void * CDECL wined3d_resource_get_parent(const struct wined3d_resource *resource { return resource->parent; } + +void wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc) +{ + desc->resource_type = resource->resourceType; + desc->format = resource->format->id; + desc->multisample_type = resource->multisample_type; + desc->multisample_quality = resource->multisample_quality; + desc->usage = resource->usage; + desc->pool = resource->pool; + desc->width = resource->width; + desc->height = resource->height; + desc->depth = resource->depth; + desc->size = resource->size; +} diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c index fc093b3ea18..f8b6a63dd47 100644 --- a/dlls/wined3d/surface_base.c +++ b/dlls/wined3d/surface_base.c @@ -163,16 +163,7 @@ void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, struct wined TRACE("iface %p, desc %p.\n", iface, desc); - desc->format = surface->resource.format->id; - desc->resource_type = surface->resource.resourceType; - desc->usage = surface->resource.usage; - desc->pool = surface->resource.pool; - desc->size = surface->resource.size; /* dx8 only */ - desc->multisample_type = surface->resource.multisample_type; - desc->multisample_quality = surface->resource.multisample_quality; - desc->width = surface->resource.width; - desc->height = surface->resource.height; - desc->depth = surface->resource.depth; + wined3d_resource_get_desc(&surface->resource, desc); } HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD flags) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 7a78ad843b6..a5a3d655fa1 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -365,7 +365,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetSubResourceDesc(IWineD3DTexture *if return WINED3DERR_INVALIDCALL; } - IWineD3DSurface_GetDesc((IWineD3DSurface *)surface_from_resource(sub_resource), desc); + wined3d_resource_get_desc(sub_resource, desc); return WINED3D_OK; } diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 0210669e3be..6fb337f85ff 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -226,16 +226,7 @@ static void WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, struct wine TRACE("iface %p, desc %p.\n", iface, desc); - desc->format = volume->resource.format->id; - desc->resource_type = volume->resource.resourceType; - desc->usage = volume->resource.usage; - desc->pool = volume->resource.pool; - desc->size = volume->resource.size; /* dx8 only */ - desc->multisample_type = WINED3DMULTISAMPLE_NONE; - desc->multisample_quality = 0; - desc->width = volume->resource.width; - desc->height = volume->resource.height; - desc->depth = volume->resource.depth; + wined3d_resource_get_desc(&volume->resource, desc); } static HRESULT WINAPI IWineD3DVolumeImpl_Map(IWineD3DVolume *iface, diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index 78ded41348f..06cd6d9c53e 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -277,7 +277,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetSubResourceDesc(IWineD3DVolum return WINED3DERR_INVALIDCALL; } - IWineD3DVolume_GetDesc((IWineD3DVolume *)volume_from_resource(sub_resource), desc); + wined3d_resource_get_desc(sub_resource, desc); return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 201e19b774a..f395a950b5e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1824,6 +1824,8 @@ struct wined3d_resource void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_free_private_data(struct wined3d_resource *resource, REFGUID guid) DECLSPEC_HIDDEN; +void wined3d_resource_get_desc(const struct wined3d_resource *resource, + struct wined3d_resource_desc *desc) DECLSPEC_HIDDEN; DWORD resource_get_priority(const struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid, void *data, DWORD *data_size) DECLSPEC_HIDDEN;