1 /*
2  * Mesa 3-D graphics library
3  *
4  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
5  * Copyright (C) 2022  Yongang Luo       All Rights Reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23  * OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 
27 /**
28  * \file glheader.h
29  * Wrapper for GL/gl*.h and GLES[3|2|]/gl*.h
30  */
31 
32 
33 #ifndef GLHEADER_H
34 #define GLHEADER_H
35 
36 
37 #define GL_GLEXT_PROTOTYPES
38 #if defined(_WIN32) && !defined(__CYGWIN__)
39 /* Prevent glheader.h from including <windows.h> by defining APIENTRY */
40 #pragma push_macro("APIENTRY")
41 #ifndef APIENTRY
42 #define APIENTRY GLAPIENTRY
43 #endif
44 #include "GL/gl.h"
45 #include "GL/glext.h"
46 #pragma pop_macro("APIENTRY")
47 #else /* !(defined(_WIN32) && !defined(__CYGWIN__)) */
48 #include "GL/gl.h"
49 #include "GL/glext.h"
50 #endif /* defined(_WIN32) && !defined(__CYGWIN__) */
51 
52 /**
53  * Define GL_API, GL_APICALL and GL_APIENTRY to avoid MSVC/MinGW warnings
54  * about different dllimport attributes for prototypes between
55  * GL/gl*.h and GLES[|3|2]/gl*.h
56  */
57 #define GL_API GLAPI
58 #define GL_APICALL GLAPI
59 #define GL_APIENTRY GLAPIENTRY
60 
61 /**
62  * The order for including GLES[|3|2]/gl*.h headers are from newest to oldest.
63  * As the newer header contains extra symbols that are not present in the
64  * older header, some extra symbols can be visible only when you include the
65  * newer header first; otherwise, if the older header is included first, some
66  * extra symbols will be hidden by the older header.
67  * For example, suppose we move the inclusion of GLES/gl*.h to the front,
68  * then GL_SAMPLER_EXTERNAL_OES will not be present and cause compiling error.
69  */
70 
71 
72 #include "GLES3/gl3.h"
73 #include "GLES3/gl31.h"
74 #include "GLES3/gl32.h"
75 #include "GLES3/gl3ext.h"
76 #include "GLES2/gl2.h"
77 #include "GLES2/gl2ext.h"
78 #include "GLES/gl.h"
79 #include "GLES/glext.h"
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 
86 /* Custom Mesa types to save space. */
87 typedef unsigned char GLenum8; /* only for primitive modes */
88 typedef unsigned short GLenum16;
89 typedef unsigned char GLbitfield8;
90 typedef unsigned short GLbitfield16;
91 typedef GLuint64 GLbitfield64;
92 
93 /* There is no formal spec for the following extension. */
94 #ifndef GL_ATI_texture_compression_3dc
95 #define GL_ATI_texture_compression_3dc                          1
96 #define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI                   0x8837
97 #endif
98 
99 /**
100  * Internal token to represent a GLSL shader program (a collection of
101  * one or more shaders that get linked together).  Note that GLSL
102  * shaders and shader programs share one name space (one hash table)
103  * so we need a value that's different from any of the
104  * GL_VERTEX/FRAGMENT/GEOMETRY_PROGRAM tokens.
105  */
106 #define GL_SHADER_PROGRAM_MESA                                  0x9999
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* GLHEADER_H */
113