Tizen 2.1 base
[framework/osp/uifw.git] / inc / khrplatform.h
1 /* $Change: 1028567 $ */
2 #ifndef __khrplatform_h_
3 #define __khrplatform_h_
4
5 /*
6 ** Copyright (c) 2008-2009 The Khronos Group Inc.
7 **
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:
15 **
16 ** The above copyright notice and this permission notice shall be included
17 ** in all copies or substantial portions of the Materials.
18 **
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.
26 */
27
28 /* Khronos platform-specific types and definitions.
29  *
30  * $Revision: #1 $ on $Date: 2011/08/12 $
31  *
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".
38  *
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.
42  *
43  *
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
47  *
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.
51  *
52  * The types in khrplatform.h must only be used to define API-specific types.
53  *
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
70  *                                         nanoseconds
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.
76  *
77  * Tokens defined in khrplatform.h:
78  *
79  *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
80  *
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.
83  *
84  * Calling convention macros defined in this file:
85  *    KHRONOS_APICALL
86  *    KHRONOS_APIENTRY
87  *    KHRONOS_APIATTRIBUTES
88  *
89  * These may be used in function prototypes as:
90  *
91  *      KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
92  *                                  int arg1,
93  *                                  int arg2) KHRONOS_APIATTRIBUTES;
94  */
95
96 /**
97  * @addtogroup opengles
98  *
99  * @{
100  */
101
102 /*-------------------------------------------------------------------------
103  * Definition of KHRONOS_APICALL
104  *-------------------------------------------------------------------------
105  * This precedes the return type of the function in the function prototype.
106  */
107 #if defined(_WIN32)
108 #ifdef __KHRONOS_EXPORTS
109 #define KHRONOS_APICALL __declspec(dllexport)
110 #else
111 #define KHRONOS_APICALL __declspec(dllimport)
112 #endif
113 //#define KHRONOS_APICALL extern
114 #elif defined(__SYMBIAN32__)
115 #define KHRONOS_APICALL IMPORT_C
116 #else
117 #define KHRONOS_APICALL extern
118 #endif
119
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.
125  */
126 #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
127 /* Win32 but not WinCE */
128 #define KHRONOS_APIENTRY __stdcall
129 #else
130 #define KHRONOS_APIENTRY
131 #endif
132
133 /*-------------------------------------------------------------------------
134  * Definition of KHRONOS_APIATTRIBUTES
135  *-------------------------------------------------------------------------
136  * This follows the closing parenthesis of the function prototype arguments.
137  */
138 #if defined(__ARMCC_2__)
139 #define KHRONOS_APIATTRIBUTES __softfp
140 #else
141 #define KHRONOS_APIATTRIBUTES
142 #endif
143
144 /*-------------------------------------------------------------------------
145  * basic type definitions
146  *-----------------------------------------------------------------------*/
147 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
148
149
150 //
151 // This method is for internal use only.
152 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
153 //
154 // Using <stdint.h>
155 // @since 2.0
156 //
157 #include <stdint.h>
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
164
165 #elif defined(__VMS) || defined(__sgi)
166
167 //
168 // This method is for internal use only.
169 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
170 //
171 // Using <inttypes.h>
172 // @since 2.0
173 //
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
181
182 #elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
183
184 //
185 // This method is for internal use only.
186 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
187 //
188 // Win32
189 // @since 2.0
190 //
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
197
198 #elif defined(__sun__) || defined(__digital__)
199
200 //
201 // This method is for internal use only.
202 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
203 //
204 // Sun or Digital
205 // @since 2.0
206 //
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;
212 #else
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
218
219 #elif 0
220
221 /*
222  * Hypothetical platform with no float or int64 support
223  */
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
228
229 #else
230
231 //
232 // This method is for internal use only.
233 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
234 //
235 // Generic fallback
236 // @since 2.0
237 //
238 #include <stdint.h>
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
245
246 #endif
247
248
249 /*
250  * Types that are (so far) the same on all platforms
251  */
252 //
253 // This method is for internal use only.
254 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
255 //
256 // \var typedef signed char khronos_int8_t
257 // \brief A type definition for khronos_int8_t.
258 // @since 2.0
259 //
260 typedef signed char khronos_int8_t;
261
262 //
263 // This method is for internal use only.
264 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
265 //
266 // \var typedef unsigned char khronos_uint8_t
267 // \brief A type definition for khronos_uint8_t.
268 // @since 2.0
269 //
270 typedef unsigned char khronos_uint8_t;
271
272 //
273 // This method is for internal use only.
274 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
275 //
276 // \var typedef signed   short int     khronos_int16_t
277 // \brief A type definition for khronos_int16_t.
278 // @since 2.0
279 //
280 typedef signed short int khronos_int16_t;
281
282 //
283 // This method is for internal use only.
284 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
285 //
286 // \var typedef unsigned short int     khronos_uint16_t
287 // \brief A type definition for khronos_uint16_t.
288 // @since 2.0
289 //
290 typedef unsigned short int khronos_uint16_t;
291
292 //
293 // This method is for internal use only.
294 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
295 //
296 // \var typedef signed   long  int     khronos_intptr_t
297 // \brief A type definition for khronos_intptr_t.
298 // @since 2.0
299 //
300 typedef signed long int khronos_intptr_t;
301
302 //
303 // This method is for internal use only.
304 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
305 //
306 // \var typedef unsigned long  int     khronos_uintptr_t
307 // \brief A type definition for khronos_uintptr_t.
308 // @since 2.0
309 //
310 typedef unsigned long int khronos_uintptr_t;
311
312 //
313 // This method is for internal use only.
314 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
315 //
316 // \var typedef signed   long  int     khronos_ssize_t
317 // \brief A type definition for khronos_ssize_t.
318 // @since 2.0
319 //
320 typedef signed long int khronos_ssize_t;
321
322 //
323 // This method is for internal use only.
324 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
325 //
326 // \var typedef unsigned long  int     khronos_usize_t
327 // \brief A type definition for khronos_usize_t.
328 // @since 2.0
329 //
330 typedef unsigned long int khronos_usize_t;
331
332 #if KHRONOS_SUPPORT_FLOAT
333 //
334 // This method is for internal use only.
335 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
336 //
337 // Float type
338 // @since 2.0
339 //
340 typedef          float khronos_float_t;
341 #endif
342
343 #if KHRONOS_SUPPORT_INT64
344 //
345 // This method is for internal use only.
346 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
347 //
348 // Time types
349 //
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.
355 // @since 2.0
356 //
357 typedef khronos_uint64_t khronos_utime_nanoseconds_t;
358 typedef khronos_int64_t khronos_stime_nanoseconds_t;
359 #endif
360
361 //
362 // This method is for internal use only.
363 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
364 //
365 // Dummy value used to pad enum types to 32 bits.
366 // @since 2.0
367 //
368 #ifndef KHRONOS_MAX_ENUM
369 #define KHRONOS_MAX_ENUM 0x7FFFFFFF
370 #endif
371
372 //
373 // This method is for internal use only.
374 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
375 //
376 // Enumerated boolean type
377 //
378 // Values other than zero must be considered to be true. Therefore
379 // comparisons must not be made against KHRONOS_TRUE.
380 // @since 2.0
381 //
382 typedef enum
383 {
384         KHRONOS_FALSE = 0,
385         KHRONOS_TRUE = 1,
386         KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
387 } khronos_boolean_enum_t;
388
389
390
391 /*-------------------------------------------------------------------------
392  * Data type definitions for GL APIs
393  *-----------------------------------------------------------------------*/
394
395 //
396 // This method is for internal use only.
397 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
398 //
399 // \var typedef void GLvoid
400 // \brief A type definition for GLvoid.
401 // @since 2.0
402 //
403 typedef void GLvoid;
404
405 //
406 // This method is for internal use only.
407 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
408 //
409 // \var typedef unsigned int GLenum
410 // \brief A type definition for GLenum.
411 // @since 2.0
412 //
413 typedef unsigned int GLenum;
414
415 //
416 // This method is for internal use only.
417 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
418 //
419 // \var typedef unsigned char GLboolean
420 // \brief A type definition for GLboolean.
421 // @since 2.0
422 //
423 typedef unsigned char GLboolean;
424
425 //
426 // This method is for internal use only.
427 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
428 //
429 // \var typedef unsigned int GLbitfield
430 // \brief A type definition for GLbitfield.
431 // @since 2.0
432 //
433 typedef unsigned int GLbitfield;
434
435 //
436 // This method is for internal use only.
437 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
438 //
439 // \var typedef signed char GLbyte
440 // \brief A type definition for GLbyte.
441 // @since 2.0
442 //
443 typedef khronos_int8_t GLbyte;
444
445 //
446 // This method is for internal use only.
447 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
448 //
449 // \var typedef short GLshort
450 // \brief A type definition for GLshort.
451 // @since 2.0
452 //
453 typedef short GLshort;
454
455 //
456 // This method is for internal use only.
457 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
458 //
459 // \var typedef int GLint
460 // \brief A type definition for GLint.
461 // @since 2.0
462 //
463 typedef int GLint;
464
465 //
466 // This method is for internal use only.
467 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
468 //
469 // \var typedef int GLsizei
470 // \brief A type definition for GLsizei.
471 // @since 2.0
472 //
473 typedef int GLsizei;
474
475 //
476 // This method is for internal use only.
477 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
478 //
479 // \var typedef khronos_uint8_t GLubyte
480 // \brief A type definition for GLubyte.
481 // @since 2.0
482 //
483 typedef khronos_uint8_t GLubyte;
484
485 //
486 // This method is for internal use only.
487 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
488 //
489 // \var typedef unsigned short GLushort
490 // \brief A type definition for GLushort.
491 // @since 2.0
492 //
493 typedef unsigned short GLushort;
494
495 //
496 // This method is for internal use only.
497 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
498 //
499 // \var unsigned int       GLuint
500 // \brief A type definition for GLuint.
501 // @since 2.0
502 //
503 typedef unsigned int GLuint;
504
505 //
506 // This method is for internal use only.
507 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
508 //
509 // \var typedef khronos_float_t GLfloat
510 // \brief A type definition for GLfloat.
511 // @since 2.0
512 //
513 typedef khronos_float_t GLfloat;
514
515 //
516 // This method is for internal use only.
517 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
518 //
519 // \var typedef khronos_float_t GLclampf
520 // \brief A type definition for GLclampf.
521 // @since 2.0
522 //
523 typedef khronos_float_t GLclampf;
524
525 //
526 // This method is for internal use only.
527 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
528 //
529 // \var typedef khronos_int32_t GLfixed
530 // \brief A type definition for GLfixed.
531 // @since 2.0
532 //
533 typedef khronos_int32_t GLfixed;
534
535 //
536 // This method is for internal use only.
537 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
538 //
539 // \var typedef khronos_int32_t GLclampx
540 // \brief A type definition for GLclampx.
541 // @since 2.0
542 //
543 typedef khronos_int32_t GLclampx;
544
545 //
546 // This method is for internal use only.
547 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
548 //
549 // \var typedef khronos_intptr_t GLintptr
550 // \brief A type definition for GLintptr.
551 // @since 2.0
552 //
553 typedef khronos_intptr_t GLintptr;
554
555 //
556 // This method is for internal use only.
557 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
558 //
559 // \var typedef khronos_ssize_t GLsizeiptr
560 // \brief A type definition for GLsizeiptr.
561 // @since 2.0
562 //
563 typedef khronos_ssize_t GLsizeiptr;
564
565 /**
566  * @}
567  */
568
569 #endif /* __khrplatform_h_ */