#ifndef __khrplatform_h_1#define __khrplatform_h_23/*4** Copyright (c) 2008-2018 The Khronos Group Inc.5**6** Permission is hereby granted, free of charge, to any person obtaining a7** copy of this software and/or associated documentation files (the8** "Materials"), to deal in the Materials without restriction, including9** without limitation the rights to use, copy, modify, merge, publish,10** distribute, sublicense, and/or sell copies of the Materials, and to11** permit persons to whom the Materials are furnished to do so, subject to12** the following conditions:13**14** The above copyright notice and this permission notice shall be included15** in all copies or substantial portions of the Materials.16**17** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,18** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.20** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY21** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.24*/2526/* Khronos platform-specific types and definitions.27*28* The master copy of khrplatform.h is maintained in the Khronos EGL29* Registry repository at https://github.com/KhronosGroup/EGL-Registry30* The last semantic modification to khrplatform.h was at commit ID:31* 67a3e0864c2d75ea5287b9f3d2eb74a74593669232*33* Adopters may modify this file to suit their platform. Adopters are34* encouraged to submit platform specific modifications to the Khronos35* group so that they can be included in future versions of this file.36* Please submit changes by filing pull requests or issues on37* the EGL Registry repository linked above.38*39*40* See the Implementer's Guidelines for information about where this file41* should be located on your system and for more details of its use:42* http://www.khronos.org/registry/implementers_guide.pdf43*44* This file should be included as45* #include <KHR/khrplatform.h>46* by Khronos client API header files that use its types and defines.47*48* The types in khrplatform.h should only be used to define API-specific types.49*50* Types defined in khrplatform.h:51* khronos_int8_t signed 8 bit52* khronos_uint8_t unsigned 8 bit53* khronos_int16_t signed 16 bit54* khronos_uint16_t unsigned 16 bit55* khronos_int32_t signed 32 bit56* khronos_uint32_t unsigned 32 bit57* khronos_int64_t signed 64 bit58* khronos_uint64_t unsigned 64 bit59* khronos_intptr_t signed same number of bits as a pointer60* khronos_uintptr_t unsigned same number of bits as a pointer61* khronos_ssize_t signed size62* khronos_usize_t unsigned size63* khronos_float_t signed 32 bit floating point64* khronos_time_ns_t unsigned 64 bit time in nanoseconds65* khronos_utime_nanoseconds_t unsigned time interval or absolute time in66* nanoseconds67* khronos_stime_nanoseconds_t signed time interval in nanoseconds68* khronos_boolean_enum_t enumerated boolean type. This should69* only be used as a base type when a client API's boolean type is70* an enum. Client APIs which use an integer or other type for71* booleans cannot use this as the base type for their boolean.72*73* Tokens defined in khrplatform.h:74*75* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.76*77* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.78* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.79*80* Calling convention macros defined in this file:81* KHRONOS_APICALL82* KHRONOS_APIENTRY83* KHRONOS_APIATTRIBUTES84*85* These may be used in function prototypes as:86*87* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(88* int arg1,89* int arg2) KHRONOS_APIATTRIBUTES;90*/9192#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)93# define KHRONOS_STATIC 194#endif9596/*-------------------------------------------------------------------------97* Definition of KHRONOS_APICALL98*-------------------------------------------------------------------------99* This precedes the return type of the function in the function prototype.100*/101#if defined(KHRONOS_STATIC)102/* If the preprocessor constant KHRONOS_STATIC is defined, make the103* header compatible with static linking. */104# define KHRONOS_APICALL105#elif defined(_WIN32)106# define KHRONOS_APICALL __declspec(dllimport)107#elif defined (__SYMBIAN32__)108# define KHRONOS_APICALL IMPORT_C109#elif (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \110|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))111/* KHRONOS_APIATTRIBUTES is not used by the client API headers yet */112# define KHRONOS_APICALL __attribute__((visibility("default")))113#else114# define KHRONOS_APICALL115#endif116117/*-------------------------------------------------------------------------118* Definition of KHRONOS_APIENTRY119*-------------------------------------------------------------------------120* This follows the return type of the function and precedes the function121* name in the function prototype.122*/123#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC)124/* Win32 but not WinCE */125# define KHRONOS_APIENTRY __stdcall126#else127# define KHRONOS_APIENTRY128#endif129130/*-------------------------------------------------------------------------131* Definition of KHRONOS_APIATTRIBUTES132*-------------------------------------------------------------------------133* This follows the closing parenthesis of the function prototype arguments.134*/135#if defined (__ARMCC_2__)136#define KHRONOS_APIATTRIBUTES __softfp137#else138#define KHRONOS_APIATTRIBUTES139#endif140141/*-------------------------------------------------------------------------142* basic type definitions143*-----------------------------------------------------------------------*/144#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)145146147/*148* Using <stdint.h>149*/150#include <stdint.h>151typedef int32_t khronos_int32_t;152typedef uint32_t khronos_uint32_t;153typedef int64_t khronos_int64_t;154typedef uint64_t khronos_uint64_t;155#define KHRONOS_SUPPORT_INT64 1156#define KHRONOS_SUPPORT_FLOAT 1157158#elif defined(__VMS ) || defined(__sgi)159160/*161* Using <inttypes.h>162*/163#include <inttypes.h>164typedef int32_t khronos_int32_t;165typedef uint32_t khronos_uint32_t;166typedef int64_t khronos_int64_t;167typedef uint64_t khronos_uint64_t;168#define KHRONOS_SUPPORT_INT64 1169#define KHRONOS_SUPPORT_FLOAT 1170171#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)172173/*174* Win32175*/176typedef __int32 khronos_int32_t;177typedef unsigned __int32 khronos_uint32_t;178typedef __int64 khronos_int64_t;179typedef unsigned __int64 khronos_uint64_t;180#define KHRONOS_SUPPORT_INT64 1181#define KHRONOS_SUPPORT_FLOAT 1182183#elif defined(__sun__) || defined(__digital__)184185/*186* Sun or Digital187*/188typedef int khronos_int32_t;189typedef unsigned int khronos_uint32_t;190#if defined(__arch64__) || defined(_LP64)191typedef long int khronos_int64_t;192typedef unsigned long int khronos_uint64_t;193#else194typedef long long int khronos_int64_t;195typedef unsigned long long int khronos_uint64_t;196#endif /* __arch64__ */197#define KHRONOS_SUPPORT_INT64 1198#define KHRONOS_SUPPORT_FLOAT 1199200#elif 0201202/*203* Hypothetical platform with no float or int64 support204*/205typedef int khronos_int32_t;206typedef unsigned int khronos_uint32_t;207#define KHRONOS_SUPPORT_INT64 0208#define KHRONOS_SUPPORT_FLOAT 0209210#else211212/*213* Generic fallback214*/215#include <stdint.h>216typedef int32_t khronos_int32_t;217typedef uint32_t khronos_uint32_t;218typedef int64_t khronos_int64_t;219typedef uint64_t khronos_uint64_t;220#define KHRONOS_SUPPORT_INT64 1221#define KHRONOS_SUPPORT_FLOAT 1222223#endif224225226/*227* Types that are (so far) the same on all platforms228*/229typedef signed char khronos_int8_t;230typedef unsigned char khronos_uint8_t;231typedef signed short int khronos_int16_t;232typedef unsigned short int khronos_uint16_t;233234/*235* Types that differ between LLP64 and LP64 architectures - in LLP64,236* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears237* to be the only LLP64 architecture in current use.238*/239#ifdef _WIN64240typedef signed long long int khronos_intptr_t;241typedef unsigned long long int khronos_uintptr_t;242typedef signed long long int khronos_ssize_t;243typedef unsigned long long int khronos_usize_t;244#else245typedef signed long int khronos_intptr_t;246typedef unsigned long int khronos_uintptr_t;247typedef signed long int khronos_ssize_t;248typedef unsigned long int khronos_usize_t;249#endif250251#if KHRONOS_SUPPORT_FLOAT252/*253* Float type254*/255typedef float khronos_float_t;256#endif257258#if KHRONOS_SUPPORT_INT64259/* Time types260*261* These types can be used to represent a time interval in nanoseconds or262* an absolute Unadjusted System Time. Unadjusted System Time is the number263* of nanoseconds since some arbitrary system event (e.g. since the last264* time the system booted). The Unadjusted System Time is an unsigned265* 64 bit value that wraps back to 0 every 584 years. Time intervals266* may be either signed or unsigned.267*/268typedef khronos_uint64_t khronos_utime_nanoseconds_t;269typedef khronos_int64_t khronos_stime_nanoseconds_t;270#endif271272/*273* Dummy value used to pad enum types to 32 bits.274*/275#ifndef KHRONOS_MAX_ENUM276#define KHRONOS_MAX_ENUM 0x7FFFFFFF277#endif278279/*280* Enumerated boolean type281*282* Values other than zero should be considered to be true. Therefore283* comparisons should not be made against KHRONOS_TRUE.284*/285typedef enum {286KHRONOS_FALSE = 0,287KHRONOS_TRUE = 1,288KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM289} khronos_boolean_enum_t;290291#endif /* __khrplatform_h_ */292293294