d3d11: Always initialize out view pointer in CreateShaderResourceView().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2848ce7621
commit
db6d549837
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue