Skip to content

Commit

Permalink
Merge pull request #50984 from Calinou/project-manager-vulkan-cluster…
Browse files Browse the repository at this point in the history
…ed-mobile

Expose Vulkan's clustered and mobile backends in the project manager
  • Loading branch information
akien-mga authored Jul 30, 2021
2 parents 1f6a81c + d2b65c6 commit bc8a85b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
37 changes: 15 additions & 22 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,7 @@ class ProjectDialog : public ConfirmationDialog {
return;
}
ProjectSettings::CustomMap initial_settings;
if (rasterizer_button_group->get_pressed_button()->get_meta("driver_name") == "Vulkan") {
initial_settings["rendering/driver/driver_name"] = "Vulkan";
} else {
initial_settings["rendering/driver/driver_name"] = "GLES2";
initial_settings["rendering/textures/vram_compression/import_etc2"] = false;
initial_settings["rendering/textures/vram_compression/import_etc"] = true;
}
initial_settings["rendering/vulkan/rendering/back_end"] = rasterizer_button_group->get_pressed_button()->get_meta(SNAME("driver_name"));
initial_settings["application/config/name"] = project_name->get_text().strip_edges();
initial_settings["application/config/icon"] = "res://icon.png";
initial_settings["rendering/environment/defaults/default_environment"] = "res://default_env.tres";
Expand Down Expand Up @@ -869,37 +863,36 @@ class ProjectDialog : public ConfirmationDialog {
rshb->add_child(rvb);
Button *rs_button = memnew(CheckBox);
rs_button->set_button_group(rasterizer_button_group);
rs_button->set_text(TTR("Vulkan"));
rs_button->set_meta("driver_name", "Vulkan");
rs_button->set_text(TTR("Vulkan Clustered"));
rs_button->set_meta(SNAME("driver_name"), 0); // Vulkan backend "Forward Clustered"
rs_button->set_pressed(true);
rvb->add_child(rs_button);
l = memnew(Label);
l->set_text(TTR("- Higher visual quality\n- More accurate API, which produces very fast code\n- Some features not implemented yet - work in progress\n- Incompatible with older hardware\n- Not recommended for web and mobile games"));
l->set_text(
String::utf8("") + TTR("Supports desktop platforms only.") +
String::utf8("\n") + TTR("Advanced 3D graphics available.") +
String::utf8("\n") + TTR("Can scale to large complex scenes.") +
String::utf8("\n") + TTR("Slower rendering of simple scenes."));
l->set_modulate(Color(1, 1, 1, 0.7));
rvb->add_child(l);

rshb->add_child(memnew(VSeparator));

const String gles2_unsupported_tooltip =
TTR("The GLES2 renderer is currently unavailable, as it needs to be reworked for Godot 4.0.\nUse Godot 3.2 if you need GLES2 support.");

rvb = memnew(VBoxContainer);
rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
rshb->add_child(rvb);
rs_button = memnew(CheckBox);
rs_button->set_button_group(rasterizer_button_group);
rs_button->set_text(TTR("OpenGL ES 2.0 (currently unavailable)"));
rs_button->set_meta("driver_name", "GLES2");
rs_button->set_disabled(true);
rs_button->set_tooltip(gles2_unsupported_tooltip);
rs_button->set_text(TTR("Vulkan Mobile"));
rs_button->set_meta(SNAME("driver_name"), 1); // Vulkan backend "Forward Mobile"
rvb->add_child(rs_button);
l = memnew(Label);
l->set_text(TTR("- Lower visual quality\n- Some features not available\n- Works on most hardware\n- Recommended for web and mobile games"));
l->set_text(
String::utf8("") + TTR("Supports desktop + mobile platforms.") +
String::utf8("\n") + TTR("Less advanced 3D graphics.") +
String::utf8("\n") + TTR("Less scalable for complex scenes.") +
String::utf8("\n") + TTR("Faster rendering of simple scenes."));
l->set_modulate(Color(1, 1, 1, 0.7));
// Also set the tooltip on the label so it appears when hovering either the checkbox or label.
l->set_tooltip(gles2_unsupported_tooltip);
// Required for the tooltip to show.
l->set_mouse_filter(Control::MOUSE_FILTER_STOP);
rvb->add_child(l);

l = memnew(Label);
Expand Down
6 changes: 3 additions & 3 deletions servers/rendering_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2763,12 +2763,12 @@ RenderingServer::RenderingServer() {

GLOBAL_DEF("rendering/2d/shadow_atlas/size", 2048);

GLOBAL_DEF_RST("rendering/vulkan/rendering/back_end", 0);
GLOBAL_DEF_RST("rendering/vulkan/rendering/back_end.mobile", 1);
GLOBAL_DEF_RST_BASIC("rendering/vulkan/rendering/back_end", 0);
GLOBAL_DEF_RST_BASIC("rendering/vulkan/rendering/back_end.mobile", 1);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/vulkan/rendering/back_end",
PropertyInfo(Variant::INT,
"rendering/vulkan/rendering/back_end",
PROPERTY_HINT_ENUM, "ForwardClustered,ForwardMobile"));
PROPERTY_HINT_ENUM, "Forward Clustered (Supports Desktop Only),Forward Mobile (Supports Desktop and Mobile)"));

GLOBAL_DEF("rendering/shader_compiler/shader_cache/enabled", true);
GLOBAL_DEF("rendering/shader_compiler/shader_cache/compress", true);
Expand Down

0 comments on commit bc8a85b

Please sign in to comment.