wined3d: Pass wined3d_texture and sub_resource idx to device_volume_created callback.
Store wined3d_texture and sub_resource in d3d8_volume. Updated the d3d8_volume_LockBox to make use of wined3d_texture_map. Also updated d3d9, d3d11, ddraw callbacks accordingly. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
This commit is contained in:
parent
eac95d30b6
commit
9621737c8e
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue