Commit ec466ff3 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8: Get rid of IDirect3DSurface8Impl.

parent baa5ceec
...@@ -100,7 +100,6 @@ ...@@ -100,7 +100,6 @@
void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN; void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN;
typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl; typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl;
struct d3d8 struct d3d8
...@@ -199,19 +198,12 @@ struct d3d8_swapchain ...@@ -199,19 +198,12 @@ struct d3d8_swapchain
HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *device, HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *device,
D3DPRESENT_PARAMETERS *present_parameters) DECLSPEC_HIDDEN; D3DPRESENT_PARAMETERS *present_parameters) DECLSPEC_HIDDEN;
/* ----------------- */ struct d3d8_surface
/* IDirect3DSurface8 */
/* ----------------- */
/*****************************************************************************
* IDirect3DSurface8 implementation structure
*/
struct IDirect3DSurface8Impl
{ {
IDirect3DSurface8 IDirect3DSurface8_iface; IDirect3DSurface8 IDirect3DSurface8_iface;
LONG ref; LONG refcount;
struct wined3d_surface *wined3d_surface; struct wined3d_surface *wined3d_surface;
IDirect3DDevice8 *parentDevice; IDirect3DDevice8 *parent_device;
/* The surface container */ /* The surface container */
IUnknown *container; IUnknown *container;
...@@ -220,10 +212,10 @@ struct IDirect3DSurface8Impl ...@@ -220,10 +212,10 @@ struct IDirect3DSurface8Impl
IUnknown *forwardReference; IUnknown *forwardReference;
}; };
HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device, HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device,
UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN; struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
struct d3d8_vertexbuffer struct d3d8_vertexbuffer
{ {
......
...@@ -449,7 +449,7 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface, ...@@ -449,7 +449,7 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface,
UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap) UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DSurface8Impl *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap); struct d3d8_surface *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap);
HRESULT hr; HRESULT hr;
TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
...@@ -532,7 +532,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) ...@@ -532,7 +532,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
wined3d_resource_get_desc(resource, &desc); wined3d_resource_get_desc(resource, &desc);
if (desc.pool == WINED3D_POOL_DEFAULT) if (desc.pool == WINED3D_POOL_DEFAULT)
{ {
IDirect3DSurface8Impl *surface; struct d3d8_surface *surface;
if (desc.resource_type != WINED3D_RTYPE_SURFACE) if (desc.resource_type != WINED3D_RTYPE_SURFACE)
{ {
...@@ -541,7 +541,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) ...@@ -541,7 +541,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
} }
surface = wined3d_resource_get_parent(resource); surface = wined3d_resource_get_parent(resource);
if (surface->ref) if (surface->refcount)
{ {
WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource);
return D3DERR_DEVICELOST; return D3DERR_DEVICELOST;
...@@ -615,7 +615,7 @@ static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface, ...@@ -615,7 +615,7 @@ static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface,
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_surface *wined3d_surface = NULL; struct wined3d_surface *wined3d_surface = NULL;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
HRESULT hr; HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
...@@ -836,7 +836,7 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width, ...@@ -836,7 +836,7 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width,
IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality) DWORD multisample_quality)
{ {
IDirect3DSurface8Impl *object; struct d3d8_surface *object;
HRESULT hr; HRESULT hr;
TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n" TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n"
...@@ -844,8 +844,7 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width, ...@@ -844,8 +844,7 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width,
device, width, height, format, lockable, discard, level, surface, device, width, height, format, lockable, discard, level, surface,
usage, pool, multisample_type, multisample_quality); usage, pool, multisample_type, multisample_quality);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl)); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!object)
{ {
FIXME("Failed to allocate surface memory.\n"); FIXME("Failed to allocate surface memory.\n");
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
...@@ -920,8 +919,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface, ...@@ -920,8 +919,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count, IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count,
IDirect3DSurface8 *dst_surface, const POINT *dst_points) IDirect3DSurface8 *dst_surface, const POINT *dst_points)
{ {
IDirect3DSurface8Impl *src = unsafe_impl_from_IDirect3DSurface8(src_surface); struct d3d8_surface *src = unsafe_impl_from_IDirect3DSurface8(src_surface);
IDirect3DSurface8Impl *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface); struct d3d8_surface *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface);
enum wined3d_format_id src_format, dst_format; enum wined3d_format_id src_format, dst_format;
struct wined3d_resource_desc wined3d_desc; struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource; struct wined3d_resource *wined3d_resource;
...@@ -1042,7 +1041,7 @@ static HRESULT WINAPI d3d8_device_UpdateTexture(IDirect3DDevice8 *iface, ...@@ -1042,7 +1041,7 @@ static HRESULT WINAPI d3d8_device_UpdateTexture(IDirect3DDevice8 *iface,
static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface) static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DSurface8Impl *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface); struct d3d8_surface *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, dst_surface %p.\n", iface, dst_surface); TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
...@@ -1064,8 +1063,8 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, ...@@ -1064,8 +1063,8 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil) IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
IDirect3DSurface8Impl *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target); struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
IDirect3DSurface8Impl *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil); struct d3d8_surface *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil);
struct wined3d_surface *original_ds = NULL; struct wined3d_surface *original_ds = NULL;
HRESULT hr; HRESULT hr;
...@@ -1129,7 +1128,7 @@ static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDire ...@@ -1129,7 +1128,7 @@ static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDire
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_surface *wined3d_surface; struct wined3d_surface *wined3d_surface;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
HRESULT hr; HRESULT hr;
TRACE("iface %p, render_target %p.\n", iface, render_target); TRACE("iface %p, render_target %p.\n", iface, render_target);
...@@ -1160,7 +1159,7 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface ...@@ -1160,7 +1159,7 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_surface *wined3d_surface; struct wined3d_surface *wined3d_surface;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
HRESULT hr; HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil); TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
...@@ -2802,7 +2801,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent * ...@@ -2802,7 +2801,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface) enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
{ {
struct d3d8_device *device = device_from_device_parent(device_parent); struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DSurface8Impl *d3d_surface; struct d3d8_surface *d3d_surface;
BOOL lockable = TRUE; BOOL lockable = TRUE;
HRESULT hr; HRESULT hr;
...@@ -2827,8 +2826,8 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent * ...@@ -2827,8 +2826,8 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
wined3d_surface_incref(*surface); wined3d_surface_incref(*surface);
d3d_surface->container = container_parent; d3d_surface->container = container_parent;
IUnknown_Release(d3d_surface->parentDevice); IUnknown_Release(d3d_surface->parent_device);
d3d_surface->parentDevice = NULL; d3d_surface->parent_device = NULL;
IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface); IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface);
d3d_surface->forwardReference = container_parent; d3d_surface->forwardReference = container_parent;
...@@ -2842,7 +2841,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par ...@@ -2842,7 +2841,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
struct wined3d_surface **surface) struct wined3d_surface **surface)
{ {
struct d3d8_device *device = device_from_device_parent(device_parent); struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DSurface8Impl *d3d_surface; struct d3d8_surface *d3d_surface;
HRESULT hr; HRESULT hr;
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
...@@ -2873,7 +2872,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa ...@@ -2873,7 +2872,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface) DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
{ {
struct d3d8_device *device = device_from_device_parent(device_parent); struct d3d8_device *device = device_from_device_parent(device_parent);
IDirect3DSurface8Impl *d3d_surface; struct d3d8_surface *d3d_surface;
HRESULT hr; HRESULT hr;
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
......
...@@ -109,7 +109,7 @@ static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface, ...@@ -109,7 +109,7 @@ static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface,
{ {
struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface);
struct wined3d_surface *wined3d_surface = NULL; struct wined3d_surface *wined3d_surface = NULL;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
HRESULT hr; HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
......
...@@ -284,7 +284,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetSurfaceLevel(IDirect3DTexture8 *iface, ...@@ -284,7 +284,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetSurfaceLevel(IDirect3DTexture8 *iface,
{ {
struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
TRACE("iface %p, level %u, surface %p.\n", iface, level, surface); TRACE("iface %p, level %u, surface %p.\n", iface, level, surface);
...@@ -308,7 +308,7 @@ static HRESULT WINAPI d3d8_texture_2d_LockRect(IDirect3DTexture8 *iface, UINT le ...@@ -308,7 +308,7 @@ static HRESULT WINAPI d3d8_texture_2d_LockRect(IDirect3DTexture8 *iface, UINT le
{ {
struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
HRESULT hr; HRESULT hr;
TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n", TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n",
...@@ -331,7 +331,7 @@ static HRESULT WINAPI d3d8_texture_2d_UnlockRect(IDirect3DTexture8 *iface, UINT ...@@ -331,7 +331,7 @@ static HRESULT WINAPI d3d8_texture_2d_UnlockRect(IDirect3DTexture8 *iface, UINT
{ {
struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
HRESULT hr; HRESULT hr;
TRACE("iface %p, level %u.\n", iface, level); TRACE("iface %p, level %u.\n", iface, level);
...@@ -654,7 +654,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture8 ...@@ -654,7 +654,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture8
{ {
struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
UINT sub_resource_idx; UINT sub_resource_idx;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface); TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
...@@ -681,7 +681,7 @@ static HRESULT WINAPI d3d8_texture_cube_LockRect(IDirect3DCubeTexture8 *iface, ...@@ -681,7 +681,7 @@ static HRESULT WINAPI d3d8_texture_cube_LockRect(IDirect3DCubeTexture8 *iface,
{ {
struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
UINT sub_resource_idx; UINT sub_resource_idx;
HRESULT hr; HRESULT hr;
...@@ -707,7 +707,7 @@ static HRESULT WINAPI d3d8_texture_cube_UnlockRect(IDirect3DCubeTexture8 *iface, ...@@ -707,7 +707,7 @@ static HRESULT WINAPI d3d8_texture_cube_UnlockRect(IDirect3DCubeTexture8 *iface,
{ {
struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
IDirect3DSurface8Impl *surface_impl; struct d3d8_surface *surface_impl;
UINT sub_resource_idx; UINT sub_resource_idx;
HRESULT hr; HRESULT hr;
......
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