From 65aab7b47b6ae7a2ce6056ff9957131c4fb25712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 6 Feb 2018 13:03:04 +0100 Subject: [PATCH] libs/vkd3d: Use PFN prefix for function pointer typedefs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A more common convention, e.g. Vulkan uses it. Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- include/vkd3d.h | 52 ++++++++++++++--------------- libs/vkd3d-utils/vkd3d_utils_main.c | 2 +- libs/vkd3d/device.c | 12 +++---- libs/vkd3d/vkd3d_private.h | 12 +++---- tests/vkd3d_api.c | 8 ++--- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/include/vkd3d.h b/include/vkd3d.h index 99a62220..6ec85dbf 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -34,24 +34,24 @@ extern "C" { #endif /* __cplusplus */ -typedef bool (*vkd3d_signal_event_pfn)(HANDLE event); +typedef bool (*PFN_vkd3d_signal_event)(HANDLE event); -typedef void * (*vkd3d_thread_pfn)(void *data); +typedef void * (*PFN_vkd3d_thread)(void *data); -typedef void * (*vkd3d_create_thread_pfn)(vkd3d_thread_pfn thread_main, void *data); -typedef bool (*vkd3d_join_thread_pfn)(void *thread); +typedef void * (*PFN_vkd3d_create_thread)(PFN_vkd3d_thread thread_main, void *data); +typedef bool (*PFN_vkd3d_join_thread)(void *thread); struct vkd3d_instance; struct vkd3d_instance_create_info { - vkd3d_signal_event_pfn signal_event_pfn; - vkd3d_create_thread_pfn create_thread_pfn; - vkd3d_join_thread_pfn join_thread_pfn; + PFN_vkd3d_signal_event pfn_signal_event; + PFN_vkd3d_create_thread pfn_create_thread; + PFN_vkd3d_join_thread pfn_join_thread; size_t wchar_size; /* If set to NULL, libvkd3d loads libvulkan. */ - PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr_pfn; + PFN_vkGetInstanceProcAddr pfn_vkGetInstanceProcAddr; const char * const *instance_extensions; uint32_t instance_extension_count; @@ -114,35 +114,35 @@ VkFormat vkd3d_get_vk_format(DXGI_FORMAT format); /* * Function pointer typedefs for vkd3d functions. */ -typedef HRESULT (*vkd3d_create_instance_pfn)(const struct vkd3d_instance_create_info *create_info, +typedef HRESULT (*PFN_vkd3d_create_instance)(const struct vkd3d_instance_create_info *create_info, struct vkd3d_instance **instance); -typedef ULONG (*vkd3d_instance_decref_pfn)(struct vkd3d_instance *instance); -typedef VkInstance (*vkd3d_instance_get_vk_instance_pfn)(struct vkd3d_instance *instance); -typedef ULONG (*vkd3d_instance_incref_pfn)(struct vkd3d_instance *instance); +typedef ULONG (*PFN_vkd3d_instance_decref)(struct vkd3d_instance *instance); +typedef VkInstance (*PFN_vkd3d_instance_get_vk_instance)(struct vkd3d_instance *instance); +typedef ULONG (*PFN_vkd3d_instance_incref)(struct vkd3d_instance *instance); -typedef HRESULT (*vkd3d_create_device_pfn)(const struct vkd3d_device_create_info *create_info, +typedef HRESULT (*PFN_vkd3d_create_device)(const struct vkd3d_device_create_info *create_info, REFIID iid, void **device); -typedef IUnknown * (*vkd3d_get_device_parent_pfn)(ID3D12Device *device); -typedef VkDevice (*vkd3d_get_vk_device_pfn)(ID3D12Device *device); -typedef VkPhysicalDevice (*vkd3d_get_vk_physical_device_pfn)(ID3D12Device *device); -typedef struct vkd3d_instance * (*vkd3d_instance_from_device_pfn)(ID3D12Device *device); +typedef IUnknown * (*PFN_vkd3d_get_device_parent)(ID3D12Device *device); +typedef VkDevice (*PFN_vkd3d_get_vk_device)(ID3D12Device *device); +typedef VkPhysicalDevice (*PFN_vkd3d_get_vk_physical_device)(ID3D12Device *device); +typedef struct vkd3d_instance * (*PFN_vkd3d_instance_from_device)(ID3D12Device *device); -typedef uint32_t (*vkd3d_get_vk_queue_family_index_pfn)(ID3D12CommandQueue *queue); -typedef VkQueue (*vkd3d_acquire_vk_queue_pfn)(ID3D12CommandQueue *queue); -typedef void (*vkd3d_release_vk_queue_pfn)(ID3D12CommandQueue *queue); +typedef uint32_t (*PFN_vkd3d_get_vk_queue_family_index)(ID3D12CommandQueue *queue); +typedef VkQueue (*PFN_vkd3d_acquire_vk_queue)(ID3D12CommandQueue *queue); +typedef void (*PFN_vkd3d_release_vk_queue)(ID3D12CommandQueue *queue); -typedef HRESULT (*vkd3d_create_image_resource_pfn)(ID3D12Device *device, const D3D12_RESOURCE_DESC *desc, +typedef HRESULT (*PFN_vkd3d_create_image_resource)(ID3D12Device *device, const D3D12_RESOURCE_DESC *desc, VkImage vk_image, unsigned int resource_flags, ID3D12Resource **resource); -typedef ULONG (*vkd3d_resource_decref_pfn)(ID3D12Resource *resource); -typedef ULONG (*vkd3d_resource_incref_pfn)(ID3D12Resource *resource); +typedef ULONG (*PFN_vkd3d_resource_decref)(ID3D12Resource *resource); +typedef ULONG (*PFN_vkd3d_resource_incref)(ID3D12Resource *resource); -typedef HRESULT (*vkd3d_serialize_root_signature_pfn)(const D3D12_ROOT_SIGNATURE_DESC *desc, +typedef HRESULT (*PFN_vkd3d_serialize_root_signature)(const D3D12_ROOT_SIGNATURE_DESC *desc, D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob); -typedef HRESULT (*vkd3d_create_root_signature_deserializer_pfn)(const void *data, SIZE_T data_size, +typedef HRESULT (*PFN_vkd3d_create_root_signature_deserializer)(const void *data, SIZE_T data_size, REFIID iid, void **deserializer); -typedef VkFormat (*vkd3d_get_vk_format_pfn)(DXGI_FORMAT format); +typedef VkFormat (*PFN_vkd3d_get_vk_format)(DXGI_FORMAT format); #ifdef __cplusplus } diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c index 4537de05..ba64d406 100644 --- a/libs/vkd3d-utils/vkd3d_utils_main.c +++ b/libs/vkd3d-utils/vkd3d_utils_main.c @@ -48,7 +48,7 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, FIXME("Ignoring adapter %p.\n", adapter); memset(&instance_create_info, 0, sizeof(instance_create_info)); - instance_create_info.signal_event_pfn = vkd3d_signal_event; + instance_create_info.pfn_signal_event = vkd3d_signal_event; instance_create_info.wchar_size = sizeof(WCHAR); instance_create_info.instance_extensions = instance_extensions; instance_create_info.instance_extension_count = ARRAY_SIZE(instance_extensions); diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index c59ba879..31fee8af 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -246,12 +246,12 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, VkResult vr; HRESULT hr; - if (!create_info->signal_event_pfn) + if (!create_info->pfn_signal_event) { ERR("Invalid signal event function pointer.\n"); return E_INVALIDARG; } - if (!create_info->create_thread_pfn != !create_info->join_thread_pfn) + if (!create_info->pfn_create_thread != !create_info->pfn_join_thread) { ERR("Invalid create/join thread function pointers.\n"); return E_INVALIDARG; @@ -262,12 +262,12 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, return E_INVALIDARG; } - instance->signal_event = create_info->signal_event_pfn; - instance->create_thread = create_info->create_thread_pfn; - instance->join_thread = create_info->join_thread_pfn; + instance->signal_event = create_info->pfn_signal_event; + instance->create_thread = create_info->pfn_create_thread; + instance->join_thread = create_info->pfn_join_thread; instance->wchar_size = create_info->wchar_size; - if (FAILED(hr = vkd3d_init_vk_global_procs(instance, create_info->vkGetInstanceProcAddr_pfn))) + if (FAILED(hr = vkd3d_init_vk_global_procs(instance, create_info->pfn_vkGetInstanceProcAddr))) { ERR("Failed to initialize Vulkan global procs, hr %#x.\n", hr); return hr; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index acf7824a..f2228712 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -87,9 +87,9 @@ struct vkd3d_instance VkInstance vk_instance; struct vkd3d_vk_instance_procs vk_procs; - vkd3d_signal_event_pfn signal_event; - vkd3d_create_thread_pfn create_thread; - vkd3d_join_thread_pfn join_thread; + PFN_vkd3d_signal_event signal_event; + PFN_vkd3d_create_thread create_thread; + PFN_vkd3d_join_thread join_thread; size_t wchar_size; struct vkd3d_vulkan_info vk_info; @@ -640,7 +640,7 @@ struct d3d12_device VkDevice vk_device; VkPhysicalDevice vk_physical_device; struct vkd3d_vk_device_procs vk_procs; - vkd3d_signal_event_pfn signal_event; + PFN_vkd3d_signal_event signal_event; size_t wchar_size; struct vkd3d_gpu_va_allocator gpu_va_allocator; @@ -663,8 +663,8 @@ struct d3d12_device struct vkd3d_instance *vkd3d_instance; - vkd3d_create_thread_pfn create_thread; - vkd3d_join_thread_pfn join_thread; + PFN_vkd3d_create_thread create_thread; + PFN_vkd3d_join_thread join_thread; IUnknown *parent; LUID adapter_luid; diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c index 71357377..abef8675 100644 --- a/tests/vkd3d_api.c +++ b/tests/vkd3d_api.c @@ -46,7 +46,7 @@ static bool signal_event(HANDLE event) static const struct vkd3d_instance_create_info instance_default_create_info = { .wchar_size = sizeof(WCHAR), - .signal_event_pfn = signal_event, + .pfn_signal_event = signal_event, }; static const struct vkd3d_device_create_info device_default_create_info = @@ -134,12 +134,12 @@ static void test_create_instance(void) ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); create_info = instance_default_create_info; - create_info.signal_event_pfn = NULL; + create_info.pfn_signal_event = NULL; hr = vkd3d_create_instance(&create_info, &instance); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); create_info = instance_default_create_info; - create_info.vkGetInstanceProcAddr_pfn = vkGetInstanceProcAddr; + create_info.pfn_vkGetInstanceProcAddr = vkGetInstanceProcAddr; hr = vkd3d_create_instance(&create_info, &instance); ok(hr == S_OK, "Failed to create instance, hr %#x.\n", hr); refcount = vkd3d_instance_decref(instance); @@ -405,7 +405,7 @@ static void test_required_device_extensions(void) HRESULT hr; instance_create_info = instance_default_create_info; - instance_create_info.vkGetInstanceProcAddr_pfn = fake_vkGetInstanceProcAddr; + instance_create_info.pfn_vkGetInstanceProcAddr = fake_vkGetInstanceProcAddr; hr = vkd3d_create_instance(&instance_create_info, &instance); ok(hr == S_OK, "Failed to create instance, hr %#x.\n", hr);