Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:34

0001 #ifndef __khrplatform_h_
0002 #define __khrplatform_h_
0003 
0004 /*
0005 ** Copyright (c) 2008-2018 The Khronos Group Inc.
0006 **
0007 ** Permission is hereby granted, free of charge, to any person obtaining a
0008 ** copy of this software and/or associated documentation files (the
0009 ** "Materials"), to deal in the Materials without restriction, including
0010 ** without limitation the rights to use, copy, modify, merge, publish,
0011 ** distribute, sublicense, and/or sell copies of the Materials, and to
0012 ** permit persons to whom the Materials are furnished to do so, subject to
0013 ** the following conditions:
0014 **
0015 ** The above copyright notice and this permission notice shall be included
0016 ** in all copies or substantial portions of the Materials.
0017 **
0018 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0019 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0020 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0021 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0022 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0023 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0024 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
0025 */
0026 
0027 /* Khronos platform-specific types and definitions.
0028  *
0029  * The master copy of khrplatform.h is maintained in the Khronos EGL
0030  * Registry repository at https://github.com/KhronosGroup/EGL-Registry
0031  * The last semantic modification to khrplatform.h was at commit ID:
0032  *      67a3e0864c2d75ea5287b9f3d2eb74a745936692
0033  *
0034  * Adopters may modify this file to suit their platform. Adopters are
0035  * encouraged to submit platform specific modifications to the Khronos
0036  * group so that they can be included in future versions of this file.
0037  * Please submit changes by filing pull requests or issues on
0038  * the EGL Registry repository linked above.
0039  *
0040  *
0041  * See the Implementer's Guidelines for information about where this file
0042  * should be located on your system and for more details of its use:
0043  *    http://www.khronos.org/registry/implementers_guide.pdf
0044  *
0045  * This file should be included as
0046  *        #include <KHR/khrplatform.h>
0047  * by Khronos client API header files that use its types and defines.
0048  *
0049  * The types in khrplatform.h should only be used to define API-specific types.
0050  *
0051  * Types defined in khrplatform.h:
0052  *    khronos_int8_t              signed   8  bit
0053  *    khronos_uint8_t             unsigned 8  bit
0054  *    khronos_int16_t             signed   16 bit
0055  *    khronos_uint16_t            unsigned 16 bit
0056  *    khronos_int32_t             signed   32 bit
0057  *    khronos_uint32_t            unsigned 32 bit
0058  *    khronos_int64_t             signed   64 bit
0059  *    khronos_uint64_t            unsigned 64 bit
0060  *    khronos_intptr_t            signed   same number of bits as a pointer
0061  *    khronos_uintptr_t           unsigned same number of bits as a pointer
0062  *    khronos_ssize_t             signed   size
0063  *    khronos_usize_t             unsigned size
0064  *    khronos_float_t             signed   32 bit floating point
0065  *    khronos_time_ns_t           unsigned 64 bit time in nanoseconds
0066  *    khronos_utime_nanoseconds_t unsigned time interval or absolute time in
0067  *                                         nanoseconds
0068  *    khronos_stime_nanoseconds_t signed time interval in nanoseconds
0069  *    khronos_boolean_enum_t      enumerated boolean type. This should
0070  *      only be used as a base type when a client API's boolean type is
0071  *      an enum. Client APIs which use an integer or other type for
0072  *      booleans cannot use this as the base type for their boolean.
0073  *
0074  * Tokens defined in khrplatform.h:
0075  *
0076  *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
0077  *
0078  *    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
0079  *    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
0080  *
0081  * Calling convention macros defined in this file:
0082  *    KHRONOS_APICALL
0083  *    KHRONOS_APIENTRY
0084  *    KHRONOS_APIATTRIBUTES
0085  *
0086  * These may be used in function prototypes as:
0087  *
0088  *      KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
0089  *                                  int arg1,
0090  *                                  int arg2) KHRONOS_APIATTRIBUTES;
0091  */
0092 
0093 #if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
0094 #   define KHRONOS_STATIC 1
0095 #endif
0096 
0097 /*-------------------------------------------------------------------------
0098  * Definition of KHRONOS_APICALL
0099  *-------------------------------------------------------------------------
0100  * This precedes the return type of the function in the function prototype.
0101  */
0102 #if defined(KHRONOS_STATIC)
0103     /* If the preprocessor constant KHRONOS_STATIC is defined, make the
0104      * header compatible with static linking. */
0105 #   define KHRONOS_APICALL
0106 #elif defined(_WIN32)
0107 #   define KHRONOS_APICALL __declspec(dllimport)
0108 #elif defined (__SYMBIAN32__)
0109 #   define KHRONOS_APICALL IMPORT_C
0110 #elif defined(__ANDROID__)
0111 #   define KHRONOS_APICALL __attribute__((visibility("default")))
0112 #else
0113 #   define KHRONOS_APICALL
0114 #endif
0115 
0116 /*-------------------------------------------------------------------------
0117  * Definition of KHRONOS_APIENTRY
0118  *-------------------------------------------------------------------------
0119  * This follows the return type of the function  and precedes the function
0120  * name in the function prototype.
0121  */
0122 #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
0123     /* Win32 but not WinCE */
0124 #   define KHRONOS_APIENTRY __stdcall
0125 #else
0126 #   define KHRONOS_APIENTRY
0127 #endif
0128 
0129 /*-------------------------------------------------------------------------
0130  * Definition of KHRONOS_APIATTRIBUTES
0131  *-------------------------------------------------------------------------
0132  * This follows the closing parenthesis of the function prototype arguments.
0133  */
0134 #if defined (__ARMCC_2__)
0135 #define KHRONOS_APIATTRIBUTES __softfp
0136 #else
0137 #define KHRONOS_APIATTRIBUTES
0138 #endif
0139 
0140 /*-------------------------------------------------------------------------
0141  * basic type definitions
0142  *-----------------------------------------------------------------------*/
0143 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
0144 
0145 
0146 /*
0147  * Using <stdint.h>
0148  */
0149 #include <stdint.h>
0150 typedef int32_t                 khronos_int32_t;
0151 typedef uint32_t                khronos_uint32_t;
0152 typedef int64_t                 khronos_int64_t;
0153 typedef uint64_t                khronos_uint64_t;
0154 #define KHRONOS_SUPPORT_INT64   1
0155 #define KHRONOS_SUPPORT_FLOAT   1
0156 
0157 #elif defined(__VMS ) || defined(__sgi)
0158 
0159 /*
0160  * Using <inttypes.h>
0161  */
0162 #include <inttypes.h>
0163 typedef int32_t                 khronos_int32_t;
0164 typedef uint32_t                khronos_uint32_t;
0165 typedef int64_t                 khronos_int64_t;
0166 typedef uint64_t                khronos_uint64_t;
0167 #define KHRONOS_SUPPORT_INT64   1
0168 #define KHRONOS_SUPPORT_FLOAT   1
0169 
0170 #elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
0171 
0172 /*
0173  * Win32
0174  */
0175 typedef __int32                 khronos_int32_t;
0176 typedef unsigned __int32        khronos_uint32_t;
0177 typedef __int64                 khronos_int64_t;
0178 typedef unsigned __int64        khronos_uint64_t;
0179 #define KHRONOS_SUPPORT_INT64   1
0180 #define KHRONOS_SUPPORT_FLOAT   1
0181 
0182 #elif defined(__sun__) || defined(__digital__)
0183 
0184 /*
0185  * Sun or Digital
0186  */
0187 typedef int                     khronos_int32_t;
0188 typedef unsigned int            khronos_uint32_t;
0189 #if defined(__arch64__) || defined(_LP64)
0190 typedef long int                khronos_int64_t;
0191 typedef unsigned long int       khronos_uint64_t;
0192 #else
0193 typedef long long int           khronos_int64_t;
0194 typedef unsigned long long int  khronos_uint64_t;
0195 #endif /* __arch64__ */
0196 #define KHRONOS_SUPPORT_INT64   1
0197 #define KHRONOS_SUPPORT_FLOAT   1
0198 
0199 #elif 0
0200 
0201 /*
0202  * Hypothetical platform with no float or int64 support
0203  */
0204 typedef int                     khronos_int32_t;
0205 typedef unsigned int            khronos_uint32_t;
0206 #define KHRONOS_SUPPORT_INT64   0
0207 #define KHRONOS_SUPPORT_FLOAT   0
0208 
0209 #else
0210 
0211 /*
0212  * Generic fallback
0213  */
0214 #include <stdint.h>
0215 typedef int32_t                 khronos_int32_t;
0216 typedef uint32_t                khronos_uint32_t;
0217 typedef int64_t                 khronos_int64_t;
0218 typedef uint64_t                khronos_uint64_t;
0219 #define KHRONOS_SUPPORT_INT64   1
0220 #define KHRONOS_SUPPORT_FLOAT   1
0221 
0222 #endif
0223 
0224 
0225 /*
0226  * Types that are (so far) the same on all platforms
0227  */
0228 typedef signed   char          khronos_int8_t;
0229 typedef unsigned char          khronos_uint8_t;
0230 typedef signed   short int     khronos_int16_t;
0231 typedef unsigned short int     khronos_uint16_t;
0232 
0233 /*
0234  * Types that differ between LLP64 and LP64 architectures - in LLP64,
0235  * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
0236  * to be the only LLP64 architecture in current use.
0237  */
0238 #ifdef _WIN64
0239 typedef signed   long long int khronos_intptr_t;
0240 typedef unsigned long long int khronos_uintptr_t;
0241 typedef signed   long long int khronos_ssize_t;
0242 typedef unsigned long long int khronos_usize_t;
0243 #else
0244 typedef signed   long  int     khronos_intptr_t;
0245 typedef unsigned long  int     khronos_uintptr_t;
0246 typedef signed   long  int     khronos_ssize_t;
0247 typedef unsigned long  int     khronos_usize_t;
0248 #endif
0249 
0250 #if KHRONOS_SUPPORT_FLOAT
0251 /*
0252  * Float type
0253  */
0254 typedef          float         khronos_float_t;
0255 #endif
0256 
0257 #if KHRONOS_SUPPORT_INT64
0258 /* Time types
0259  *
0260  * These types can be used to represent a time interval in nanoseconds or
0261  * an absolute Unadjusted System Time.  Unadjusted System Time is the number
0262  * of nanoseconds since some arbitrary system event (e.g. since the last
0263  * time the system booted).  The Unadjusted System Time is an unsigned
0264  * 64 bit value that wraps back to 0 every 584 years.  Time intervals
0265  * may be either signed or unsigned.
0266  */
0267 typedef khronos_uint64_t       khronos_utime_nanoseconds_t;
0268 typedef khronos_int64_t        khronos_stime_nanoseconds_t;
0269 #endif
0270 
0271 /*
0272  * Dummy value used to pad enum types to 32 bits.
0273  */
0274 #ifndef KHRONOS_MAX_ENUM
0275 #define KHRONOS_MAX_ENUM 0x7FFFFFFF
0276 #endif
0277 
0278 /*
0279  * Enumerated boolean type
0280  *
0281  * Values other than zero should be considered to be true.  Therefore
0282  * comparisons should not be made against KHRONOS_TRUE.
0283  */
0284 typedef enum {
0285     KHRONOS_FALSE = 0,
0286     KHRONOS_TRUE  = 1,
0287     KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
0288 } khronos_boolean_enum_t;
0289 
0290 #endif /* __khrplatform_h_ */