Module: wine Branch: master Commit: 993bcc3e1385190cddc9cff4e26e558e73ee0ffe URL: http://source.winehq.org/git/wine.git/?a=commit;h=993bcc3e1385190cddc9cff4e2...
Author: Józef Kucia jkucia@codeweavers.com Date: Mon Mar 20 12:13:03 2017 +0100
wined3d: Make wined3d samplers usable when ARB_sampler_objects is not available.
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/wined3d/sampler.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c index 72574db..a987a35 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -39,10 +39,13 @@ static void wined3d_sampler_destroy_object(void *object) const struct wined3d_gl_info *gl_info; struct wined3d_context *context;
- context = context_acquire(sampler->device, NULL, 0); - gl_info = context->gl_info; - GL_EXTCALL(glDeleteSamplers(1, &sampler->name)); - context_release(context); + if (sampler->name) + { + context = context_acquire(sampler->device, NULL, 0); + gl_info = context->gl_info; + GL_EXTCALL(glDeleteSamplers(1, &sampler->name)); + context_release(context); + }
HeapFree(GetProcessHeap(), 0, sampler); } @@ -115,7 +118,9 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d sampler->device = device; sampler->parent = parent; sampler->desc = *desc; - wined3d_cs_init_object(device->cs, wined3d_sampler_cs_init, sampler); + + if (device->adapter->gl_info.supported[ARB_SAMPLER_OBJECTS]) + wined3d_cs_init_object(device->cs, wined3d_sampler_cs_init, sampler); }
HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc, @@ -125,9 +130,6 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
TRACE("device %p, desc %p, parent %p, sampler %p.\n", device, desc, parent, sampler);
- if (!device->adapter->gl_info.supported[ARB_SAMPLER_OBJECTS]) - return WINED3DERR_INVALIDCALL; - if (desc->address_u < WINED3D_TADDRESS_WRAP || desc->address_u > WINED3D_TADDRESS_MIRROR_ONCE || desc->address_v < WINED3D_TADDRESS_WRAP || desc->address_v > WINED3D_TADDRESS_MIRROR_ONCE || desc->address_w < WINED3D_TADDRESS_WRAP || desc->address_w > WINED3D_TADDRESS_MIRROR_ONCE)