winevulkan: Override VK_USE_64_BIT_PTR_DEFINES instead of handle definition.

A bit simpler and more consistent because currently VK_USE_64_BIT_PTR_DEFINES
can be 1 but non dipatchable handles are always unit64_t.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Georg Lehmann 2021-04-25 13:22:14 +02:00 committed by Alexandre Julliard
parent feb88dfedb
commit 9ca95e3265
2 changed files with 23 additions and 13 deletions

View File

@ -319,15 +319,11 @@ class VkDefine(object):
# <type category="define" name="some_name">some_value</type> # <type category="define" name="some_name">some_value</type>
name = define.attrib.get("name") name = define.attrib.get("name")
# We override behavior of VK_DEFINE_NON_DISPATCHABLE handle as the default # We override behavior of VK_USE_64_BIT_PTR_DEFINES as the default non-dispatchable handle
# definition various between 64-bit (uses pointers) and 32-bit (uses uint64_t). # definition various between 64-bit (uses pointers) and 32-bit (uses uint64_t).
# This complicates TRACEs in the thunks, so just use uint64_t. # This complicates TRACEs in the thunks, so just use uint64_t.
if name == "VK_DEFINE_NON_DISPATCHABLE_HANDLE": if name == "VK_USE_64_BIT_PTR_DEFINES":
value = "#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;" value = "#define VK_USE_64_BIT_PTR_DEFINES 0"
# As VK_DEFINE_NON_DISPATCHABLE handle is overriden above, we must also override
# VK_NULL_HANDLE so that its type will match.
elif name == "VK_NULL_HANDLE":
value = "#define VK_NULL_HANDLE 0ULL"
else: else:
value = define.text value = define.text
return VkDefine(name, value) return VkDefine(name, value)

View File

@ -449,16 +449,30 @@
#define VK_HEADER_VERSION 176 #define VK_HEADER_VERSION 176
#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION) #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION)
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
#ifndef VK_USE_64_BIT_PTR_DEFINES
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define VK_USE_64_BIT_PTR_DEFINES 1
#else
#define VK_USE_64_BIT_PTR_DEFINES 0 #define VK_USE_64_BIT_PTR_DEFINES 0
#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE
#if (VK_USE_64_BIT_PTR_DEFINES==1)
#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L))
#define VK_NULL_HANDLE nullptr
#else
#define VK_NULL_HANDLE ((void*)0)
#endif #endif
#endif #else
#define VK_NULL_HANDLE 0ULL #define VK_NULL_HANDLE 0ULL
#endif
#endif
#ifndef VK_NULL_HANDLE
#define VK_NULL_HANDLE 0
#endif
#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE
#if (VK_USE_64_BIT_PTR_DEFINES==1)
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
#else
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
#endif
#endif
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer)