include/SDL_opengles2_khrplatform.h
author Jørgen P. Tjernø <jorgen@uberent.com>
Wed, 04 Jun 2014 01:27:13 -0700
changeset 8806 1a413cfc6ab7
child 8808 da1e1d6e84c4
permissions -rw-r--r--
SDL_opengles2: Separate out GLES2 headers.
jorgen@8806
     1
#ifndef __khrplatform_h_
jorgen@8806
     2
#define __khrplatform_h_
jorgen@8806
     3
jorgen@8806
     4
/*
jorgen@8806
     5
** Copyright (c) 2008-2009 The Khronos Group Inc.
jorgen@8806
     6
**
jorgen@8806
     7
** Permission is hereby granted, free of charge, to any person obtaining a
jorgen@8806
     8
** copy of this software and/or associated documentation files (the
jorgen@8806
     9
** "Materials"), to deal in the Materials without restriction, including
jorgen@8806
    10
** without limitation the rights to use, copy, modify, merge, publish,
jorgen@8806
    11
** distribute, sublicense, and/or sell copies of the Materials, and to
jorgen@8806
    12
** permit persons to whom the Materials are furnished to do so, subject to
jorgen@8806
    13
** the following conditions:
jorgen@8806
    14
**
jorgen@8806
    15
** The above copyright notice and this permission notice shall be included
jorgen@8806
    16
** in all copies or substantial portions of the Materials.
jorgen@8806
    17
**
jorgen@8806
    18
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
jorgen@8806
    19
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
jorgen@8806
    20
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
jorgen@8806
    21
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
jorgen@8806
    22
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
jorgen@8806
    23
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
jorgen@8806
    24
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
jorgen@8806
    25
*/
jorgen@8806
    26
jorgen@8806
    27
/* Khronos platform-specific types and definitions.
jorgen@8806
    28
*
jorgen@8806
    29
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
jorgen@8806
    30
*
jorgen@8806
    31
* Adopters may modify this file to suit their platform. Adopters are
jorgen@8806
    32
* encouraged to submit platform specific modifications to the Khronos
jorgen@8806
    33
* group so that they can be included in future versions of this file.
jorgen@8806
    34
* Please submit changes by sending them to the public Khronos Bugzilla
jorgen@8806
    35
* (http://khronos.org/bugzilla) by filing a bug against product
jorgen@8806
    36
* "Khronos (general)" component "Registry".
jorgen@8806
    37
*
jorgen@8806
    38
* A predefined template which fills in some of the bug fields can be
jorgen@8806
    39
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
jorgen@8806
    40
* must create a Bugzilla login first.
jorgen@8806
    41
*
jorgen@8806
    42
*
jorgen@8806
    43
* See the Implementer's Guidelines for information about where this file
jorgen@8806
    44
* should be located on your system and for more details of its use:
jorgen@8806
    45
*    http://www.khronos.org/registry/implementers_guide.pdf
jorgen@8806
    46
*
jorgen@8806
    47
* This file should be included as
jorgen@8806
    48
*        #include <KHR/khrplatform.h>
jorgen@8806
    49
* by Khronos client API header files that use its types and defines.
jorgen@8806
    50
*
jorgen@8806
    51
* The types in khrplatform.h should only be used to define API-specific types.
jorgen@8806
    52
*
jorgen@8806
    53
* Types defined in khrplatform.h:
jorgen@8806
    54
*    khronos_int8_t              signed   8  bit
jorgen@8806
    55
*    khronos_uint8_t             unsigned 8  bit
jorgen@8806
    56
*    khronos_int16_t             signed   16 bit
jorgen@8806
    57
*    khronos_uint16_t            unsigned 16 bit
jorgen@8806
    58
*    khronos_int32_t             signed   32 bit
jorgen@8806
    59
*    khronos_uint32_t            unsigned 32 bit
jorgen@8806
    60
*    khronos_int64_t             signed   64 bit
jorgen@8806
    61
*    khronos_uint64_t            unsigned 64 bit
jorgen@8806
    62
*    khronos_intptr_t            signed   same number of bits as a pointer
jorgen@8806
    63
*    khronos_uintptr_t           unsigned same number of bits as a pointer
jorgen@8806
    64
*    khronos_ssize_t             signed   size
jorgen@8806
    65
*    khronos_usize_t             unsigned size
jorgen@8806
    66
*    khronos_float_t             signed   32 bit floating point
jorgen@8806
    67
*    khronos_time_ns_t           unsigned 64 bit time in nanoseconds
jorgen@8806
    68
*    khronos_utime_nanoseconds_t unsigned time interval or absolute time in
jorgen@8806
    69
*                                         nanoseconds
jorgen@8806
    70
*    khronos_stime_nanoseconds_t signed time interval in nanoseconds
jorgen@8806
    71
*    khronos_boolean_enum_t      enumerated boolean type. This should
jorgen@8806
    72
*      only be used as a base type when a client API's boolean type is
jorgen@8806
    73
*      an enum. Client APIs which use an integer or other type for
jorgen@8806
    74
*      booleans cannot use this as the base type for their boolean.
jorgen@8806
    75
*
jorgen@8806
    76
* Tokens defined in khrplatform.h:
jorgen@8806
    77
*
jorgen@8806
    78
*    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
jorgen@8806
    79
*
jorgen@8806
    80
*    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
jorgen@8806
    81
*    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
jorgen@8806
    82
*
jorgen@8806
    83
* Calling convention macros defined in this file:
jorgen@8806
    84
*    KHRONOS_APICALL
jorgen@8806
    85
*    KHRONOS_APIENTRY
jorgen@8806
    86
*    KHRONOS_APIATTRIBUTES
jorgen@8806
    87
*
jorgen@8806
    88
* These may be used in function prototypes as:
jorgen@8806
    89
*
jorgen@8806
    90
*      KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
jorgen@8806
    91
*                                  int arg1,
jorgen@8806
    92
*                                  int arg2) KHRONOS_APIATTRIBUTES;
jorgen@8806
    93
*/
jorgen@8806
    94
