#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(__ANDROID__)110# define KHRONOS_APICALL __attribute__((visibility("default")))111#else112# define KHRONOS_APICALL113#endif114115/*-------------------------------------------------------------------------116* Definition of KHRONOS_APIENTRY117*-------------------------------------------------------------------------118* This follows the return type of the function and precedes the function119* name in the function prototype.120*/121#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)122/* Win32 but not WinCE */123# define KHRONOS_APIENTRY __stdcall124#else125# define KHRONOS_APIENTRY126#endif127128/*-------------------------------------------------------------------------129* Definition of KHRONOS_APIATTRIBUTES130*-------------------------------------------------------------------------131* This follows the closing parenthesis of the function prototype arguments.132*/133#if defined (__ARMCC_2__)134#define KHRONOS_APIATTRIBUTES __softfp135#else136#define KHRONOS_APIATTRIBUTES137#endif138139/*-------------------------------------------------------------------------140* basic type definitions141*-----------------------------------------------------------------------*/142#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)143144145/*146* Using <stdint.h>147*/148#include <stdint.h>149typedef int32_t khronos_int32_t;150typedef uint32_t khronos_uint32_t;151typedef int64_t khronos_int64_t;152typedef uint64_t khronos_uint64_t;153#define KHRONOS_SUPPORT_INT64 1154#define KHRONOS_SUPPORT_FLOAT 1155156#elif defined(__VMS ) || defined(__sgi)157158/*159* Using <inttypes.h>160*/161#include <inttypes.h>162typedef int32_t khronos_int32_t;163typedef uint32_t khronos_uint32_t;164typedef int64_t khronos_int64_t;165typedef uint64_t khronos_uint64_t;166#define KHRONOS_SUPPORT_INT64 1167#define KHRONOS_SUPPORT_FLOAT 1168169#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)170171/*172* Win32173*/174typedef __int32 khronos_int32_t;175typedef unsigned __int32 khronos_uint32_t;176typedef __int64 khronos_int64_t;177typedef unsigned __int64 khronos_uint64_t;178#define KHRONOS_SUPPORT_INT64 1179#define KHRONOS_SUPPORT_FLOAT 1180181#elif defined(__sun__) || defined(__digital__)182183/*184* Sun or Digital185*/186typedef int khronos_int32_t;187typedef unsigned int khronos_uint32_t;188#if defined(__arch64__) || defined(_LP64)189typedef long int khronos_int64_t;190typedef unsigned long int khronos_uint64_t;191#else192typedef long long int khronos_int64_t;193typedef unsigned long long int khronos_uint64_t;194#endif /* __arch64__ */195#define KHRONOS_SUPPORT_INT64 1196#define KHRONOS_SUPPORT_FLOAT 1197198#elif 0199200/*201* Hypothetical platform with no float or int64 support202*/203typedef int khronos_int32_t;204typedef unsigned int khronos_uint32_t;205#define KHRONOS_SUPPORT_INT64 0206#define KHRONOS_SUPPORT_FLOAT 0207208#else209210/*211* Generic fallback212*/213#include <stdint.h>214typedef int32_t khronos_int32_t;215typedef uint32_t khronos_uint32_t;216typedef int64_t khronos_int64_t;217typedef uint64_t khronos_uint64_t;218#define KHRONOS_SUPPORT_INT64 1219#define KHRONOS_SUPPORT_FLOAT 1220221#endif222223224/*225* Types that are (so far) the same on all platforms226*/227typedef signed char khronos_int8_t;228typedef unsigned char khronos_uint8_t;229typedef signed short int khronos_int16_t;230typedef unsigned short int khronos_uint16_t;231232/*233* Types that differ between LLP64 and LP64 architectures - in LLP64,234* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears235* to be the only LLP64 architecture in current use.236*/237#ifdef _WIN64238typedef signed long long int khronos_intptr_t;239typedef unsigned long long int khronos_uintptr_t;240typedef signed long long int khronos_ssize_t;241typedef unsigned long long int khronos_usize_t;242#else243typedef signed long int khronos_intptr_t;244typedef unsigned long int khronos_uintptr_t;245typedef signed long int khronos_ssize_t;246typedef unsigned long int khronos_usize_t;247#endif248249#if KHRONOS_SUPPORT_FLOAT250/*251* Float type252*/253typedef float khronos_float_t;254#endif255256#if KHRONOS_SUPPORT_INT64257/* Time types258*259* These types can be used to represent a time interval in nanoseconds or260* an absolute Unadjusted System Time. Unadjusted System Time is the number261* of nanoseconds since some arbitrary system event (e.g. since the last262* time the system booted). The Unadjusted System Time is an unsigned263* 64 bit value that wraps back to 0 every 584 years. Time intervals264* may be either signed or unsigned.265*/266typedef khronos_uint64_t khronos_utime_nanoseconds_t;267typedef khronos_int64_t khronos_stime_nanoseconds_t;268#endif269270/*271* Dummy value used to pad enum types to 32 bits.272*/273#ifndef KHRONOS_MAX_ENUM274#define KHRONOS_MAX_ENUM 0x7FFFFFFF275#endif276277/*278* Enumerated boolean type279*280* Values other than zero should be considered to be true. Therefore281* comparisons should not be made against KHRONOS_TRUE.282*/283typedef enum {284KHRONOS_FALSE = 0,285KHRONOS_TRUE = 1,286KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM287} khronos_boolean_enum_t;288289#endif /* __khrplatform_h_ */290291292