Module: wine Branch: master Commit: 5b0fe9cee5b88563d9e30849a6c1c362519191bc URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b0fe9cee5b88563d9e30849a6...
Author: Józef Kucia jkucia@codeweavers.com Date: Wed Apr 26 13:19:54 2017 +0200
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
---
dlls/d3d11/state.c | 3 ++- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/sampler.c | 10 +++++++--- dlls/wined3d/state.c | 2 +- dlls/wined3d/wined3d.spec | 2 +- dlls/wined3d/wined3d_private.h | 3 ++- include/wine/wined3d.h | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 0a16e58..c8e443f 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -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); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c901e9f..9499f6e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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; diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c index 294d766..86d23a0 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -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; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 531dd98..12ef3bb 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -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; diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 9b8de3e..0f27de3 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -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) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 357ceed..751f092 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 0d85cb4..2d69e98 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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);