libs/vkd3d: Use HRESULT as preferred error code.

For consistency.

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:
Józef Kucia 2018-04-11 13:21:43 +02:00 committed by Alexandre Julliard
parent e6e62e8a8e
commit 0e86a6b353
6 changed files with 12 additions and 12 deletions

View File

@ -28,8 +28,6 @@
# include <vulkan/vulkan.h>
#endif /* VKD3D_NO_VULKAN_H */
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -45,12 +43,12 @@ enum vkd3d_structure_type
VKD3D_FORCE_32_BIT_ENUM(VKD3D_STRUCTURE_TYPE),
};
typedef bool (*PFN_vkd3d_signal_event)(HANDLE event);
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);
typedef void * (*PFN_vkd3d_thread)(void *data);
typedef void * (*PFN_vkd3d_create_thread)(PFN_vkd3d_thread thread_main, void *data);
typedef bool (*PFN_vkd3d_join_thread)(void *thread);
typedef HRESULT (*PFN_vkd3d_join_thread)(void *thread);
struct vkd3d_instance;

View File

@ -31,7 +31,7 @@ extern "C" {
#define INFINITE (~0u)
HANDLE vkd3d_create_event(void);
bool vkd3d_signal_event(HANDLE event);
HRESULT vkd3d_signal_event(HANDLE event);
unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds);
void vkd3d_destroy_event(HANDLE event);

View File

@ -159,7 +159,7 @@ unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds)
return WAIT_FAILED;
}
bool vkd3d_signal_event(HANDLE event)
HRESULT vkd3d_signal_event(HANDLE event)
{
struct vkd3d_event *impl = event;
int rc;
@ -169,13 +169,13 @@ bool vkd3d_signal_event(HANDLE event)
if ((rc = pthread_mutex_lock(&impl->mutex)))
{
ERR("Failed to lock mutex, error %d.\n", rc);
return false;
return E_FAIL;
}
impl->is_signaled = true;
pthread_cond_signal(&impl->cond);
pthread_mutex_unlock(&impl->mutex);
return true;
return S_OK;
}
void vkd3d_destroy_event(HANDLE event)

View File

@ -288,6 +288,7 @@ HRESULT vkd3d_fence_worker_start(struct vkd3d_fence_worker *worker,
HRESULT vkd3d_fence_worker_stop(struct vkd3d_fence_worker *worker,
struct d3d12_device *device)
{
HRESULT hr;
int rc;
TRACE("worker %p.\n", worker);
@ -305,9 +306,9 @@ HRESULT vkd3d_fence_worker_stop(struct vkd3d_fence_worker *worker,
if (device->join_thread)
{
if (!device->join_thread(worker->u.handle))
if (FAILED(hr = device->join_thread(worker->u.handle)))
{
ERR("Failed to join fence worker thread.\n");
ERR("Failed to join fence worker thread, hr %#x.\n", hr);
return E_FAIL;
}
}

View File

@ -17,6 +17,7 @@
*/
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>

View File

@ -54,10 +54,10 @@ static ULONG resource_get_internal_refcount(ID3D12Resource *resource)
return vkd3d_resource_decref(resource);
}
static bool signal_event(HANDLE event)
static HRESULT signal_event(HANDLE event)
{
trace("Signal event %p.\n", event);
return true;
return S_OK;
}
static const struct vkd3d_instance_create_info instance_default_create_info =