jorgen@8806
    95
/*-------------------------------------------------------------------------
jorgen@8806
    96
* Definition of KHRONOS_APICALL
jorgen@8806
    97
*-------------------------------------------------------------------------
jorgen@8806
    98
* This precedes the return type of the function in the function prototype.
jorgen@8806
    99
*/
jorgen@8806
   100
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
jorgen@8806
   101
#   define KHRONOS_APICALL __declspec(dllimport)
jorgen@8806
   102
#elif defined (__SYMBIAN32__)
jorgen@8806
   103
#   define KHRONOS_APICALL IMPORT_C
jorgen@8806
   104
#else
jorgen@8806
   105
#   define KHRONOS_APICALL
jorgen@8806
   106
#endif
jorgen@8806
   107
jorgen@8806
   108
/*-------------------------------------------------------------------------
jorgen@8806
   109
* Definition of KHRONOS_APIENTRY
jorgen@8806
   110
*-------------------------------------------------------------------------
jorgen@8806
   111
* This follows the return type of the function  and precedes the function
jorgen@8806
   112
* name in the function prototype.
jorgen@8806
   113
*/
jorgen@8806
   114
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
jorgen@8806
   115
/* Win32 but not WinCE */
jorgen@8806
   116
#   define KHRONOS_APIENTRY __stdcall
jorgen@8806
   117
#else
jorgen@8806
   118
#   define KHRONOS_APIENTRY
jorgen@8806
   119
#endif
jorgen@8806
   120
jorgen@8806
   121
/*-------------------------------------------------------------------------
jorgen@8806
   122
* Definition of KHRONOS_APIATTRIBUTES
jorgen@8806
   123
*-------------------------------------------------------------------------
jorgen@8806
   124
* This follows the closing parenthesis of the function prototype arguments.
jorgen@8806
   125
*/
jorgen@8806
   126
#if defined (__ARMCC_2__)
jorgen@8806
   127
#define KHRONOS_APIATTRIBUTES __softfp
jorgen@8806
   128
#else
jorgen@8806
   129
#define KHRONOS_APIATTRIBUTES
jorgen@8806
   130
#endif
jorgen@8806
   131
jorgen@8806
   132
/*-------------------------------------------------------------------------
jorgen@8806
   133
* basic type definitions
jorgen@8806
   134
*-----------------------------------------------------------------------*/
jorgen@8806
   135
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
jorgen@8806
   136
jorgen@8806
   137
jorgen@8806
   138
