wined3d: Add parent for rasterizer state objects.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-04-27 12:02:44 +02:00 committed by Alexandre Julliard
parent 4d02f2fed6
commit 8afc0e631c
5 changed files with 24 additions and 5 deletions

View File

@ -861,8 +861,8 @@ HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d
state->desc = *desc;
wined3d_desc.front_ccw = desc->FrontCounterClockwise;
if (FAILED(hr = wined3d_rasterizer_state_create(device->wined3d_device,
&wined3d_desc, &state->wined3d_state)))
if (FAILED(hr = wined3d_rasterizer_state_create(device->wined3d_device, &wined3d_desc,
state, &d3d_null_wined3d_parent_ops, &state->wined3d_state)))
{
WARN("Failed to create wined3d rasterizer state, hr %#x.\n", hr);
wined3d_private_store_cleanup(&state->private_store);

View File

@ -60,13 +60,24 @@ ULONG CDECL wined3d_rasterizer_state_decref(struct wined3d_rasterizer_state *sta
TRACE("%p decreasing refcount to %u.\n", state, refcount);
if (!refcount)
{
state->parent_ops->wined3d_object_destroyed(state->parent);
wined3d_cs_destroy_object(device->cs, wined3d_rasterizer_state_destroy_object, state);
}
return refcount;
}
void * CDECL wined3d_rasterizer_state_get_parent(const struct wined3d_rasterizer_state *state)
{
TRACE("rasterizer_state %p.\n", state);
return state->parent;
}
HRESULT CDECL wined3d_rasterizer_state_create(struct wined3d_device *device,
const struct wined3d_rasterizer_state_desc *desc, struct wined3d_rasterizer_state **state)
const struct wined3d_rasterizer_state_desc *desc, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_rasterizer_state **state)
{
struct wined3d_rasterizer_state *object;
@ -77,6 +88,8 @@ HRESULT CDECL wined3d_rasterizer_state_create(struct wined3d_device *device,
object->refcount = 1;
object->desc = *desc;
object->parent = parent;
object->parent_ops = parent_ops;
object->device = device;
TRACE("Created rasterizer state %p.\n", object);

View File

@ -201,8 +201,9 @@
@ cdecl wined3d_query_incref(ptr)
@ cdecl wined3d_query_issue(ptr long)
@ cdecl wined3d_rasterizer_state_create(ptr ptr ptr)
@ cdecl wined3d_rasterizer_state_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_rasterizer_state_decref(ptr)
@ cdecl wined3d_rasterizer_state_get_parent(ptr)
@ cdecl wined3d_rasterizer_state_incref(ptr)
@ cdecl wined3d_resource_get_desc(ptr ptr)

View File

@ -2572,6 +2572,9 @@ struct wined3d_rasterizer_state
LONG refcount;
struct wined3d_rasterizer_state_desc desc;
void *parent;
const struct wined3d_parent_ops *parent_ops;
struct wined3d_device *device;
};

View File

@ -2502,8 +2502,10 @@ static inline HRESULT wined3d_private_store_set_private_data(struct wined3d_priv
}
HRESULT __cdecl wined3d_rasterizer_state_create(struct wined3d_device *device,
const struct wined3d_rasterizer_state_desc *desc, struct wined3d_rasterizer_state **state);
const struct wined3d_rasterizer_state_desc *desc, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_rasterizer_state **state);
ULONG __cdecl wined3d_rasterizer_state_decref(struct wined3d_rasterizer_state *state);
void * __cdecl wined3d_rasterizer_state_get_parent(const struct wined3d_rasterizer_state *state);
ULONG __cdecl wined3d_rasterizer_state_incref(struct wined3d_rasterizer_state *state);
void __cdecl wined3d_resource_get_desc(const struct wined3d_resource *resource,