vulkan: Update the XML and headers to 1.2.131
[mesa.git] / include / vulkan / vk_platform.h
index 7ba8d77b875ee23ba3da19a2e2467f193f8c231f..dbb011285cdbb7964aa1bdae1d5db514f53de51a 100644 (file)
@@ -2,31 +2,24 @@
 // File: vk_platform.h
 //
 /*
-** Copyright (c) 2014-2015 The Khronos Group Inc.
+** Copyright (c) 2014-2020 The Khronos Group Inc.
 **
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
 **
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
+**     http://www.apache.org/licenses/LICENSE-2.0
 **
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
 */
 
 
-#ifndef __VK_PLATFORM_H__
-#define __VK_PLATFORM_H__
+#ifndef VK_PLATFORM_H_
+#define VK_PLATFORM_H_
 
 #ifdef __cplusplus
 extern "C"
@@ -39,15 +32,40 @@ extern "C"
 ***************************************************************************************************
 */
 
+/* Platform-specific calling convention macros.
+ *
+ * Platforms should define these so that Vulkan clients call Vulkan commands
+ * with the same calling conventions that the Vulkan implementation expects.
+ *
+ * VKAPI_ATTR - Placed before the return type in function declarations.
+ *              Useful for C++11 and GCC/Clang-style function attribute syntax.
+ * VKAPI_CALL - Placed after the return type in function declarations.
+ *              Useful for MSVC-style calling convention syntax.
+ * VKAPI_PTR  - Placed between the '(' and '*' in function pointer types.
+ *
+ * Function declaration:  VKAPI_ATTR void VKAPI_CALL vkCommand(void);
+ * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
+ */
 #if defined(_WIN32)
-    // On Windows, VKAPI should equate to the __stdcall convention
-    #define VKAPI   __stdcall
-#elif defined(__GNUC__)
-    // On other platforms using GCC, VKAPI stays undefined
-    #define VKAPI
+    // On Windows, Vulkan commands use the stdcall convention
+    #define VKAPI_ATTR
+    #define VKAPI_CALL __stdcall
+    #define VKAPI_PTR  VKAPI_CALL
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
+    #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
+    // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
+    // calling convention, i.e. float parameters are passed in registers. This
+    // is true even if the rest of the application passes floats on the stack,
+    // as it does by default when compiling for the armeabi-v7a NDK ABI.
+    #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
+    #define VKAPI_CALL
+    #define VKAPI_PTR  VKAPI_ATTR
 #else
-    // Unsupported Platform!
-    #error "Unsupported OS Platform detected!"
+    // On other platforms, use the default calling convention
+    #define VKAPI_ATTR
+    #define VKAPI_CALL
+    #define VKAPI_PTR
 #endif
 
 #include <stddef.h>
@@ -67,24 +85,8 @@ extern "C"
     #endif
 #endif // !defined(VK_NO_STDINT_H)
 
-typedef uint64_t   VkDeviceSize;
-typedef uint32_t   VkBool32;
-
-typedef uint32_t   VkSampleMask;
-typedef uint32_t   VkFlags;
-
-#if (UINTPTR_MAX >= UINT64_MAX)
-    #define VK_UINTPTRLEAST64_MAX UINTPTR_MAX
-
-    typedef uintptr_t VkUintPtrLeast64;
-#else
-    #define VK_UINTPTRLEAST64_MAX UINT64_MAX
-
-    typedef uint64_t  VkUintPtrLeast64;
-#endif
-
 #ifdef __cplusplus
 } // extern "C"
 #endif // __cplusplus
 
-#endif // __VK_PLATFORM_H__
+#endif