/*
jorgen@8806
   139
* Using <stdint.h>
jorgen@8806
   140
*/
jorgen@8806
   141
#include <stdint.h>
jorgen@8806
   142
typedef int32_t                 khronos_int32_t;
jorgen@8806
   143
typedef uint32_t                khronos_uint32_t;
jorgen@8806
   144
typedef int64_t                 khronos_int64_t;
jorgen@8806
   145
typedef uint64_t                khronos_uint64_t;
jorgen@8806
   146
#define KHRONOS_SUPPORT_INT64   1
jorgen@8806
   147
#define KHRONOS_SUPPORT_FLOAT   1
jorgen@8806
   148
jorgen@8806
   149
#elif defined(__VMS ) || defined(__sgi)
jorgen@8806
   150
jorgen@8806
   151
/*
jorgen@8806
   152
* Using <inttypes.h>
jorgen@8806
   153
*/
jorgen@8806
   154
#include <inttypes.h>
jorgen@8806
   155
typedef int32_t                 khronos_int32_t;
jorgen@8806
   156
typedef uint32_t                khronos_uint32_t;
jorgen@8806
   157
typedef int64_t                 khronos_int64_t;
jorgen@8806
   158
typedef uint64_t                khronos_uint64_t;
jorgen@8806
   159
#define KHRONOS_SUPPORT_INT64   1
jorgen@8806
   160
#define KHRONOS_SUPPORT_FLOAT   1
jorgen@8806
   161
jorgen@8806
   162
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
jorgen@8806
   163
jorgen@8806
   164
/*
jorgen@8806
   165
* Win32
jorgen@8806
   166
*/
jorgen@8806
   167
typedef __int32                 khronos_int32_t;
jorgen@8806
   168
typedef unsigned __int32        khronos_uint32_t;
jorgen@8806
   169
typedef __int64                 khronos_int64_t;
jorgen@8806
   170
typedef unsigned __int64        khronos_uint64_t;
jorgen@8806
   171
#define KHRONOS_SUPPORT_INT64   1
jorgen@8806
   172
#define KHRONOS_SUPPORT_FLOAT   1
jorgen@8806
   173
jorgen@8806
   174
#elif defined(__sun__) || defined(__digital__)
jorgen@8806
   175
jorgen@8806
   176
/*
jorgen@8806
   177
* Sun or Digital
jorgen@8806
   178
*/
jorgen@8806
   179
typedef int                     khronos_int32_t;
jorgen@8806
   180
typedef unsigned int            khronos_uint32_t;
jorgen@8806
   181
#if defined(__arch64__) || defined(_LP64)
jorgen@8806
   182
typedef long int                khronos_int64_t;
jorgen@8806
   183
typedef unsigned long int       khronos_uint64_t;
jorgen@8806
   184
#else
jorgen@8806
   185
typedef long long int           khronos_int64_t;
jorgen@8806
   186
typedef unsigned long long int  khronos_uint64_t;
jorgen@8806
   187
#endif /* __arch64__ */
jorgen@8806
   188
#define KHRONOS_SUPPORT_INT64   1
jorgen@8806
   189
#define KHRONOS_SUPPORT_FLOAT   1
jorgen@8806
   190
jorgen@8806
   191
#elif 0
jorgen@8806
   192
jorgen@8806
   193
/*
jorgen@8806
   194
* Hypothetical platform with no float or int64 support
jorgen@8806
   195
*/
jorgen@8806
   196
typedef int                     khronos_int32_t;
jorgen@8806
   197
typedef unsigned int            khronos_uint32_t;
jorgen@8806
   198
#define KHRONOS_SUPPORT_INT64   0
jorgen@8806
   199
#define KHRONOS_SUPPORT_FLOAT   0
jorgen@8806
   200
jorgen@8806
   201
#else
jorgen@8806
   202
jorgen@8806
   203
/*
jorgen@8806
   204
* Generic fallback
jorgen@8806
   205
*/
jorgen@8806
   206
#include <stdint.h>
jorgen@8806
   207
typedef int32_t                 khronos_int32_t;
jorgen@8806
   208
typedef uint32_t                khronos_uint32_t;
jorgen@8806
   209
typedef int64_t                 khronos_int64_t;
jorgen@8806
   210
