Fixup parsing for `Plural-Forms` (#15519)
[minetest.git] / irr / src / OpenGL / ExtensionHandler.h
blob403b828b30aa7174a327c48b40648179e56af4e5
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
7 #pragma once
9 #include <unordered_set>
11 #include "EDriverFeatures.h"
12 #include "irrTypes.h"
13 #include "os.h"
15 #include "Common.h"
16 #include <mt_opengl.h> // must be after Common.h
18 #include "COGLESCoreExtensionHandler.h"
20 namespace irr
22 namespace video
25 class COpenGL3ExtensionHandler : public COGLESCoreExtensionHandler
27 public:
28 COpenGL3ExtensionHandler() :
29 COGLESCoreExtensionHandler() {}
31 void initExtensions();
33 /// Checks whether a named extension is present
34 inline bool queryExtension(const std::string &name) const noexcept
36 return GL.IsExtensionPresent(name);
39 bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const
41 switch (feature) {
42 case EVDF_RENDER_TO_TARGET:
43 case EVDF_HARDWARE_TL:
44 case EVDF_MULTITEXTURE:
45 case EVDF_BILINEAR_FILTER:
46 case EVDF_MIP_MAP:
47 case EVDF_MIP_MAP_AUTO_UPDATE:
48 case EVDF_VERTEX_SHADER_1_1:
49 case EVDF_PIXEL_SHADER_1_1:
50 case EVDF_PIXEL_SHADER_1_2:
51 case EVDF_PIXEL_SHADER_2_0:
52 case EVDF_VERTEX_SHADER_2_0:
53 case EVDF_ARB_GLSL:
54 case EVDF_TEXTURE_NSQUARE:
55 case EVDF_TEXTURE_NPOT:
56 case EVDF_FRAMEBUFFER_OBJECT:
57 case EVDF_VERTEX_BUFFER_OBJECT:
58 case EVDF_COLOR_MASK:
59 case EVDF_ALPHA_TO_COVERAGE:
60 case EVDF_POLYGON_OFFSET:
61 case EVDF_BLEND_OPERATIONS:
62 case EVDF_BLEND_SEPARATE:
63 case EVDF_TEXTURE_MATRIX:
64 case EVDF_TEXTURE_CUBEMAP:
65 return true;
66 case EVDF_ARB_VERTEX_PROGRAM_1:
67 case EVDF_ARB_FRAGMENT_PROGRAM_1:
68 case EVDF_GEOMETRY_SHADER:
69 case EVDF_MULTIPLE_RENDER_TARGETS:
70 case EVDF_MRT_BLEND:
71 case EVDF_MRT_COLOR_MASK:
72 case EVDF_MRT_BLEND_FUNC:
73 case EVDF_OCCLUSION_QUERY:
74 return false;
75 case EVDF_STENCIL_BUFFER:
76 return StencilBuffer;
77 case EVDF_TEXTURE_MULTISAMPLE:
78 return TextureMultisampleSupported;
79 default:
80 return false;
84 static GLint GetInteger(GLenum key)
86 GLint val = 0;
87 GL.GetIntegerv(key, &val);
88 return val;
91 inline void irrGlActiveTexture(GLenum texture)
93 GL.ActiveTexture(texture);
96 inline void irrGlCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border,
97 GLsizei imageSize, const void *data)
99 os::Printer::log("Compressed textures aren't supported", ELL_ERROR);
102 inline void irrGlCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
103 GLenum format, GLsizei imageSize, const void *data)
105 os::Printer::log("Compressed textures aren't supported", ELL_ERROR);
108 inline void irrGlUseProgram(GLuint prog)
110 GL.UseProgram(prog);
113 inline void irrGlBindFramebuffer(GLenum target, GLuint framebuffer)
115 GL.BindFramebuffer(target, framebuffer);
118 inline void irrGlDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
120 GL.DeleteFramebuffers(n, framebuffers);
123 inline void irrGlGenFramebuffers(GLsizei n, GLuint *framebuffers)
125 GL.GenFramebuffers(n, framebuffers);
128 inline GLenum irrGlCheckFramebufferStatus(GLenum target)
130 return GL.CheckFramebufferStatus(target);
133 inline void irrGlFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
135 GL.FramebufferTexture2D(target, attachment, textarget, texture, level);
138 inline void irrGlGenerateMipmap(GLenum target)
140 GL.GenerateMipmap(target);
143 inline void irrGlDrawBuffer(GLenum mode)
145 // GLES only has DrawBuffers, so use that
146 GL.DrawBuffers(1, &mode);
149 inline void irrGlDrawBuffers(GLsizei n, const GLenum *bufs)
151 GL.DrawBuffers(n, bufs);
154 inline void irrGlBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
156 GL.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
159 inline void irrGlBlendEquation(GLenum mode)
161 GL.BlendEquation(mode);
164 bool AnisotropicFilterSupported = false;
165 bool BlendMinMaxSupported = false;
166 bool TextureMultisampleSupported = false;