summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-30 10:31:44 -0800
committerJason Ekstrand <[email protected]>2015-11-30 10:58:02 -0800
commit3db43e8f3e60f8dc746eb4ab2e86f6b1b32d248a (patch)
treeda7417bde92a03475d090f621a43310e00ed8c57 /include
parent5cb57806b2fe45bbd902bb4e21d7ea216e65834e (diff)
vk/0.210.0: Switch to the new-style handle declarations
Diffstat (limited to 'include')
-rw-r--r--include/vulkan/vk_ext_khr_device_swapchain.h2
-rw-r--r--include/vulkan/vulkan.h87
2 files changed, 30 insertions, 59 deletions
diff --git a/include/vulkan/vk_ext_khr_device_swapchain.h b/include/vulkan/vk_ext_khr_device_swapchain.h
index 3bf73c84a96..af95ff0cdfb 100644
--- a/include/vulkan/vk_ext_khr_device_swapchain.h
+++ b/include/vulkan/vk_ext_khr_device_swapchain.h
@@ -41,7 +41,7 @@ extern "C"
// ------------------------------------------------------------------------------------------------
// Objects
-VK_DEFINE_NONDISP_HANDLE(VkSwapchainKHR);
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR);
// ------------------------------------------------------------------------------------------------
// Enumeration constants
diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h
index 03bcefea50a..fd898736fc5 100644
--- a/include/vulkan/vulkan.h
+++ b/include/vulkan/vulkan.h
@@ -44,46 +44,17 @@ extern "C" {
#define VK_API_VERSION VK_MAKE_VERSION(0, 170, 2)
-#if defined(__cplusplus) && (_MSC_VER >= 1800 || __cplusplus >= 201103L)
- #define VK_NULL_HANDLE nullptr
-#else
- #define VK_NULL_HANDLE 0
-#endif
+#define VK_NULL_HANDLE 0
+
+
+
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
-#define VK_DEFINE_HANDLE(obj) typedef struct obj##_T* obj;
-
-
-#if defined(__cplusplus)
- #if ((defined(_MSC_VER) && _MSC_VER >= 1800) || __cplusplus >= 201103L)
- // The bool operator only works if there are no implicit conversions from an obj to
- // a bool-compatible type, which can then be used to unintentionally violate type safety.
- // C++11 and above supports the "explicit" keyword on conversion operators to stop this
- // from happening. Otherwise users of C++ below C++11 won't get direct access to evaluating
- // the object handle as a bool in expressions like:
- // if (obj) vkDestroy(obj);
- #define VK_NONDISP_HANDLE_OPERATOR_BOOL() explicit operator bool() const { return handle != 0; }
- #define VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
- explicit obj(uint64_t x) : handle(x) { } \
- obj(decltype(nullptr)) : handle(0) { }
- #else
- #define VK_NONDISP_HANDLE_OPERATOR_BOOL()
- #define VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
- obj(uint64_t x) : handle(x) { }
- #endif
- #define VK_DEFINE_NONDISP_HANDLE(obj) \
- struct obj { \
- obj() : handle(0) { } \
- VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
- obj& operator =(uint64_t x) { handle = x; return *this; } \
- bool operator==(const obj& other) const { return handle == other.handle; } \
- bool operator!=(const obj& other) const { return handle != other.handle; } \
- bool operator!() const { return !handle; } \
- VK_NONDISP_HANDLE_OPERATOR_BOOL() \
- uint64_t handle; \
- };
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+ #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
#else
- #define VK_DEFINE_NONDISP_HANDLE(obj) typedef struct obj##_T { uint64_t handle; } obj;
+ #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
#endif
@@ -98,27 +69,27 @@ VK_DEFINE_HANDLE(VkPhysicalDevice)
VK_DEFINE_HANDLE(VkDevice)
VK_DEFINE_HANDLE(VkQueue)
VK_DEFINE_HANDLE(VkCmdBuffer)
-VK_DEFINE_NONDISP_HANDLE(VkFence)
-VK_DEFINE_NONDISP_HANDLE(VkDeviceMemory)
-VK_DEFINE_NONDISP_HANDLE(VkBuffer)
-VK_DEFINE_NONDISP_HANDLE(VkImage)
-VK_DEFINE_NONDISP_HANDLE(VkSemaphore)
-VK_DEFINE_NONDISP_HANDLE(VkEvent)
-VK_DEFINE_NONDISP_HANDLE(VkQueryPool)
-VK_DEFINE_NONDISP_HANDLE(VkBufferView)
-VK_DEFINE_NONDISP_HANDLE(VkImageView)
-VK_DEFINE_NONDISP_HANDLE(VkShaderModule)
-VK_DEFINE_NONDISP_HANDLE(VkShader)
-VK_DEFINE_NONDISP_HANDLE(VkPipelineCache)
-VK_DEFINE_NONDISP_HANDLE(VkPipelineLayout)
-VK_DEFINE_NONDISP_HANDLE(VkRenderPass)
-VK_DEFINE_NONDISP_HANDLE(VkPipeline)
-VK_DEFINE_NONDISP_HANDLE(VkDescriptorSetLayout)
-VK_DEFINE_NONDISP_HANDLE(VkSampler)
-VK_DEFINE_NONDISP_HANDLE(VkDescriptorPool)
-VK_DEFINE_NONDISP_HANDLE(VkDescriptorSet)
-VK_DEFINE_NONDISP_HANDLE(VkFramebuffer)
-VK_DEFINE_NONDISP_HANDLE(VkCmdPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShader)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCmdPool)
#define VK_LOD_CLAMP_NONE 1000.0f
#define VK_REMAINING_MIP_LEVELS (~0U)