dzn: refactor error-handling
Here's a couple of cleanups to the error-handling code, now that we're no longer using ComPtr<T>. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
This commit is contained in:
parent
cfdaf1af9b
commit
9eace7f2e4
|
@ -897,6 +897,20 @@ dzn_GetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice,
|
|||
};
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_instance_add_physical_device(struct dzn_instance *instance,
|
||||
IDXGIAdapter1 *adapter)
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
IDXGIAdapter1_GetDesc1(adapter, &desc);
|
||||
|
||||
if ((instance->debug_flags & DZN_DEBUG_WARP) &&
|
||||
!(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE))
|
||||
return VK_SUCCESS;
|
||||
|
||||
return dzn_physical_device_create(instance, adapter, &desc);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
dzn_EnumeratePhysicalDevices(VkInstance inst,
|
||||
uint32_t *pPhysicalDeviceCount,
|
||||
|
@ -907,26 +921,21 @@ dzn_EnumeratePhysicalDevices(VkInstance inst,
|
|||
if (!instance->physical_devices_enumerated) {
|
||||
IDXGIFactory4 *factory = dxgi_get_factory(false);
|
||||
IDXGIAdapter1 *adapter = NULL;
|
||||
VkResult result = VK_SUCCESS;
|
||||
for (UINT i = 0; SUCCEEDED(IDXGIFactory4_EnumAdapters1(factory, i, &adapter)); ++i) {
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
IDXGIAdapter1_GetDesc1(adapter, &desc);
|
||||
if (instance->debug_flags & DZN_DEBUG_WARP) {
|
||||
if ((desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) == 0) {
|
||||
IDXGIAdapter1_Release(adapter);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
VkResult result =
|
||||
dzn_physical_device_create(instance, adapter, &desc);
|
||||
result =
|
||||
dzn_instance_add_physical_device(instance, adapter);
|
||||
|
||||
IDXGIAdapter1_Release(adapter);
|
||||
if (result != VK_SUCCESS) {
|
||||
IDXGIFactory4_Release(factory);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
IDXGIFactory4_Release(factory);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
|
||||
VK_OUTARRAY_MAKE_TYPED(VkPhysicalDevice, out, pPhysicalDevices,
|
||||
|
@ -1804,7 +1813,8 @@ dzn_device_create_root_sig(struct dzn_device *device,
|
|||
{
|
||||
struct dzn_instance *instance =
|
||||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
ID3D10Blob *sig, *error;
|
||||
ID3D12RootSignature *root_sig = NULL;
|
||||
ID3DBlob *sig = NULL, *error = NULL;
|
||||
|
||||
if (FAILED(instance->d3d12.serialize_root_sig(desc,
|
||||
&sig, &error))) {
|
||||
|
@ -1817,21 +1827,22 @@ dzn_device_create_root_sig(struct dzn_device *device,
|
|||
error_msg);
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
ID3D12Device1_CreateRootSignature(device->dev, 0,
|
||||
ID3D10Blob_GetBufferPointer(sig),
|
||||
ID3D10Blob_GetBufferSize(sig),
|
||||
&IID_ID3D12RootSignature,
|
||||
&root_sig);
|
||||
|
||||
out:
|
||||
if (error)
|
||||
ID3D10Blob_Release(error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ID3D12RootSignature *root_sig;
|
||||
if (FAILED(ID3D12Device1_CreateRootSignature(device->dev, 0,
|
||||
ID3D10Blob_GetBufferPointer(sig),
|
||||
ID3D10Blob_GetBufferSize(sig),
|
||||
&IID_ID3D12RootSignature,
|
||||
&root_sig))) {
|
||||
if (sig)
|
||||
ID3D10Blob_Release(sig);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ID3D10Blob_Release(sig);
|
||||
return root_sig;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue