mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Set pointer to NULL if committed resource creation fails.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cb24709980
commit
150d1f0eb8
@ -1914,22 +1914,25 @@ static D3D12_HEAP_PROPERTIES * STDMETHODCALLTYPE d3d12_device_GetCustomHeapPrope
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource(ID3D12Device *iface,
|
||||
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags,
|
||||
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
|
||||
const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID riid, void **resource)
|
||||
const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
|
||||
{
|
||||
struct d3d12_device *device = impl_from_ID3D12Device(iface);
|
||||
struct d3d12_resource *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, heap_properties %p, heap_flags %#x, desc %p, initial_state %#x, "
|
||||
"optimized_clear_value %p, riid %s, resource %p.\n",
|
||||
"optimized_clear_value %p, iid %s, resource %p.\n",
|
||||
iface, heap_properties, heap_flags, desc, initial_state,
|
||||
optimized_clear_value, debugstr_guid(riid), resource);
|
||||
optimized_clear_value, debugstr_guid(iid), resource);
|
||||
|
||||
if (FAILED(hr = d3d12_committed_resource_create(device, heap_properties, heap_flags,
|
||||
desc, initial_state, optimized_clear_value, &object)))
|
||||
{
|
||||
*resource = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
return return_interface(&object->ID3D12Resource_iface, &IID_ID3D12Resource, riid, resource);
|
||||
return return_interface(&object->ID3D12Resource_iface, &IID_ID3D12Resource, iid, resource);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device *iface,
|
||||
|
@ -1656,10 +1656,19 @@ static void test_create_committed_resource(void)
|
||||
|
||||
/* A texture cannot be created on a UPLOAD heap. */
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD;
|
||||
resource = (void *)0xdeadbeef;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
ok(!resource, "Got unexpected pointer %p.\n", resource);
|
||||
|
||||
resource = (void *)0xdeadbeef;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
|
||||
&IID_ID3D12Device, (void **)&resource);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
ok(!resource, "Got unexpected pointer %p.\n", resource);
|
||||
|
||||
/* A texture cannot be created on a READBACK heap. */
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_READBACK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user