libs/vkd3d: Use "< 0" to test VkResult for errors.

For consistency.
This commit is contained in:
Józef Kucia 2016-10-11 13:43:04 +02:00
parent 4a558d5a4a
commit a1082ec954
4 changed files with 15 additions and 15 deletions

View File

@ -506,7 +506,7 @@ static HRESULT vkd3d_begin_command_buffer(struct d3d12_command_list *list)
begin_info.flags = 0;
begin_info.pInheritanceInfo = NULL;
if ((vr = VK_CALL(vkBeginCommandBuffer(list->vk_command_buffer, &begin_info))))
if ((vr = VK_CALL(vkBeginCommandBuffer(list->vk_command_buffer, &begin_info))) < 0)
{
WARN("Failed to begin command buffer, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -527,7 +527,7 @@ static HRESULT vkd3d_reset_command_buffer(struct d3d12_command_list *list)
VkResult vr;
if ((vr = VK_CALL(vkResetCommandBuffer(list->vk_command_buffer,
VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT))))
VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT))) < 0)
{
WARN("Failed to reset command buffer, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -560,7 +560,7 @@ static HRESULT vkd3d_command_allocator_allocate_command_list(struct d3d12_comman
command_buffer_info.commandBufferCount = 1;
if ((vr = VK_CALL(vkAllocateCommandBuffers(device->vk_device, &command_buffer_info,
&list->vk_command_buffer))))
&list->vk_command_buffer))) < 0)
{
WARN("Failed to allocate Vulkan command buffer, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -866,7 +866,7 @@ static HRESULT d3d12_command_allocator_init(struct d3d12_command_allocator *allo
}
if ((vr = VK_CALL(vkCreateCommandPool(device->vk_device, &command_pool_info, NULL,
&allocator->vk_command_pool))))
&allocator->vk_command_pool))) < 0)
{
WARN("Failed to create Vulkan command pool, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -1056,7 +1056,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_Close(ID3D12GraphicsCommandL
}
vk_procs = &list->device->vk_procs;
if ((vr = VK_CALL(vkEndCommandBuffer(list->vk_command_buffer))))
if ((vr = VK_CALL(vkEndCommandBuffer(list->vk_command_buffer))) < 0)
{
WARN("Failed to end command buffer, vr %d.\n", vr);
return hresult_from_vk_result(vr);

View File

@ -326,7 +326,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device)
/* Select a physical device */
physical_device_count = 0;
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(instance, &physical_device_count, NULL))))
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(instance, &physical_device_count, NULL))) < 0)
{
ERR("Failed to enumerate physical devices, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -340,7 +340,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device)
return E_OUTOFMEMORY;
TRACE("Enumerating %u physical device(s).\n", physical_device_count);
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(instance, &physical_device_count, physical_devices))))
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(instance, &physical_device_count, physical_devices))) < 0)
{
ERR("Failed to enumerate physical devices, vr %d.\n", vr);
vkd3d_free(physical_devices);
@ -426,7 +426,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device)
vr = VK_CALL(vkCreateDevice(selected_physical_device, &device_info, NULL, &vk_device));
vkd3d_free(queue_info);
if (vr)
if (vr < 0)
{
ERR("Failed to create Vulkan device, vr %d.\n", vr);
return hresult_from_vk_result(vr);

View File

@ -95,7 +95,7 @@ static HRESULT vkd3d_create_buffer(struct d3d12_resource *resource, struct d3d12
buffer_info.queueFamilyIndexCount = 0;
buffer_info.pQueueFamilyIndices = 0;
if ((vr = VK_CALL(vkCreateBuffer(device->vk_device, &buffer_info, NULL, &resource->u.vk_buffer))))
if ((vr = VK_CALL(vkCreateBuffer(device->vk_device, &buffer_info, NULL, &resource->u.vk_buffer))) < 0)
{
WARN("Failed to create Vulkan buffer, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -186,7 +186,7 @@ static HRESULT vkd3d_create_image(struct d3d12_resource *resource, struct d3d12_
FIXME("Ignoring initial state %#x.\n", initial_state);
if ((vr = VK_CALL(vkCreateImage(device->vk_device, &image_info, NULL, &resource->u.vk_image))))
if ((vr = VK_CALL(vkCreateImage(device->vk_device, &image_info, NULL, &resource->u.vk_image))) < 0)
{
WARN("Failed to create Vulkan image, vr %d.\n", vr);
return hresult_from_vk_result(vr);
@ -257,7 +257,7 @@ static HRESULT vkd3d_allocate_device_memory(struct d3d12_device *device,
TRACE("Allocating memory type %u.\n", allocate_info.memoryTypeIndex);
if ((vr = VK_CALL(vkAllocateMemory(device->vk_device, &allocate_info, NULL, vk_memory))))
if ((vr = VK_CALL(vkAllocateMemory(device->vk_device, &allocate_info, NULL, vk_memory))) < 0)
{
WARN("Failed to allocate device memory, vr %d.\n", vr);
*vk_memory = VK_NULL_HANDLE;
@ -282,7 +282,7 @@ static HRESULT vkd3d_allocate_buffer_memory(struct d3d12_resource *resource, str
&memory_requirements, &resource->vk_memory)))
return hr;
if ((vr = VK_CALL(vkBindBufferMemory(device->vk_device, resource->u.vk_buffer, resource->vk_memory, 0))))
if ((vr = VK_CALL(vkBindBufferMemory(device->vk_device, resource->u.vk_buffer, resource->vk_memory, 0))) < 0)
{
WARN("Failed to bind memory, vr %d.\n", vr);
VK_CALL(vkFreeMemory(device->vk_device, resource->vk_memory, NULL));
@ -309,7 +309,7 @@ static HRESULT vkd3d_allocate_image_memory(struct d3d12_resource *resource, stru
&memory_requirements, &resource->vk_memory)))
return hr;
if ((vr = VK_CALL(vkBindImageMemory(device->vk_device, resource->u.vk_image, resource->vk_memory, 0))))
if ((vr = VK_CALL(vkBindImageMemory(device->vk_device, resource->u.vk_image, resource->vk_memory, 0))) < 0)
{
WARN("Failed to bind memory, vr %d.\n", vr);
VK_CALL(vkFreeMemory(device->vk_device, resource->vk_memory, NULL));
@ -475,7 +475,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_Map(ID3D12Resource *iface, UINT
if (!resource->map_count)
{
if ((vr = VK_CALL(vkMapMemory(device->vk_device, resource->vk_memory,
0, VK_WHOLE_SIZE, 0, &resource->map_data))))
0, VK_WHOLE_SIZE, 0, &resource->map_data))) < 0)
{
WARN("Failed to map device memory, vr %d.\n", vr);
return hresult_from_vk_result(vr);

View File

@ -172,7 +172,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
pipeline_layout_info.pPushConstantRanges = NULL;
if ((vr = VK_CALL(vkCreatePipelineLayout(device->vk_device, &pipeline_layout_info, NULL,
&root_signature->vk_pipeline_layout))))
&root_signature->vk_pipeline_layout))) < 0)
{
WARN("Failed to create Vulkan pipeline layout, vr %d.\n", vr);
return hresult_from_vk_result(vr);