wined3d: Send sampler object desctruction through the command stream.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a4a8693e89
commit
29788075e0
|
@ -33,23 +33,28 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler)
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wined3d_sample_destroy_object(void *object)
|
||||||
|
{
|
||||||
|
struct wined3d_sampler *sampler = object;
|
||||||
|
const struct wined3d_gl_info *gl_info;
|
||||||
|
struct wined3d_context *context;
|
||||||
|
|
||||||
|
context = context_acquire(sampler->device, NULL);
|
||||||
|
gl_info = context->gl_info;
|
||||||
|
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
|
||||||
|
context_release(context);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, sampler);
|
||||||
|
}
|
||||||
|
|
||||||
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
|
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
|
||||||
{
|
{
|
||||||
ULONG refcount = InterlockedDecrement(&sampler->refcount);
|
ULONG refcount = InterlockedDecrement(&sampler->refcount);
|
||||||
const struct wined3d_gl_info *gl_info;
|
|
||||||
struct wined3d_context *context;
|
|
||||||
|
|
||||||
TRACE("%p decreasing refcount to %u.\n", sampler, refcount);
|
TRACE("%p decreasing refcount to %u.\n", sampler, refcount);
|
||||||
|
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
{
|
wined3d_cs_emit_destroy_object(sampler->device->cs, wined3d_sample_destroy_object, sampler);
|
||||||
context = context_acquire(sampler->device, NULL);
|
|
||||||
gl_info = context->gl_info;
|
|
||||||
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
|
|
||||||
context_release(context);
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, sampler);
|
|
||||||
}
|
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue