Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 1 | // |
Courtney Goeltzenleuchter | 2040b43 | 2015-04-09 11:52:55 -0600 | [diff] [blame] | 2 | // File: vk_platform.h |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 3 | // |
| 4 | /* |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame^] | 5 | ** Copyright (c) 2014-2015 The Khronos Group Inc. |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 6 | ** |
| 7 | ** Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | ** copy of this software and/or associated documentation files (the |
| 9 | ** "Materials"), to deal in the Materials without restriction, including |
| 10 | ** without limitation the rights to use, copy, modify, merge, publish, |
| 11 | ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 12 | ** permit persons to whom the Materials are furnished to do so, subject to |
| 13 | ** the following conditions: |
| 14 | ** |
| 15 | ** The above copyright notice and this permission notice shall be included |
| 16 | ** in all copies or substantial portions of the Materials. |
| 17 | ** |
| 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 25 | */ |
| 26 | |
| 27 | |
Courtney Goeltzenleuchter | 2040b43 | 2015-04-09 11:52:55 -0600 | [diff] [blame] | 28 | #ifndef __VK_PLATFORM_H__ |
| 29 | #define __VK_PLATFORM_H__ |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" |
| 33 | { |
| 34 | #endif // __cplusplus |
| 35 | |
| 36 | /* |
| 37 | *************************************************************************************************** |
| 38 | * Platform-specific directives and type declarations |
| 39 | *************************************************************************************************** |
| 40 | */ |
| 41 | |
| 42 | #if defined(_WIN32) |
| 43 | // Ensure we don't pick up min/max macros from Winddef.h |
| 44 | #define NOMINMAX |
| 45 | |
| 46 | // On Windows, VKAPI should equate to the __stdcall convention |
| 47 | #define VKAPI __stdcall |
| 48 | |
| 49 | // C99: |
| 50 | #ifndef __cplusplus |
| 51 | #undef inline |
| 52 | #define inline __inline |
| 53 | #endif // __cplusplus |
| 54 | #elif defined(__GNUC__) |
| 55 | // On other platforms using GCC, VKAPI stays undefined |
| 56 | #define VKAPI |
| 57 | #else |
| 58 | // Unsupported Platform! |
| 59 | #error "Unsupported OS Platform detected!" |
| 60 | #endif |
| 61 | |
| 62 | #include <stddef.h> |
| 63 | |
| 64 | #if !defined(VK_NO_STDINT_H) |
| 65 | #if defined(_MSC_VER) && (_MSC_VER < 1600) |
| 66 | typedef signed __int8 int8_t; |
| 67 | typedef unsigned __int8 uint8_t; |
| 68 | typedef signed __int16 int16_t; |
| 69 | typedef unsigned __int16 uint16_t; |
| 70 | typedef signed __int32 int32_t; |
| 71 | typedef unsigned __int32 uint32_t; |
| 72 | typedef signed __int64 int64_t; |
| 73 | typedef unsigned __int64 uint64_t; |
| 74 | #else |
| 75 | #include <stdint.h> |
| 76 | #endif |
| 77 | #endif // !defined(VK_NO_STDINT_H) |
| 78 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 79 | typedef uint64_t VkDeviceSize; |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 80 | typedef uint32_t bool32_t; |
| 81 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 82 | typedef uint32_t VkSampleMask; |
| 83 | typedef uint32_t VkFlags; |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 84 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame^] | 85 | #if (UINTPTR_MAX >= UINT64_MAX) |
| 86 | #define VK_UINTPTRLEAST64_MAX UINTPTR_MAX |
| 87 | |
| 88 | typedef uintptr_t VkUintPtrLeast64; |
| 89 | #else |
| 90 | #define VK_UINTPTRLEAST64_MAX UINT64_MAX |
| 91 | |
| 92 | typedef uint64_t VkUintPtrLeast64; |
| 93 | #endif |
| 94 | |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 95 | #ifdef __cplusplus |
| 96 | } // extern "C" |
| 97 | #endif // __cplusplus |
| 98 | |
Courtney Goeltzenleuchter | 2040b43 | 2015-04-09 11:52:55 -0600 | [diff] [blame] | 99 | #endif // __VK_PLATFORM_H__ |