]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/OpenGL/ExtensionHandler.h
Fix line endings in the new driver
[irrlicht.git] / source / Irrlicht / OpenGL / ExtensionHandler.h
1 // Copyright (C) 2023 Vitaliy Lobachevskiy
2 // Copyright (C) 2015 Patryk Nadrowski
3 // Copyright (C) 2009-2010 Amundis
4 // This file is part of the "Irrlicht Engine".
5 // For conditions of distribution and use, see copyright notice in Irrlicht.h
6
7 #pragma once
8
9 #include "EDriverFeatures.h"
10 #include "irrTypes.h"
11 #include "os.h"
12
13 #include "Common.h"
14
15 #include "COGLESCoreExtensionHandler.h"
16
17 namespace irr
18 {
19 namespace video
20 {
21
22         class COpenGL3ExtensionHandler : public COGLESCoreExtensionHandler
23         {
24         public:
25                 COpenGL3ExtensionHandler() : COGLESCoreExtensionHandler() {}
26
27                 void initExtensions();
28
29                 bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const
30                 {
31                         switch (feature)
32                         {
33                         case EVDF_RENDER_TO_TARGET:
34                         case EVDF_HARDWARE_TL:
35                         case EVDF_MULTITEXTURE:
36                         case EVDF_BILINEAR_FILTER:
37                         case EVDF_MIP_MAP:
38                         case EVDF_MIP_MAP_AUTO_UPDATE:
39                         case EVDF_VERTEX_SHADER_1_1:
40                         case EVDF_PIXEL_SHADER_1_1:
41                         case EVDF_PIXEL_SHADER_1_2:
42                         case EVDF_PIXEL_SHADER_2_0:
43                         case EVDF_VERTEX_SHADER_2_0:
44                         case EVDF_ARB_GLSL:
45                         case EVDF_TEXTURE_NSQUARE:
46                         case EVDF_TEXTURE_NPOT:
47                         case EVDF_FRAMEBUFFER_OBJECT:
48                         case EVDF_VERTEX_BUFFER_OBJECT:
49                         case EVDF_COLOR_MASK:
50                         case EVDF_ALPHA_TO_COVERAGE:
51                         case EVDF_POLYGON_OFFSET:
52                         case EVDF_BLEND_OPERATIONS:
53                         case EVDF_BLEND_SEPARATE:
54                         case EVDF_TEXTURE_MATRIX:
55                         case EVDF_TEXTURE_CUBEMAP:
56                                 return true;
57                         case EVDF_ARB_VERTEX_PROGRAM_1:
58                         case EVDF_ARB_FRAGMENT_PROGRAM_1:
59                         case EVDF_GEOMETRY_SHADER:
60                         case EVDF_MULTIPLE_RENDER_TARGETS:
61                         case EVDF_MRT_BLEND:
62                         case EVDF_MRT_COLOR_MASK:
63                         case EVDF_MRT_BLEND_FUNC:
64                         case EVDF_OCCLUSION_QUERY:
65                                 return false;
66                         case EVDF_TEXTURE_COMPRESSED_DXT:
67                                 return false; // NV Tegra need improvements here
68                         case EVDF_TEXTURE_COMPRESSED_PVRTC:
69                                 return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
70                         case EVDF_TEXTURE_COMPRESSED_PVRTC2:
71                                 return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc2];
72                         case EVDF_TEXTURE_COMPRESSED_ETC1:
73                                 return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
74                         case EVDF_TEXTURE_COMPRESSED_ETC2:
75                                 return false;
76                         case EVDF_STENCIL_BUFFER:
77                                 return StencilBuffer;
78                         default:
79                                 return false;
80                         };
81                 }
82
83                 inline void irrGlActiveTexture(GLenum texture)
84                 {
85                         glActiveTexture(texture);
86                 }
87
88                 inline void irrGlCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border,
89                         GLsizei imageSize, const void* data)
90                 {
91                         glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
92                 }
93
94                 inline void irrGlCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
95                         GLenum format, GLsizei imageSize, const void* data)
96                 {
97                         glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
98                 }
99
100                 inline void irrGlUseProgram(GLuint prog)
101                 {
102                         glUseProgram(prog);
103                 }
104
105                 inline void irrGlBindFramebuffer(GLenum target, GLuint framebuffer)
106                 {
107                         glBindFramebuffer(target, framebuffer);
108                 }
109
110                 inline void irrGlDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
111                 {
112                         glDeleteFramebuffers(n, framebuffers);
113                 }
114
115                 inline void irrGlGenFramebuffers(GLsizei n, GLuint *framebuffers)
116                 {
117                         glGenFramebuffers(n, framebuffers);
118                 }
119
120                 inline GLenum irrGlCheckFramebufferStatus(GLenum target)
121                 {
122                         return glCheckFramebufferStatus(target);
123                 }
124
125                 inline void irrGlFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
126                 {
127                         glFramebufferTexture2D(target, attachment, textarget, texture, level);
128                 }
129
130                 inline void irrGlGenerateMipmap(GLenum target)
131                 {
132                         glGenerateMipmap(target);
133                 }
134
135                 inline void irrGlActiveStencilFace(GLenum face)
136                 {
137                 }
138
139                 inline void irrGlDrawBuffer(GLenum mode)
140                 {
141                 }
142
143                 inline void irrGlDrawBuffers(GLsizei n, const GLenum *bufs)
144                 {
145                 }
146
147                 inline void irrGlBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
148                 {
149                         glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
150                 }
151
152                 inline void irrGlBlendEquation(GLenum mode)
153                 {
154                         glBlendEquation(mode);
155                 }
156
157                 inline void irrGlEnableIndexed(GLenum target, GLuint index)
158                 {
159                 }
160
161                 inline void irrGlDisableIndexed(GLenum target, GLuint index)
162                 {
163                 }
164
165                 inline void irrGlColorMaskIndexed(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
166                 {
167                 }
168
169                 inline void irrGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst)
170                 {
171                 }
172
173                 inline void irrGlBlendFuncSeparateIndexed(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
174                 {
175                 }
176
177                 inline void irrGlBlendEquationIndexed(GLuint buf, GLenum mode)
178                 {
179                 }
180
181                 inline void irrGlBlendEquationSeparateIndexed(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
182                 {
183                 }
184         };
185
186 }
187 }