d3d11: Check parameter in ID3D11Device CreateRenderTargetView.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2016-11-28 06:43:08 +00:00 committed by Alexandre Julliard
parent 576395c71f
commit 7b0f376282
2 changed files with 6 additions and 0 deletions

View File

@ -2223,6 +2223,9 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRenderTargetView(ID3D11Devic
TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view); TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
if (!resource)
return E_INVALIDARG;
if (FAILED(hr = d3d_rendertarget_view_create(device, resource, desc, &object))) if (FAILED(hr = d3d_rendertarget_view_create(device, resource, desc, &object)))
return hr; return hr;

View File

@ -2979,6 +2979,9 @@ static void test_create_rendertarget_view(void)
U(rtv_desc).Buffer.ElementOffset = 0; U(rtv_desc).Buffer.ElementOffset = 0;
U(rtv_desc).Buffer.ElementWidth = 64; U(rtv_desc).Buffer.ElementWidth = 64;
hr = ID3D11Device_CreateRenderTargetView(device, NULL, &rtv_desc, &rtview);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
expected_refcount = get_refcount((IUnknown *)device) + 1; expected_refcount = get_refcount((IUnknown *)device) + 1;
hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)buffer, &rtv_desc, &rtview); hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)buffer, &rtv_desc, &rtview);
ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr);