VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/vmsvga_glext/khrplatform.h@ 104874

Last change on this file since 104874 was 95751, checked in by vboxsync, 2 years ago

Devices/Graphics: Switch to new OpenGL headers, bugref:8515

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.9 KB
Line 
1#ifndef __khrplatform_h_
2#define __khrplatform_h_
3#ifndef RT_WITHOUT_PRAGMA_ONCE
4# pragma once
5#endif
6
7/*
8** Copyright (c) 2008-2018 The Khronos Group Inc.
9**
10** Permission is hereby granted, free of charge, to any person obtaining a
11** copy of this software and/or associated documentation files (the
12** "Materials"), to deal in the Materials without restriction, including
13** without limitation the rights to use, copy, modify, merge, publish,
14** distribute, sublicense, and/or sell copies of the Materials, and to
15** permit persons to whom the Materials are furnished to do so, subject to
16** the following conditions:
17**
18** The above copyright notice and this permission notice shall be included
19** in all copies or substantial portions of the Materials.
20**
21** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28*/
29
30/* Khronos platform-specific types and definitions.
31 *
32 * The master copy of khrplatform.h is maintained in the Khronos EGL
33 * Registry repository at https://github.com/KhronosGroup/EGL-Registry
34 * The last semantic modification to khrplatform.h was at commit ID:
35 * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
36 *
37 * Adopters may modify this file to suit their platform. Adopters are
38 * encouraged to submit platform specific modifications to the Khronos
39 * group so that they can be included in future versions of this file.
40 * Please submit changes by filing pull requests or issues on
41 * the EGL Registry repository linked above.
42 *
43 *
44 * See the Implementer's Guidelines for information about where this file
45 * should 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 should 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 should 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 should
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#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
97# define KHRONOS_STATIC 1
98#endif
99
100/*-------------------------------------------------------------------------
101 * Definition of KHRONOS_APICALL
102 *-------------------------------------------------------------------------
103 * This precedes the return type of the function in the function prototype.
104 */
105#if defined(KHRONOS_STATIC)
106 /* If the preprocessor constant KHRONOS_STATIC is defined, make the
107 * header compatible with static linking. */
108# define KHRONOS_APICALL
109#elif defined(_WIN32)
110# define KHRONOS_APICALL __declspec(dllimport)
111#elif defined (__SYMBIAN32__)
112# define KHRONOS_APICALL IMPORT_C
113#elif defined(__ANDROID__)
114# define KHRONOS_APICALL __attribute__((visibility("default")))
115#else
116# define KHRONOS_APICALL
117#endif
118
119/*-------------------------------------------------------------------------
120 * Definition of KHRONOS_APIENTRY
121 *-------------------------------------------------------------------------
122 * This follows the return type of the function and precedes the function
123 * name in the function prototype.
124 */
125#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
126 /* Win32 but not WinCE */
127# define KHRONOS_APIENTRY __stdcall
128#else
129# define KHRONOS_APIENTRY
130#endif
131
132/*-------------------------------------------------------------------------
133 * Definition of KHRONOS_APIATTRIBUTES
134 *-------------------------------------------------------------------------
135 * This follows the closing parenthesis of the function prototype arguments.
136 */
137#if defined (__ARMCC_2__)
138#define KHRONOS_APIATTRIBUTES __softfp
139#else
140#define KHRONOS_APIATTRIBUTES
141#endif
142
143/*-------------------------------------------------------------------------
144 * basic type definitions
145 *-----------------------------------------------------------------------*/
146#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
147
148
149/*
150 * Using <stdint.h>
151 */
152#include <stdint.h>
153typedef int32_t khronos_int32_t;
154typedef uint32_t khronos_uint32_t;
155typedef int64_t khronos_int64_t;
156typedef uint64_t khronos_uint64_t;
157#define KHRONOS_SUPPORT_INT64 1
158#define KHRONOS_SUPPORT_FLOAT 1
159/*
160 * To support platform where unsigned long cannot be used interchangeably with
161 * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
162 * Ideally, we could just use (u)intptr_t everywhere, but this could result in
163 * ABI breakage if khronos_uintptr_t is changed from unsigned long to
164 * unsigned long long or similar (this results in different C++ name mangling).
165 * To avoid changes for existing platforms, we restrict usage of intptr_t to
166 * platforms where the size of a pointer is larger than the size of long.
167 */
168#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
169#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
170#define KHRONOS_USE_INTPTR_T
171#endif
172#endif
173
174#elif defined(__VMS ) || defined(__sgi)
175
176/*
177 * Using <inttypes.h>
178 */
179#include <inttypes.h>
180typedef int32_t khronos_int32_t;
181typedef uint32_t khronos_uint32_t;
182typedef int64_t khronos_int64_t;
183typedef uint64_t khronos_uint64_t;
184#define KHRONOS_SUPPORT_INT64 1
185#define KHRONOS_SUPPORT_FLOAT 1
186
187#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
188
189/*
190 * Win32
191 */
192typedef __int32 khronos_int32_t;
193typedef unsigned __int32 khronos_uint32_t;
194typedef __int64 khronos_int64_t;
195typedef unsigned __int64 khronos_uint64_t;
196#define KHRONOS_SUPPORT_INT64 1
197#define KHRONOS_SUPPORT_FLOAT 1
198
199#elif defined(__sun__) || defined(__digital__)
200
201/*
202 * Sun or Digital
203 */
204typedef int khronos_int32_t;
205typedef unsigned int khronos_uint32_t;
206#if defined(__arch64__) || defined(_LP64)
207typedef long int khronos_int64_t;
208typedef unsigned long int khronos_uint64_t;
209#else
210typedef long long int khronos_int64_t;
211typedef unsigned long long int khronos_uint64_t;
212#endif /* __arch64__ */
213#define KHRONOS_SUPPORT_INT64 1
214#define KHRONOS_SUPPORT_FLOAT 1
215
216#elif 0
217
218/*
219 * Hypothetical platform with no float or int64 support
220 */
221typedef int khronos_int32_t;
222typedef unsigned int khronos_uint32_t;
223#define KHRONOS_SUPPORT_INT64 0
224#define KHRONOS_SUPPORT_FLOAT 0
225
226#else
227
228/*
229 * Generic fallback
230 */
231#include <stdint.h>
232typedef int32_t khronos_int32_t;
233typedef uint32_t khronos_uint32_t;
234typedef int64_t khronos_int64_t;
235typedef uint64_t khronos_uint64_t;
236#define KHRONOS_SUPPORT_INT64 1
237#define KHRONOS_SUPPORT_FLOAT 1
238
239#endif
240
241
242/*
243 * Types that are (so far) the same on all platforms
244 */
245typedef signed char khronos_int8_t;
246typedef unsigned char khronos_uint8_t;
247typedef signed short int khronos_int16_t;
248typedef unsigned short int khronos_uint16_t;
249
250/*
251 * Types that differ between LLP64 and LP64 architectures - in LLP64,
252 * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
253 * to be the only LLP64 architecture in current use.
254 */
255#ifdef KHRONOS_USE_INTPTR_T
256typedef intptr_t khronos_intptr_t;
257typedef uintptr_t khronos_uintptr_t;
258#elif defined(_WIN64)
259typedef signed long long int khronos_intptr_t;
260typedef unsigned long long int khronos_uintptr_t;
261#else
262typedef signed long int khronos_intptr_t;
263typedef unsigned long int khronos_uintptr_t;
264#endif
265
266#if defined(_WIN64)
267typedef signed long long int khronos_ssize_t;
268typedef unsigned long long int khronos_usize_t;
269#else
270typedef signed long int khronos_ssize_t;
271typedef unsigned long int khronos_usize_t;
272#endif
273
274#if KHRONOS_SUPPORT_FLOAT
275/*
276 * Float type
277 */
278typedef float khronos_float_t;
279#endif
280
281#if KHRONOS_SUPPORT_INT64
282/* Time types
283 *
284 * These types can be used to represent a time interval in nanoseconds or
285 * an absolute Unadjusted System Time. Unadjusted System Time is the number
286 * of nanoseconds since some arbitrary system event (e.g. since the last
287 * time the system booted). The Unadjusted System Time is an unsigned
288 * 64 bit value that wraps back to 0 every 584 years. Time intervals
289 * may be either signed or unsigned.
290 */
291typedef khronos_uint64_t khronos_utime_nanoseconds_t;
292typedef khronos_int64_t khronos_stime_nanoseconds_t;
293#endif
294
295/*
296 * Dummy value used to pad enum types to 32 bits.
297 */
298#ifndef KHRONOS_MAX_ENUM
299#define KHRONOS_MAX_ENUM 0x7FFFFFFF
300#endif
301
302/*
303 * Enumerated boolean type
304 *
305 * Values other than zero should be considered to be true. Therefore
306 * comparisons should not be made against KHRONOS_TRUE.
307 */
308typedef enum {
309 KHRONOS_FALSE = 0,
310 KHRONOS_TRUE = 1,
311 KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
312} khronos_boolean_enum_t;
313
314#endif /* !__khrplatform_h_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette