Merge pull request #44041 from akien-mga/project-manager-default-gles2

Use GLES2 by default in the project manager
This commit is contained in:
Rémi Verschelde 2020-12-07 11:30:23 +01:00 committed by GitHub
commit 218d10a6a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View file

@ -52,6 +52,11 @@
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
// Used to test for GLES3 support.
#ifndef SERVER_ENABLED
#include "drivers/gles3/rasterizer_gles3.h"
#endif
static inline String get_project_key_from_path(const String &dir) {
return dir.replace("/", "::");
}
@ -878,7 +883,14 @@ public:
rasterizer_container->add_child(rshb);
rasterizer_button_group.instance();
bool is_gles3 = OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES3;
// Enable GLES3 by default as it's the default value for the project setting.
#ifndef SERVER_ENABLED
bool gles3_viable = RasterizerGLES3::is_viable() == OK;
#else
// Whatever, project manager isn't even used in headless builds.
bool gles3_viable = false;
#endif
Container *rvb = memnew(VBoxContainer);
rvb->set_h_size_flags(SIZE_EXPAND_FILL);
rshb->add_child(rvb);
@ -886,9 +898,14 @@ public:
rs_button->set_button_group(rasterizer_button_group);
rs_button->set_text(TTR("OpenGL ES 3.0"));
rs_button->set_meta("driver_name", "GLES3");
rs_button->set_pressed(is_gles3);
rs_button->set_pressed(gles3_viable);
// If GLES3 can't be used, don't let users shoot themselves in the foot.
rs_button->set_disabled(!gles3_viable);
rvb->add_child(rs_button);
l = memnew(Label);
l->set_text(TTR("Not supported by your GPU drivers."));
rvb->add_child(l);
l = memnew(Label);
l->set_text(TTR("Higher visual quality\nAll features available\nIncompatible with older hardware\nNot recommended for web games"));
rvb->add_child(l);
@ -901,7 +918,7 @@ public:
rs_button->set_button_group(rasterizer_button_group);
rs_button->set_text(TTR("OpenGL ES 2.0"));
rs_button->set_meta("driver_name", "GLES2");
rs_button->set_pressed(!is_gles3);
rs_button->set_pressed(!gles3_viable);
rvb->add_child(rs_button);
l = memnew(Label);
l->set_text(TTR("Lower visual quality\nSome features not available\nWorks on most hardware\nRecommended for web games"));

View file

@ -1022,7 +1022,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("rendering/quality/driver/driver_name", "GLES3");
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/driver/driver_name", PropertyInfo(Variant::STRING, "rendering/quality/driver/driver_name", PROPERTY_HINT_ENUM, "GLES2,GLES3"));
if (video_driver == "") {
video_driver = GLOBAL_GET("rendering/quality/driver/driver_name");
if (project_manager) {
video_driver = "GLES2"; // Force GLES2 for maximum compatibility, unless specified from command line.
} else {
video_driver = GLOBAL_GET("rendering/quality/driver/driver_name");
}
}
GLOBAL_DEF("rendering/quality/driver/fallback_to_gles2", false);