From: Chad Versace Date: Wed, 7 Oct 2015 18:43:13 +0000 (-0700) Subject: vk/0.170.2: Update C++ errata and typedefs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2f94e3a0d41c1f100f477498d3173ed1716eabc;p=mesa.git vk/0.170.2: Update C++ errata and typedefs --- diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 62305a60116..321a1d60b1b 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -55,7 +55,7 @@ extern "C" { #if defined(__cplusplus) - #if (_MSC_VER >= 1800 || __cplusplus >= 201103L) + #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 @@ -63,13 +63,18 @@ extern "C" { // 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) { } \ - obj(uint64_t x) : handle(x) { } \ + 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; } \ @@ -83,6 +88,10 @@ extern "C" { +typedef uint32_t VkBool32; +typedef uint32_t VkFlags; +typedef uint64_t VkDeviceSize; +typedef uint32_t VkSampleMask; VK_DEFINE_HANDLE(VkInstance) VK_DEFINE_HANDLE(VkPhysicalDevice)