typedef uint64_t                khronos_uint64_t;
jorgen@8806
   211
#define KHRONOS_SUPPORT_INT64   1
jorgen@8806
   212
#define KHRONOS_SUPPORT_FLOAT   1
jorgen@8806
   213
jorgen@8806
   214
#endif
jorgen@8806
   215
jorgen@8806
   216
jorgen@8806
   217
/*
jorgen@8806
   218
* Types that are (so far) the same on all platforms
jorgen@8806
   219
*/
jorgen@8806
   220
typedef signed   char          khronos_int8_t;
jorgen@8806
   221
typedef unsigned char          khronos_uint8_t;
jorgen@8806
   222
typedef signed   short int     khronos_int16_t;
jorgen@8806
   223
typedef unsigned short int     khronos_uint16_t;
jorgen@8806
   224
jorgen@8806
   225
/*
jorgen@8806
   226
* Types that differ between LLP64 and LP64 architectures - in LLP64,
jorgen@8806
   227
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
jorgen@8806
   228
* to be the only LLP64 architecture in current use.
jorgen@8806
   229
*/
jorgen@8806
   230
#ifdef _WIN64
jorgen@8806
   231
typedef signed   long long int khronos_intptr_t;
jorgen@8806
   232
typedef unsigned long long int khronos_uintptr_t;
jorgen@8806
   233
typedef signed   long long int khronos_ssize_t;
jorgen@8806
   234
typedef unsigned long long int khronos_usize_t;
jorgen@8806
   235
#else
jorgen@8806
   236
typedef signed   long  int     khronos_intptr_t;
jorgen@8806
   237
typedef unsigned long  int     khronos_uintptr_t;
jorgen@8806
   238
typedef signed   long  int     khronos_ssize_t;
jorgen@8806
   239
typedef unsigned long  int     khronos_usize_t;
jorgen@8806
   240
#endif
jorgen@8806
   241
jorgen@8806
   242
#if KHRONOS_SUPPORT_FLOAT
jorgen@8806
   243
/*
jorgen@8806
   244
* Float type
jorgen@8806
   245
*/
jorgen@8806
   246
typedef          float         khronos_float_t;
jorgen@8806
   247
#endif
jorgen@8806
   248
jorgen@8806
   249
#if KHRONOS_SUPPORT_INT64
jorgen@8806
   250
/* Time types
jorgen@8806
   251
*
jorgen@8806
   252
* These types can be used to represent a time interval in nanoseconds or
jorgen@8806
   253
* an absolute Unadjusted System Time.  Unadjusted System Time is the number
jorgen@8806
   254
* of nanoseconds since some arbitrary system event (e.g. since the last
jorgen@8806
   255
* time the system booted).  The Unadjusted System Time is an unsigned
jorgen@8806
   256
* 64 bit value that wraps back to 0 every 584 years.  Time intervals
jorgen@8806
   257
* may be either signed or unsigned.
jorgen@8806
   258
*/
jorgen@8806
   259
typedef khronos_uint64_t       khronos_utime_nanoseconds_t;
jorgen@8806
   260
typedef khronos_int64_t        khronos_stime_nanoseconds_t;
jorgen@8806
   261
#endif
jorgen@8806
   262
jorgen@8806
   263
/*
jorgen@8806
   264
* Dummy value used to pad enum types to 32 bits.
jorgen@8806
   265
*/
jorgen@8806
   266
#ifndef KHRONOS_MAX_ENUM
jorgen@8806
   267
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
jorgen@8806
   268
#endif
jorgen@8806
   269
jorgen@8806
   270
/*
jorgen@8806
   271
* Enumerated boolean type
jorgen@8806
   272
*
jorgen@8806
   273
* Values other than zero should be considered to be true.  Therefore
jorgen@8806
   274
* comparisons should not be made against KHRONOS_TRUE.
jorgen@8806
   275
*/
jorgen@8806
   276
typedef enum {
jorgen@8806
   277
    KHRONOS_FALSE = 0,
jorgen@8806
   278
    KHRONOS_TRUE = 1,
jorgen@8806
   279
    KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
jorgen@8806
   280
} khronos_boolean_enum_t;
jorgen@8806
   281
jorgen@8806
   282
#endif /* __khrplatform_h_ */
jorgen@8806
   283