d3d10/effect: Handle SetResource() called on null variable instance.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-08-18 10:51:52 +03:00 committed by Alexandre Julliard
parent 6385d93e54
commit 455239e379
2 changed files with 11 additions and 1 deletions

View File

@ -6237,6 +6237,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResour
TRACE("iface %p, resource %p.\n", iface, resource);
if (!d3d10_effect_shader_resource_variable_IsValid(iface))
return E_FAIL;
set_shader_resource_variable(&resource, v->u.resource.srv);
return S_OK;

View File

@ -5698,9 +5698,16 @@ static void test_effect_resource_variable(void)
effect_desc.SharedGlobalVariables);
ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques);
create_effect_texture_resource(device, &srv0, &tex0);
/* SetResource() on null resource variable. */
var = effect->lpVtbl->GetVariableByName(effect, "dummy name");
t0 = var->lpVtbl->AsShaderResource(var);
hr = t0->lpVtbl->SetResource(t0, srv0);
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
var = effect->lpVtbl->GetVariableByName(effect, "t0");
t0 = get_effect_shader_resource_variable(var);
create_effect_texture_resource(device, &srv0, &tex0);
hr = t0->lpVtbl->SetResource(t0, srv0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);