--- dlls/d3d11/device.c | 12 ++++++------ dlls/d3d8/d3d8_private.h | 6 ++++-- dlls/d3d8/device.c | 16 ++++++++-------- dlls/d3d8/surface.c | 3 ++- dlls/d3d8/volume.c | 3 ++- dlls/d3d9/d3d9_private.h | 6 ++++-- dlls/d3d9/device.c | 16 ++++++++-------- dlls/d3d9/surface.c | 3 ++- dlls/d3d9/volume.c | 3 ++- dlls/ddraw/ddraw.c | 14 +++++++------- dlls/ddraw/ddraw_private.h | 4 ++-- dlls/ddraw/surface.c | 7 +++---- dlls/wined3d/surface.c | 3 ++- dlls/wined3d/volume.c | 2 +- include/wine/wined3d.h | 4 ++-- 15 files changed, 55 insertions(+), 47 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index dcaa49c..316c268 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2927,10 +2927,10 @@ static void CDECL device_parent_activate(struct wined3d_device_parent *device_pa
static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_surface *surface, void **parent, - const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops, UINT idx) { - TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, surface, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, surface, parent, parent_ops, idx);
*parent = NULL; *parent_ops = &d3d10_null_wined3d_parent_ops; @@ -2940,10 +2940,10 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_volume *volume, void **parent, - const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops, UINT idx) { - TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, volume, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, volume, parent, parent_ops, idx);
*parent = NULL; *parent_ops = &d3d10_null_wined3d_parent_ops; diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 6283c8d..6573435 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -206,10 +206,11 @@ struct d3d8_volume struct d3d8_resource resource; struct wined3d_volume *wined3d_volume; struct d3d8_texture *texture; + UINT sub_resource_idx; };
void volume_init(struct d3d8_volume *volume, struct d3d8_texture *texture, - struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops, UINT idx) DECLSPEC_HIDDEN;
struct d3d8_swapchain { @@ -232,11 +233,12 @@ struct d3d8_surface IDirect3DDevice8 *parent_device; IUnknown *container; struct d3d8_texture *texture; + UINT sub_resource_idx; };
struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; void surface_init(struct d3d8_surface *surface, IUnknown *container_parent, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops, UINT idx) DECLSPEC_HIDDEN; struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
struct d3d8_vertexbuffer diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index e899b34..7cf0f91 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2999,17 +2999,17 @@ static void CDECL device_parent_activate(struct wined3d_device_parent *device_pa
static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_surface *surface, void **parent, - const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops, UINT idx) { struct d3d8_surface *d3d_surface;
- TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, surface, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, surface, parent, parent_ops, idx);
if (!(d3d_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_surface)))) return E_OUTOFMEMORY;
- surface_init(d3d_surface, container_parent, surface, parent_ops); + surface_init(d3d_surface, container_parent, surface, parent_ops, idx); *parent = d3d_surface; TRACE("Created surface %p.\n", d3d_surface);
@@ -3018,17 +3018,17 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_volume *volume, void **parent, - const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops, UINT idx) { struct d3d8_volume *d3d_volume;
- TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, volume, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, volume, parent, parent_ops, idx);
if (!(d3d_volume = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_volume)))) return E_OUTOFMEMORY;
- volume_init(d3d_volume, container_parent, volume, parent_ops); + volume_init(d3d_volume, container_parent, volume, parent_ops, idx); *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume);
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 7779a56..714102d 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -293,7 +293,7 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = };
void surface_init(struct d3d8_surface *surface, IUnknown *container_parent, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops, UINT idx) { IDirect3DBaseTexture8 *texture;
@@ -303,6 +303,7 @@ void surface_init(struct d3d8_surface *surface, IUnknown *container_parent, surface->wined3d_surface = wined3d_surface; list_init(&surface->rtv_entry); surface->container = container_parent; + surface->sub_resource_idx = idx;
if (container_parent && SUCCEEDED(IUnknown_QueryInterface(container_parent, &IID_IDirect3DBaseTexture8, (void **)&texture))) diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c index d116b16..f5c27e5 100644 --- a/dlls/d3d8/volume.c +++ b/dlls/d3d8/volume.c @@ -202,13 +202,14 @@ static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops = };
void volume_init(struct d3d8_volume *volume, struct d3d8_texture *texture, - struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops, UINT idx) { volume->IDirect3DVolume8_iface.lpVtbl = &d3d8_volume_vtbl; d3d8_resource_init(&volume->resource); volume->resource.refcount = 0; volume->wined3d_volume = wined3d_volume; volume->texture = texture; + volume->sub_resource_idx = idx;
*parent_ops = &d3d8_volume_wined3d_parent_ops; } diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index d12805f..506cb59 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -193,10 +193,11 @@ struct d3d9_volume struct d3d9_resource resource; struct wined3d_volume *wined3d_volume; struct d3d9_texture *texture; + UINT sub_resource_idx; };
void volume_init(struct d3d9_volume *volume, struct d3d9_texture *texture, - struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops, UINT idx) DECLSPEC_HIDDEN;
struct d3d9_swapchain { @@ -220,11 +221,12 @@ struct d3d9_surface IUnknown *container; struct d3d9_texture *texture; BOOL getdc_supported; + UINT sub_resource_idx; };
struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN; void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops, UINT idx) DECLSPEC_HIDDEN; struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN;
struct d3d9_vertexbuffer diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 3a0376d..092ed10 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3535,17 +3535,17 @@ static void CDECL device_parent_activate(struct wined3d_device_parent *device_pa
static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_surface *surface, void **parent, - const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops, UINT idx) { struct d3d9_surface *d3d_surface;
- TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, surface, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, surface, parent, parent_ops, idx);
if (!(d3d_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_surface)))) return E_OUTOFMEMORY;
- surface_init(d3d_surface, container_parent, surface, parent_ops); + surface_init(d3d_surface, container_parent, surface, parent_ops, idx); *parent = d3d_surface; TRACE("Created surface %p.\n", d3d_surface);
@@ -3554,17 +3554,17 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_volume *volume, void **parent, - const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops, UINT idx) { struct d3d9_volume *d3d_volume;
- TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, volume, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, volume, parent, parent_ops, idx);
if (!(d3d_volume = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_volume)))) return E_OUTOFMEMORY;
- volume_init(d3d_volume, container_parent, volume, parent_ops); + volume_init(d3d_volume, container_parent, volume, parent_ops, idx); *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume);
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index e5eb11f..b1f0a11 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -346,7 +346,7 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = };
void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops, UINT idx) { struct wined3d_resource_desc desc; IDirect3DBaseTexture9 *texture; @@ -357,6 +357,7 @@ void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, surface->wined3d_surface = wined3d_surface; list_init(&surface->rtv_entry); surface->container = container_parent; + surface->sub_resource_idx = idx;
if (container_parent && SUCCEEDED(IUnknown_QueryInterface(container_parent, &IID_IDirect3DBaseTexture9, (void **)&texture))) diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index 4b22f20..8df829c 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -202,13 +202,14 @@ static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops = };
void volume_init(struct d3d9_volume *volume, struct d3d9_texture *texture, - struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops, UINT idx) { volume->IDirect3DVolume9_iface.lpVtbl = &d3d9_volume_vtbl; d3d9_resource_init(&volume->resource); volume->resource.refcount = 0; volume->wined3d_volume = wined3d_volume; volume->texture = texture; + volume->sub_resource_idx = idx;
*parent_ops = &d3d9_volume_wined3d_parent_ops; } diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index c94bfee..6f35b23 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4713,13 +4713,13 @@ static void CDECL device_parent_activate(struct wined3d_device_parent *device_pa
static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_surface *surface, - void **parent, const struct wined3d_parent_ops **parent_ops) + void **parent, const struct wined3d_parent_ops **parent_ops, UINT idx) { struct ddraw *ddraw = ddraw_from_device_parent(device_parent); struct ddraw_surface *ddraw_surface;
- TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, surface, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, surface, parent, parent_ops, idx);
/* We have a swapchain or wined3d internal texture. */ if (!container_parent || container_parent == ddraw) @@ -4736,7 +4736,7 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent return DDERR_OUTOFVIDEOMEMORY; }
- ddraw_surface_init(ddraw_surface, ddraw, container_parent, surface, parent_ops); + ddraw_surface_init(ddraw_surface, ddraw, container_parent, surface, parent_ops, idx); *parent = ddraw_surface; list_add_head(&ddraw->surface_list, &ddraw_surface->surface_list_entry);
@@ -4747,10 +4747,10 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *device_parent, void *container_parent, struct wined3d_volume *volume, - void **parent, const struct wined3d_parent_ops **parent_ops) + void **parent, const struct wined3d_parent_ops **parent_ops, UINT idx) { - TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p.\n", - device_parent, container_parent, volume, parent, parent_ops); + TRACE("device_parent %p, container_parent %p, volume %p, parent %p, parent_ops %p, index %u.\n", + device_parent, container_parent, volume, parent, parent_ops, idx);
*parent = NULL; *parent_ops = &ddraw_null_wined3d_parent_ops; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index bb0a3f8..ff0621b 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -186,7 +186,7 @@ struct ddraw_surface DDSURFACEDESC2 surface_desc;
/* Misc things */ - UINT mipmap_level; + UINT sub_resource_idx;
/* Clipper objects */ struct ddraw_clipper *clipper; @@ -210,7 +210,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN; struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN; void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, struct ddraw_texture *texture, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops, UINT idx) DECLSPEC_HIDDEN; ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN; HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RECT *rect, BOOL read) DECLSPEC_HIDDEN; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 6b6ddb9..0e66a1b 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -777,7 +777,6 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa */
TRACE("(%p): Returning surface %p\n", This, surf); - TRACE("(%p): mipmapcount=%d\n", This, surf->mipmap_level); *Surface = &surf->IDirectDrawSurface7_iface; ddraw_surface7_AddRef(*Surface); wined3d_mutex_unlock(); @@ -5101,8 +5100,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu struct ddraw_palette *dst_pal, *src_pal; DDSURFACEDESC *src_desc, *dst_desc;
- TRACE("Copying surface %p to surface %p (mipmap level %d).\n", - src_surface, dst_surface, src_surface->mipmap_level); + TRACE("Copying surface %p to surface %p.\n", src_surface, dst_surface);
/* Suppress the ALLOCONLOAD flag */ dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD; @@ -6229,7 +6227,7 @@ fail: }
void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, struct ddraw_texture *texture, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops, UINT idx) { DDSURFACEDESC2 *desc = &surface->surface_desc; struct wined3d_resource_desc wined3d_desc; @@ -6246,6 +6244,7 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, stru surface->iface_count = 1; surface->version = version; surface->ddraw = ddraw; + surface->sub_resource_idx = idx;
if (version == 7) { diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 999423d..0676948 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -5395,6 +5395,7 @@ HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct w struct wined3d_surface *object; void *parent; HRESULT hr; + UINT idx = layer * container->level_count + level;
TRACE("container %p, width %u, height %u, format %s, usage %s (%#x), pool %s, " "multisample_type %#x, multisample_quality %u, target %#x, level %u, layer %u, flags %#x, surface %p.\n", @@ -5413,7 +5414,7 @@ HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct w }
if (FAILED(hr = device_parent->ops->surface_created(device_parent, - wined3d_texture_get_parent(container), object, &parent, &parent_ops))) + wined3d_texture_get_parent(container), object, &parent, &parent_ops, idx))) { WARN("Failed to create surface parent, hr %#x.\n", hr); wined3d_surface_destroy(object); diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 2daa55e..047251a 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -796,7 +796,7 @@ HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wi }
if (FAILED(hr = device_parent->ops->volume_created(device_parent, - wined3d_texture_get_parent(container), object, &parent, &parent_ops))) + wined3d_texture_get_parent(container), object, &parent, &parent_ops, level))) { WARN("Failed to create volume parent, hr %#x.\n", hr); wined3d_volume_destroy(object); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index ac1e59e..adec90a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2031,9 +2031,9 @@ struct wined3d_device_parent_ops void (__cdecl *mode_changed)(struct wined3d_device_parent *device_parent); void (__cdecl *activate)(struct wined3d_device_parent *device_parent, BOOL activate); HRESULT (__cdecl *surface_created)(struct wined3d_device_parent *device_parent, void *container_parent, - struct wined3d_surface *surface, void **parent, const struct wined3d_parent_ops **parent_ops); + struct wined3d_surface *surface, void **parent, const struct wined3d_parent_ops **parent_ops, UINT idx); HRESULT (__cdecl *volume_created)(struct wined3d_device_parent *device_parent, void *container_parent, - struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops); + struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops, UINT idx); HRESULT (__cdecl *create_swapchain_texture)(struct wined3d_device_parent *device_parent, void *parent, const struct wined3d_resource_desc *desc, struct wined3d_texture **texture); HRESULT (__cdecl *create_swapchain)(struct wined3d_device_parent *device_parent,