wined3d: Add parent ops for sampler 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:
parent
aff0026e68
commit
5b0fe9cee5
|
@ -1211,7 +1211,8 @@ HRESULT d3d_sampler_state_init(struct d3d_sampler_state *state, struct d3d_devic
|
|||
wined3d_desc.comparison_func = wined3d_cmp_func_from_d3d11(desc->ComparisonFunc);
|
||||
wined3d_desc.srgb_decode = TRUE;
|
||||
|
||||
if (FAILED(hr = wined3d_sampler_create(device->wined3d_device, &wined3d_desc, state, &state->wined3d_sampler)))
|
||||
if (FAILED(hr = wined3d_sampler_create(device->wined3d_device, &wined3d_desc,
|
||||
state, &d3d_null_wined3d_parent_ops, &state->wined3d_sampler)))
|
||||
{
|
||||
WARN("Failed to create wined3d sampler, hr %#x.\n", hr);
|
||||
wined3d_private_store_cleanup(&state->private_store);
|
||||
|
|
|
@ -786,7 +786,7 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3
|
|||
* sampler object is used to emulate the direct resource access when there is no sampler state
|
||||
* to use.
|
||||
*/
|
||||
if (FAILED(hr = wined3d_sampler_create(device, &desc, NULL, &device->default_sampler)))
|
||||
if (FAILED(hr = wined3d_sampler_create(device, &desc, NULL, &wined3d_null_parent_ops, &device->default_sampler)))
|
||||
{
|
||||
ERR("Failed to create default sampler, hr %#x.\n", hr);
|
||||
device->default_sampler = NULL;
|
||||
|
@ -799,7 +799,7 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3
|
|||
desc.mag_filter = WINED3D_TEXF_LINEAR;
|
||||
desc.min_filter = WINED3D_TEXF_LINEAR;
|
||||
desc.mip_filter = WINED3D_TEXF_LINEAR;
|
||||
if (FAILED(hr = wined3d_sampler_create(device, &desc, NULL, &device->null_sampler)))
|
||||
if (FAILED(hr = wined3d_sampler_create(device, &desc, NULL, &wined3d_null_parent_ops, &device->null_sampler)))
|
||||
{
|
||||
ERR("Failed to create null sampler, hr %#x.\n", hr);
|
||||
device->null_sampler = NULL;
|
||||
|
|
|
@ -57,7 +57,10 @@ ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
|
|||
TRACE("%p decreasing refcount to %u.\n", sampler, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
sampler->parent_ops->wined3d_object_destroyed(sampler->parent);
|
||||
wined3d_cs_destroy_object(sampler->device->cs, wined3d_sampler_destroy_object, sampler);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
@ -112,11 +115,12 @@ static void wined3d_sampler_cs_init(void *object)
|
|||
}
|
||||
|
||||
static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d_device *device,
|
||||
const struct wined3d_sampler_desc *desc, void *parent)
|
||||
const struct wined3d_sampler_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
sampler->refcount = 1;
|
||||
sampler->device = device;
|
||||
sampler->parent = parent;
|
||||
sampler->parent_ops = parent_ops;
|
||||
sampler->desc = *desc;
|
||||
|
||||
if (device->adapter->gl_info.supported[ARB_SAMPLER_OBJECTS])
|
||||
|
@ -124,7 +128,7 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
|
|||
}
|
||||
|
||||
HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc,
|
||||
void *parent, struct wined3d_sampler **sampler)
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_sampler **sampler)
|
||||
{
|
||||
struct wined3d_sampler *object;
|
||||
|
||||
|
@ -143,7 +147,7 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
|
|||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
wined3d_sampler_init(object, device, desc, parent);
|
||||
wined3d_sampler_init(object, device, desc, parent, parent_ops);
|
||||
|
||||
TRACE("Created sampler %p.\n", object);
|
||||
*sampler = object;
|
||||
|
|
|
@ -3616,7 +3616,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
|
|||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(wined3d_sampler_create(device, &desc, NULL, &sampler)))
|
||||
if (FAILED(wined3d_sampler_create(device, &desc, NULL, &wined3d_null_parent_ops, &sampler)))
|
||||
{
|
||||
ERR("Failed to create sampler.\n");
|
||||
return;
|
||||
|
|
|
@ -223,7 +223,7 @@
|
|||
@ cdecl wined3d_rendertarget_view_incref(ptr)
|
||||
@ cdecl wined3d_rendertarget_view_set_parent(ptr ptr)
|
||||
|
||||
@ cdecl wined3d_sampler_create(ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_sampler_create(ptr ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_sampler_decref(ptr)
|
||||
@ cdecl wined3d_sampler_get_parent(ptr)
|
||||
@ cdecl wined3d_sampler_incref(ptr)
|
||||
|
|
|
@ -3110,10 +3110,11 @@ struct wined3d_sampler
|
|||
{
|
||||
struct wine_rb_entry entry;
|
||||
LONG refcount;
|
||||
GLuint name;
|
||||
struct wined3d_device *device;
|
||||
void *parent;
|
||||
const struct wined3d_parent_ops *parent_ops;
|
||||
struct wined3d_sampler_desc desc;
|
||||
GLuint name;
|
||||
};
|
||||
|
||||
void wined3d_sampler_bind(struct wined3d_sampler *sampler, unsigned int unit,
|
||||
|
|
|
@ -2531,7 +2531,7 @@ ULONG __cdecl wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view
|
|||
void __cdecl wined3d_rendertarget_view_set_parent(struct wined3d_rendertarget_view *view, void *parent);
|
||||
|
||||
HRESULT __cdecl wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc,
|
||||
void *parent, struct wined3d_sampler **sampler);
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_sampler **sampler);
|
||||
ULONG __cdecl wined3d_sampler_decref(struct wined3d_sampler *sampler);
|
||||
void * __cdecl wined3d_sampler_get_parent(const struct wined3d_sampler *sampler);
|
||||
ULONG __cdecl wined3d_sampler_incref(struct wined3d_sampler *sampler);
|
||||
|
|
Loading…
Reference in New Issue