Diligent Engine  v.2.4.g
pch.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 // stdafx.h : include file for standard system include files,
29 // or project specific include files that are used frequently, but
30 // are changed infrequently
31 //
32 
33 #pragma once
34 
35 #include <vector>
36 
37 #include <map>
38 #include <unordered_map>
39 #include <unordered_set>
40 #include <algorithm>
41 
42 #if PLATFORM_WIN32
43 
44 # ifndef GLEW_STATIC
45 # define GLEW_STATIC // Must be defined to use static version of glew
46 # endif
47 # include "GL/glew.h"
48 // Glew includes <windows.h>
49 # ifndef NOMINMAX
50 # define NOMINMAX
51 # endif
52 # include "GL/wglew.h"
53 # include <GL/GL.h>
54 
55 #elif PLATFORM_LINUX
56 
57 # ifndef GLEW_STATIC
58 # define GLEW_STATIC // Must be defined to use static version of glew
59 # endif
60 # ifndef GLEW_NO_GLU
61 # define GLEW_NO_GLU
62 # endif
63 
64 # include "GL/glew.h"
65 # include "GL/glxew.h"
66 # include <GL/glx.h>
67 
68 // Undefine beautiful defines from GL/glx.h -> X11/Xlib.h
69 # ifdef Bool
70 # undef Bool
71 # endif
72 # ifdef True
73 # undef True
74 # endif
75 # ifdef False
76 # undef False
77 # endif
78 # ifdef Status
79 # undef Status
80 # endif
81 # ifdef Success
82 # undef Success
83 # endif
84 # ifdef None
85 # undef None
86 # endif
87 
88 #elif PLATFORM_MACOS
89 
90 # ifndef GLEW_STATIC
91 # define GLEW_STATIC // Must be defined to use static version of glew
92 # endif
93 # ifndef GLEW_NO_GLU
94 # define GLEW_NO_GLU
95 # endif
96 
97 # include "GL/glew.h"
98 
99 #elif PLATFORM_ANDROID
100 
101 # include <GLES3/gl3.h>
102 # include <GLES3/gl3ext.h>
103 // GLStubs must be included after GLFeatures!
104 # include "GLStubsAndroid.h"
105 
106 #elif PLATFORM_IOS
107 
108 # include <OpenGLES/ES3/gl.h>
109 # include <OpenGLES/ES3/glext.h>
110 # include "GLStubsIOS.h"
111 
112 #else
113 # error Unsupported platform
114 #endif
115 
116 #include "GLStubs.h"
117 
118 #include "Errors.hpp"
119 
120 #include "PlatformDefinitions.h"
121 #include "RefCntAutoPtr.hpp"
122 #include "DebugUtilities.hpp"
123 #include "GLObjectWrapper.hpp"
124 #include "ValidatedCast.hpp"
125 #include "RenderDevice.h"
126 #include "BaseInterfacesGL.h"
127 
128 #define CHECK_GL_ERROR(...) \
129  do \
130  { \
131  auto err = glGetError(); \
132  if (err != GL_NO_ERROR) \
133  { \
134  LogError<false>(/*IsFatal=*/false, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__, "\nGL Error Code: ", err); \
135  UNEXPECTED("Error"); \
136  } \
137  } while (false)
138 
139 #define CHECK_GL_ERROR_AND_THROW(...) \
140  do \
141  { \
142  auto err = glGetError(); \
143  if (err != GL_NO_ERROR) \
144  LogError<true>(/*IsFatal=*/false, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__, "\nGL Error Code: ", err); \
145  } while (false)
146 
147 #ifdef DILIGENT_DEVELOPMENT
148 # define DEV_CHECK_GL_ERROR CHECK_GL_ERROR
149 #else
150 # define DEV_CHECK_GL_ERROR(...) \
151  do \
152  { \
153  } while (false)
154 #endif
PlatformDefinitions.h
DebugUtilities.hpp
ValidatedCast.hpp
BaseInterfacesGL.h
RenderDevice.h
GLStubsAndroid.h
GLStubs.h
GLStubsIOS.h
RefCntAutoPtr.hpp
Errors.hpp
GLObjectWrapper.hpp