1 /* $Change: 1028567 $ */
2 #ifndef __khrplatform_h_
3 #define __khrplatform_h_
6 ** Copyright (c) 2008-2009 The Khronos Group Inc.
8 ** Permission is hereby granted, free of charge, to any person obtaining a
9 ** copy of this software and/or associated documentation files (the
10 ** "Materials"), to deal in the Materials without restriction, including
11 ** without limitation the rights to use, copy, modify, merge, publish,
12 ** distribute, sublicense, and/or sell copies of the Materials, and to
13 ** permit persons to whom the Materials are furnished to do so, subject to
14 ** the following conditions:
16 ** The above copyright notice and this permission notice shall be included
17 ** in all copies or substantial portions of the Materials.
19 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28 /* Khronos platform-specific types and definitions.
30 * $Revision: #1 $ on $Date: 2011/08/12 $
32 * Adopters may modify this file to suit their platform. Adopters are
33 * encouraged to submit platform specific modifications to the Khronos
34 * group so that they can be included in future versions of this file.
35 * Please submit changes by sending them to the public Khronos Bugzilla
36 * (http://khronos.org/bugzilla) by filing a bug against product
37 * "Khronos (general)" component "Registry".
39 * A predefined template which fills in some of the bug fields can be
40 * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
41 * must create a Bugzilla login first.
44 * See the Implementer's Guidelines for information about where this file
45 * must be located on your system and for more details of its use:
46 * http://www.khronos.org/registry/implementers_guide.pdf
48 * This file must be included as
49 * #include <KHR/khrplatform.h>
50 * by Khronos client API header files that use its types and defines.
52 * The types in khrplatform.h must only be used to define API-specific types.
54 * Types defined in khrplatform.h:
55 * khronos_int8_t signed 8 bit
56 * khronos_uint8_t unsigned 8 bit
57 * khronos_int16_t signed 16 bit
58 * khronos_uint16_t unsigned 16 bit
59 * khronos_int32_t signed 32 bit
60 * khronos_uint32_t unsigned 32 bit
61 * khronos_int64_t signed 64 bit
62 * khronos_uint64_t unsigned 64 bit
63 * khronos_intptr_t signed same number of bits as a pointer
64 * khronos_uintptr_t unsigned same number of bits as a pointer
65 * khronos_ssize_t signed size
66 * khronos_usize_t unsigned size
67 * khronos_float_t signed 32 bit floating point
68 * khronos_time_ns_t unsigned 64 bit time in nanoseconds
69 * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
71 * khronos_stime_nanoseconds_t signed time interval in nanoseconds
72 * khronos_boolean_enum_t enumerated boolean type. This must
73 * only be used as a base type when a client API's boolean type is
74 * an enum. Client APIs which use an integer or other type for
75 * booleans cannot use this as the base type for their boolean.
77 * Tokens defined in khrplatform.h:
79 * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
81 * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
82 * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
84 * Calling convention macros defined in this file:
87 * KHRONOS_APIATTRIBUTES
89 * These may be used in function prototypes as:
91 * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
93 * int arg2) KHRONOS_APIATTRIBUTES;
97 * @addtogroup opengles
102 /*-------------------------------------------------------------------------
103 * Definition of KHRONOS_APICALL
104 *-------------------------------------------------------------------------
105 * This precedes the return type of the function in the function prototype.
108 #ifdef __KHRONOS_EXPORTS
109 #define KHRONOS_APICALL __declspec(dllexport)
111 #define KHRONOS_APICALL __declspec(dllimport)
113 //#define KHRONOS_APICALL extern
114 #elif defined(__SYMBIAN32__)
115 #define KHRONOS_APICALL IMPORT_C
117 #define KHRONOS_APICALL extern
120 /*-------------------------------------------------------------------------
121 * Definition of KHRONOS_APIENTRY
122 *-------------------------------------------------------------------------
123 * This follows the return type of the function and precedes the function
124 * name in the function prototype.
126 #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
127 /* Win32 but not WinCE */
128 #define KHRONOS_APIENTRY __stdcall
130 #define KHRONOS_APIENTRY
133 /*-------------------------------------------------------------------------
134 * Definition of KHRONOS_APIATTRIBUTES
135 *-------------------------------------------------------------------------
136 * This follows the closing parenthesis of the function prototype arguments.
138 #if defined(__ARMCC_2__)
139 #define KHRONOS_APIATTRIBUTES __softfp
141 #define KHRONOS_APIATTRIBUTES
144 /*-------------------------------------------------------------------------
145 * basic type definitions
146 *-----------------------------------------------------------------------*/
147 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
151 // This method is for internal use only.
152 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
158 typedef int32_t khronos_int32_t;
159 typedef uint32_t khronos_uint32_t;
160 typedef int64_t khronos_int64_t;
161 typedef uint64_t khronos_uint64_t;
162 #define KHRONOS_SUPPORT_INT64 1
163 #define KHRONOS_SUPPORT_FLOAT 1
165 #elif defined(__VMS) || defined(__sgi)
168 // This method is for internal use only.
169 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
171 // Using <inttypes.h>
174 #include <inttypes.h>
175 typedef int32_t khronos_int32_t;
176 typedef uint32_t khronos_uint32_t;
177 typedef int64_t khronos_int64_t;
178 typedef uint64_t khronos_uint64_t;
179 #define KHRONOS_SUPPORT_INT64 1
180 #define KHRONOS_SUPPORT_FLOAT 1
182 #elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
185 // This method is for internal use only.
186 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
191 typedef __int32 khronos_int32_t;
192 typedef unsigned __int32 khronos_uint32_t;
193 typedef __int64 khronos_int64_t;
194 typedef unsigned __int64 khronos_uint64_t;
195 #define KHRONOS_SUPPORT_INT64 1
196 #define KHRONOS_SUPPORT_FLOAT 1
198 #elif defined(__sun__) || defined(__digital__)
201 // This method is for internal use only.
202 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
207 typedef int khronos_int32_t;
208 typedef unsigned int khronos_uint32_t;
209 #if defined(__arch64__) || defined(_LP64)
210 typedef long int khronos_int64_t;
211 typedef unsigned long int khronos_uint64_t;
213 typedef long long int khronos_int64_t;
214 typedef unsigned long long int khronos_uint64_t;
215 #endif /* __arch64__ */
216 #define KHRONOS_SUPPORT_INT64 1
217 #define KHRONOS_SUPPORT_FLOAT 1
222 * Hypothetical platform with no float or int64 support
224 typedef int khronos_int32_t;
225 typedef unsigned int khronos_uint32_t;
226 #define KHRONOS_SUPPORT_INT64 0
227 #define KHRONOS_SUPPORT_FLOAT 0
232 // This method is for internal use only.
233 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
239 typedef int32_t khronos_int32_t;
240 typedef uint32_t khronos_uint32_t;
241 typedef int64_t khronos_int64_t;
242 typedef uint64_t khronos_uint64_t;
243 #define KHRONOS_SUPPORT_INT64 1
244 #define KHRONOS_SUPPORT_FLOAT 1
250 * Types that are (so far) the same on all platforms
253 // This method is for internal use only.
254 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
256 // \var typedef signed char khronos_int8_t
257 // \brief A type definition for khronos_int8_t.
260 typedef signed char khronos_int8_t;
263 // This method is for internal use only.
264 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
266 // \var typedef unsigned char khronos_uint8_t
267 // \brief A type definition for khronos_uint8_t.
270 typedef unsigned char khronos_uint8_t;
273 // This method is for internal use only.
274 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
276 // \var typedef signed short int khronos_int16_t
277 // \brief A type definition for khronos_int16_t.
280 typedef signed short int khronos_int16_t;
283 // This method is for internal use only.
284 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
286 // \var typedef unsigned short int khronos_uint16_t
287 // \brief A type definition for khronos_uint16_t.
290 typedef unsigned short int khronos_uint16_t;
293 // This method is for internal use only.
294 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
296 // \var typedef signed long int khronos_intptr_t
297 // \brief A type definition for khronos_intptr_t.
300 typedef signed long int khronos_intptr_t;
303 // This method is for internal use only.
304 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
306 // \var typedef unsigned long int khronos_uintptr_t
307 // \brief A type definition for khronos_uintptr_t.
310 typedef unsigned long int khronos_uintptr_t;
313 // This method is for internal use only.
314 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
316 // \var typedef signed long int khronos_ssize_t
317 // \brief A type definition for khronos_ssize_t.
320 typedef signed long int khronos_ssize_t;
323 // This method is for internal use only.
324 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
326 // \var typedef unsigned long int khronos_usize_t
327 // \brief A type definition for khronos_usize_t.
330 typedef unsigned long int khronos_usize_t;
332 #if KHRONOS_SUPPORT_FLOAT
334 // This method is for internal use only.
335 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
340 typedef float khronos_float_t;
343 #if KHRONOS_SUPPORT_INT64
345 // This method is for internal use only.
346 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
350 // These types can be used to represent a time interval in nanoseconds or
351 // an absolute Unadjusted System Time. The Unadjusted System Time is the number
352 // of nanoseconds since some arbitrary system event (for example, since the last
353 // time the system booted). It is an unsigned 64-bit value that wraps back to 0 after every 584 years.
354 // The time intervals can be either signed or unsigned.
357 typedef khronos_uint64_t khronos_utime_nanoseconds_t;
358 typedef khronos_int64_t khronos_stime_nanoseconds_t;
362 // This method is for internal use only.
363 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
365 // Dummy value used to pad enum types to 32 bits.
368 #ifndef KHRONOS_MAX_ENUM
369 #define KHRONOS_MAX_ENUM 0x7FFFFFFF
373 // This method is for internal use only.
374 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
376 // Enumerated boolean type
378 // Values other than zero must be considered to be true. Therefore
379 // comparisons must not be made against KHRONOS_TRUE.
386 KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
387 } khronos_boolean_enum_t;
391 /*-------------------------------------------------------------------------
392 * Data type definitions for GL APIs
393 *-----------------------------------------------------------------------*/
396 // This method is for internal use only.
397 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
399 // \var typedef void GLvoid
400 // \brief A type definition for GLvoid.
406 // This method is for internal use only.
407 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
409 // \var typedef unsigned int GLenum
410 // \brief A type definition for GLenum.
413 typedef unsigned int GLenum;
416 // This method is for internal use only.
417 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
419 // \var typedef unsigned char GLboolean
420 // \brief A type definition for GLboolean.
423 typedef unsigned char GLboolean;
426 // This method is for internal use only.
427 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
429 // \var typedef unsigned int GLbitfield
430 // \brief A type definition for GLbitfield.
433 typedef unsigned int GLbitfield;
436 // This method is for internal use only.
437 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
439 // \var typedef signed char GLbyte
440 // \brief A type definition for GLbyte.
443 typedef khronos_int8_t GLbyte;
446 // This method is for internal use only.
447 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
449 // \var typedef short GLshort
450 // \brief A type definition for GLshort.
453 typedef short GLshort;
456 // This method is for internal use only.
457 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
459 // \var typedef int GLint
460 // \brief A type definition for GLint.
466 // This method is for internal use only.
467 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
469 // \var typedef int GLsizei
470 // \brief A type definition for GLsizei.
476 // This method is for internal use only.
477 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
479 // \var typedef khronos_uint8_t GLubyte
480 // \brief A type definition for GLubyte.
483 typedef khronos_uint8_t GLubyte;
486 // This method is for internal use only.
487 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
489 // \var typedef unsigned short GLushort
490 // \brief A type definition for GLushort.
493 typedef unsigned short GLushort;
496 // This method is for internal use only.
497 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
499 // \var unsigned int GLuint
500 // \brief A type definition for GLuint.
503 typedef unsigned int GLuint;
506 // This method is for internal use only.
507 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
509 // \var typedef khronos_float_t GLfloat
510 // \brief A type definition for GLfloat.
513 typedef khronos_float_t GLfloat;
516 // This method is for internal use only.
517 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
519 // \var typedef khronos_float_t GLclampf
520 // \brief A type definition for GLclampf.
523 typedef khronos_float_t GLclampf;
526 // This method is for internal use only.
527 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
529 // \var typedef khronos_int32_t GLfixed
530 // \brief A type definition for GLfixed.
533 typedef khronos_int32_t GLfixed;
536 // This method is for internal use only.
537 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
539 // \var typedef khronos_int32_t GLclampx
540 // \brief A type definition for GLclampx.
543 typedef khronos_int32_t GLclampx;
546 // This method is for internal use only.
547 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
549 // \var typedef khronos_intptr_t GLintptr
550 // \brief A type definition for GLintptr.
553 typedef khronos_intptr_t GLintptr;
556 // This method is for internal use only.
557 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
559 // \var typedef khronos_ssize_t GLsizeiptr
560 // \brief A type definition for GLsizeiptr.
563 typedef khronos_ssize_t GLsizeiptr;
569 #endif /* __khrplatform_h_ */