wined3d: Abort state application when there is problem with newly created sampler object.

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:
Józef Kucia 2017-03-20 12:13:09 +01:00 committed by Alexandre Julliard
parent ec1da699d9
commit de0a88538c
1 changed files with 6 additions and 6 deletions

View File

@ -3633,17 +3633,17 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
if (FAILED(wined3d_sampler_create(device, &desc, NULL, &sampler))) if (FAILED(wined3d_sampler_create(device, &desc, NULL, &sampler)))
{ {
ERR("Failed to create sampler.\n"); ERR("Failed to create sampler.\n");
sampler = NULL; return;
} }
else if (wine_rb_put(&device->samplers, &desc, &sampler->entry) == -1)
{ {
if (wine_rb_put(&device->samplers, &desc, &sampler->entry) == -1) ERR("Failed to insert sampler.\n");
ERR("Failed to insert sampler.\n"); wined3d_sampler_decref(sampler);
return;
} }
} }
if (sampler) wined3d_sampler_bind(sampler, mapped_stage, texture, context);
wined3d_sampler_bind(sampler, mapped_stage, texture, context);
/* Trigger shader constant reloading (for NP2 texcoord fixup) */ /* Trigger shader constant reloading (for NP2 texcoord fixup) */
if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT))