Use GLES2 by default in the project manager
This only applies to the project manager instance, what driver is used is otherwise still defined by the project settings for a running game/editor. Should help users who have issues with buggy GLES3 drivers to still use the project manager to create and edit GLES2 projects.
This commit is contained in:
parent
cc86b11858
commit
8b1ee204cf
2 changed files with 25 additions and 4 deletions
|
@ -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"));
|
||||
|
|
|
@ -1022,8 +1022,12 @@ 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 == "") {
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue