diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 693c9926a15..53843876d42 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2966,11 +2966,11 @@ 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, + struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops) { - 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, texture %p, sub_resource_idx %u, volume %p, parent %p, parent_ops %p.\n", + device_parent, wined3d_texture, sub_resource_idx, volume, parent, parent_ops); *parent = NULL; *parent_ops = &d3d10_null_wined3d_parent_ops; diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 6283c8d51ea..aec48319608 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -204,12 +204,14 @@ struct d3d8_volume { IDirect3DVolume8 IDirect3DVolume8_iface; struct d3d8_resource resource; + struct wined3d_texture *wined3d_texture; + unsigned int sub_resource_idx; struct wined3d_volume *wined3d_volume; struct d3d8_texture *texture; }; -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; +void volume_init(struct d3d8_volume *volume, struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx, struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d8_swapchain { diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index c6e34effdb0..6ba476e2b80 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -3018,18 +3018,18 @@ 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) + struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, + struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops) { 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, texture %p, sub_resource_idx %u, volume %p, parent %p, parent_ops %p.\n", + device_parent, wined3d_texture, sub_resource_idx, volume, parent, parent_ops); 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, wined3d_texture, sub_resource_idx, volume, parent_ops); *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume); diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c index 077ec721ade..52562ad61b0 100644 --- a/dlls/d3d8/volume.c +++ b/dlls/d3d8/volume.c @@ -148,7 +148,8 @@ static HRESULT WINAPI d3d8_volume_LockBox(IDirect3DVolume8 *iface, iface, locked_box, box, flags); wined3d_mutex_lock(); - hr = wined3d_volume_map(volume->wined3d_volume, &map_desc, (const struct wined3d_box *)box, flags); + hr = wined3d_texture_map(volume->wined3d_texture, volume->sub_resource_idx, + &map_desc, (const struct wined3d_box *)box, flags); wined3d_mutex_unlock(); locked_box->RowPitch = map_desc.row_pitch; @@ -201,14 +202,16 @@ static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops = volume_wined3d_object_destroyed, }; -void volume_init(struct d3d8_volume *volume, struct d3d8_texture *texture, - struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) +void volume_init(struct d3d8_volume *volume, struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx, struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) { 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->texture = wined3d_texture_get_parent(wined3d_texture); + volume->wined3d_texture = wined3d_texture; + volume->sub_resource_idx = sub_resource_idx; *parent_ops = &d3d8_volume_wined3d_parent_ops; } diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index d12805f67db..a1b824b8d9d 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -195,8 +195,8 @@ struct d3d9_volume struct d3d9_texture *texture; }; -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; +void volume_init(struct d3d9_volume *volume, struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx, struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d9_swapchain { diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 3a0376dac40..5568cc8312c 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3553,18 +3553,18 @@ 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, + struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops) { 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, texture %p, sub_resource_idx %u, volume %p, parent %p, parent_ops %p.\n", + device_parent, wined3d_texture, sub_resource_idx, volume, parent, parent_ops); 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, wined3d_texture, sub_resource_idx, volume, parent_ops); *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume); diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index 4b22f20eef7..603fb6e592c 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -201,14 +201,14 @@ static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops = volume_wined3d_object_destroyed, }; -void volume_init(struct d3d9_volume *volume, struct d3d9_texture *texture, - struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) +void volume_init(struct d3d9_volume *volume, struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx, struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) { 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->texture = wined3d_texture_get_parent(wined3d_texture); *parent_ops = &d3d9_volume_wined3d_parent_ops; } diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index c94bfee7c72..aef9963ca72 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4746,11 +4746,11 @@ 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, + struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops) { - 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, texture %p, sub_resource_idx %u, volume %p, parent %p, parent_ops %p.\n", + device_parent, wined3d_texture, sub_resource_idx, volume, parent, parent_ops); *parent = NULL; *parent_ops = &ddraw_null_wined3d_parent_ops; diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 45a2fee2dff..099927c443c 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -791,7 +791,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))) + container, level, object, &parent, &parent_ops))) { 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 7dc51ae496b..c9448dfc837 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2032,7 +2032,8 @@ struct wined3d_device_parent_ops 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); - HRESULT (__cdecl *volume_created)(struct wined3d_device_parent *device_parent, void *container_parent, + HRESULT (__cdecl *volume_created)(struct wined3d_device_parent *device_parent, + struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, struct wined3d_volume *volume, void **parent, const struct wined3d_parent_ops **parent_ops); HRESULT (__cdecl *create_swapchain_texture)(struct wined3d_device_parent *device_parent, void *parent, const struct wined3d_resource_desc *desc, struct wined3d_texture **texture);