Commit 8afc0e63 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Add parent for rasterizer state objects.

parent 4d02f2fe
......@@ -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);
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
};
......
......@@ -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,
......
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