Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 3 +++ dlls/d3d10/tests/effect.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index e234aa0fea6..6af6de2d19b 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -6236,6 +6236,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; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 1c3d754eaf1..9be2bf17447 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -5697,9 +5697,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);