Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10core/tests/d3d10core.c | 6 ++++++ dlls/d3d11/device.c | 4 ++++ dlls/d3d11/tests/d3d11.c | 8 ++++++++ 3 files changed, 18 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index ea710038e17..f8dcbb8cb47 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -3555,8 +3555,10 @@ static void test_create_shader_resource_view(void)
buffer = create_buffer(device, D3D10_BIND_SHADER_RESOURCE, 1024, NULL);
+ srview = (void *)0xdeadbeef; hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, NULL, &srview); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!srview, "Unexpected pointer %p\n", srview);
srv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; srv_desc.ViewDimension = D3D10_SRV_DIMENSION_BUFFER; @@ -3586,8 +3588,10 @@ static void test_create_shader_resource_view(void) /* Without D3D10_BIND_SHADER_RESOURCE. */ buffer = create_buffer(device, 0, 1024, NULL);
+ srview = (void *)0xdeadbeef; hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, &srv_desc, &srview); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!srview, "Unexpected pointer %p\n", srview);
ID3D10Buffer_Release(buffer);
@@ -3693,9 +3697,11 @@ static void test_create_shader_resource_view(void) texture = (ID3D10Resource *)texture3d; }
+ srview = (void *)0xdeadbeef; get_srv_desc(&srv_desc, &invalid_desc_tests[i].srv_desc); hr = ID3D10Device_CreateShaderResourceView(device, texture, &srv_desc, &srview); ok(hr == E_INVALIDARG, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(!srview, "Unexpected pointer %p.\n", srview);
ID3D10Resource_Release(texture); } diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index f0cbb1741ab..858cd9f6d4a 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3377,6 +3377,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateShaderResourceView(ID3D11Dev
TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
+ *view = NULL; + if (!resource) return E_INVALIDARG;
@@ -6021,6 +6023,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView1(ID3D10De
TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
+ *view = NULL; + if (!resource) return E_INVALIDARG;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 56747e7168c..1db367f39fa 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4371,16 +4371,20 @@ static void test_create_shader_resource_view(void)
buffer = create_buffer(device, D3D11_BIND_SHADER_RESOURCE, 1024, NULL);
+ srview = (void *)0xdeadbeef; hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)buffer, NULL, &srview); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!srview, "Unexpected pointer %p.\n", srview);
srv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; srv_desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; U1(U(srv_desc).Buffer).ElementOffset = 0; U2(U(srv_desc).Buffer).ElementWidth = 64;
+ srview = (void *)0xdeadbeef; hr = ID3D11Device_CreateShaderResourceView(device, NULL, &srv_desc, &srview); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!srview, "Unexpected pointer %p.\n", srview);
expected_refcount = get_refcount(device) + 1; hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &srview); @@ -4405,8 +4409,10 @@ static void test_create_shader_resource_view(void) /* Without D3D11_BIND_SHADER_RESOURCE. */ buffer = create_buffer(device, 0, 1024, NULL);
+ srview = (void *)0xdeadbeef; hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &srview); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!srview, "Unexpected pointer %p.\n", srview);
ID3D11Buffer_Release(buffer);
@@ -4564,9 +4570,11 @@ static void test_create_shader_resource_view(void) texture = (ID3D11Resource *)texture3d; }
+ srview = (void *)0xdeadbeef; get_srv_desc(&srv_desc, &invalid_desc_tests[i].srv_desc); hr = ID3D11Device_CreateShaderResourceView(device, texture, &srv_desc, &srview); ok(hr == E_INVALIDARG, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(!srview, "Unexpected pointer %p.\n", srview);
ID3D11Resource_Release(texture); }