summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp33
-rw-r--r--drivers/gles2/rasterizer_gles2.h3
2 files changed, 19 insertions, 17 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index c926f2bcc4..76ee80aa07 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -136,26 +136,21 @@ RasterizerScene *RasterizerGLES2::get_scene() {
return scene;
}
-void RasterizerGLES2::initialize() {
-
- print_verbose("Using GLES2 video driver");
+Error RasterizerGLES2::is_viable() {
#ifdef GLAD_ENABLED
if (!gladLoadGL()) {
ERR_PRINT("Error initializing GLAD");
+ return ERR_UNAVAILABLE;
}
// GLVersion seems to be used for both GL and GL ES, so we need different version checks for them
#ifdef OPENGL_ENABLED // OpenGL 2.1 Profile required
- if (GLVersion.major < 2) {
-#else // OpenGL ES 3.0
+ if (GLVersion.major < 2 || (GLVersion.major == 2 && GLVersion.minor < 1)) {
+#else // OpenGL ES 2.0
if (GLVersion.major < 2) {
#endif
- ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
- OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n"
- "Godot Engine will self-destruct as soon as you acknowledge this error message.",
- "Fatal error: Insufficient OpenGL / GLES driver support");
+ return ERR_UNAVAILABLE;
}
#ifdef GLES_OVER_GL
@@ -181,14 +176,21 @@ void RasterizerGLES2::initialize() {
glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
glGenerateMipmap = glGenerateMipmapEXT;
} else {
- ERR_PRINT("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n"
- "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
- OS::get_singleton()->alert("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n"
- "Godot Engine will self-destruct as soon as you acknowledge this error message.",
- "Fatal error: Insufficient OpenGL / GLES driver support");
+ return ERR_UNAVAILABLE;
}
}
#endif
+
+#endif // GLAD_ENABLED
+
+ return OK;
+}
+
+void RasterizerGLES2::initialize() {
+
+ print_verbose("Using GLES2 video driver");
+
+#ifdef GLAD_ENABLED
if (true || OS::get_singleton()->is_stdout_verbose()) {
if (GLAD_GL_ARB_debug_output) {
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
@@ -198,7 +200,6 @@ void RasterizerGLES2::initialize() {
print_line("OpenGL debugging not supported!");
}
}
-
#endif // GLAD_ENABLED
// For debugging
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index f727af39dd..98c73b776b 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -61,9 +61,10 @@ public:
virtual void end_frame(bool p_swap_buffers);
virtual void finalize();
+ static Error is_viable();
static void make_current();
-
static void register_config();
+
RasterizerGLES2();
~RasterizerGLES2();
};