summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile7
-rw-r--r--editor/editor_node.cpp11
-rw-r--r--editor/editor_node.h4
-rw-r--r--editor/editor_resource_picker.cpp8
-rw-r--r--editor/editor_resource_picker.h1
-rw-r--r--editor/export/project_export.cpp24
-rw-r--r--editor/export/project_export.h5
-rw-r--r--editor/surface_upgrade_tool.cpp49
-rw-r--r--editor/surface_upgrade_tool.h13
-rw-r--r--platform/ios/export/export_plugin.cpp18
-rw-r--r--platform/ios/export/export_plugin.h1
-rw-r--r--platform/windows/gl_manager_windows_native.cpp8
-rw-r--r--scene/gui/graph_edit.cpp2
-rw-r--r--scene/resources/packed_scene.cpp4
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp4
-rw-r--r--servers/rendering/shader_types.cpp4
-rw-r--r--servers/rendering_server.cpp66
17 files changed, 167 insertions, 62 deletions
diff --git a/doc/Makefile b/doc/Makefile
index 53c5c7dcb0..722746f366 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -4,7 +4,7 @@ OUTPUTDIR = $(BASEDIR)/_build
TOOLSDIR = $(BASEDIR)/tools
JSDIR = "$(BASEDIR)/../platform/web"
LANGARG ?= en
-LANGCMD = -l $(LANGARG)
+TOOLSOPT ?=
.ONESHELL:
@@ -19,7 +19,10 @@ doxygen:
rst:
rm -rf "$(OUTPUTDIR)/rst"
mkdir -p "$(OUTPUTDIR)/rst"
- python3 "$(TOOLSDIR)/make_rst.py" -o "$(OUTPUTDIR)/rst" "$(LANGCMD)" $(CLASSES)
+ python3 "$(TOOLSDIR)/make_rst.py" -o "$(OUTPUTDIR)/rst" -l "$(LANGARG)" $(TOOLSOPT) $(CLASSES)
+
+xml-check:
+ python3 "$(TOOLSDIR)/make_rst.py" --dry-run -l "$(LANGARG)" $(TOOLSOPT) $(CLASSES)
rstjs:
rm -rf "$(OUTPUTDIR)/rstjs"
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 119e684f1e..6012ff1f70 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3048,6 +3048,9 @@ void EditorNode::_tool_menu_option(int p_idx) {
case TOOLS_ORPHAN_RESOURCES: {
orphan_resources->show();
} break;
+ case TOOLS_SURFACE_UPGRADE: {
+ surface_upgrade_dialog->popup_centered(Size2(750 * EDSCALE, 0));
+ } break;
case TOOLS_CUSTOM: {
if (tool_menu->get_item_submenu(p_idx) == "") {
Callable callback = tool_menu->get_item_metadata(p_idx);
@@ -4671,6 +4674,10 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo
return OK;
}
+bool EditorNode::is_project_exporting() const {
+ return project_export && project_export->is_exporting();
+}
+
void EditorNode::show_accept(const String &p_text, const String &p_title) {
current_menu_option = -1;
if (accept) {
@@ -7429,6 +7436,7 @@ EditorNode::EditorNode() {
project_menu->add_child(tool_menu);
project_menu->add_submenu_item(TTR("Tools"), "Tools");
tool_menu->add_item(TTR("Orphan Resource Explorer..."), TOOLS_ORPHAN_RESOURCES);
+ tool_menu->add_item(TTR("Upgrade Mesh Surfaces..."), TOOLS_SURFACE_UPGRADE);
project_menu->add_separator();
project_menu->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RELOAD_CURRENT_PROJECT);
@@ -7768,6 +7776,9 @@ EditorNode::EditorNode() {
orphan_resources = memnew(OrphanResourcesDialog);
gui_base->add_child(orphan_resources);
+ surface_upgrade_dialog = memnew(SurfaceUpgradeDialog);
+ gui_base->add_child(surface_upgrade_dialog);
+
confirmation = memnew(ConfirmationDialog);
gui_base->add_child(confirmation);
confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 0ee2330927..d4a8fc9aa8 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -114,6 +114,7 @@ class RunSettingsDialog;
class SceneImportSettings;
class ScriptCreateDialog;
class SurfaceUpgradeTool;
+class SurfaceUpgradeDialog;
class WindowWrapper;
class EditorNode : public Node {
@@ -192,6 +193,7 @@ private:
EDIT_RELOAD_SAVED_SCENE,
TOOLS_ORPHAN_RESOURCES,
TOOLS_BUILD_PROFILE_MANAGER,
+ TOOLS_SURFACE_UPGRADE,
TOOLS_CUSTOM,
RESOURCE_SAVE,
RESOURCE_SAVE_AS,
@@ -496,6 +498,7 @@ private:
HashMap<String, Ref<Texture2D>> icon_type_cache;
SurfaceUpgradeTool *surface_upgrade_tool = nullptr;
+ SurfaceUpgradeDialog *surface_upgrade_dialog = nullptr;
bool run_surface_upgrade_tool = false;
static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS];
@@ -875,6 +878,7 @@ public:
void _copy_warning(const String &p_str);
Error export_preset(const String &p_preset, const String &p_path, bool p_debug, bool p_pack_only);
+ bool is_project_exporting() const;
Control *get_gui_base() { return gui_base; }
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 3b7cce60bf..822b379091 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -233,6 +233,7 @@ void EditorResourcePicker::_update_menu_items() {
}
edit_menu->add_icon_item(get_editor_theme_icon(SNAME("Save")), TTR("Save"), OBJ_MENU_SAVE);
+ edit_menu->add_icon_item(get_editor_theme_icon(SNAME("Save")), TTR("Save As..."), OBJ_MENU_SAVE_AS);
}
if (edited_resource->get_path().is_resource_file()) {
@@ -400,6 +401,13 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
EditorNode::get_singleton()->save_resource(edited_resource);
} break;
+ case OBJ_MENU_SAVE_AS: {
+ if (edited_resource.is_null()) {
+ return;
+ }
+ EditorNode::get_singleton()->save_resource_as(edited_resource);
+ } break;
+
case OBJ_MENU_COPY: {
EditorSettings::get_singleton()->set_resource_clipboard(edited_resource);
} break;
diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h
index 856ef974d3..0046354861 100644
--- a/editor/editor_resource_picker.h
+++ b/editor/editor_resource_picker.h
@@ -72,6 +72,7 @@ class EditorResourcePicker : public HBoxContainer {
OBJ_MENU_MAKE_UNIQUE,
OBJ_MENU_MAKE_UNIQUE_RECURSIVE,
OBJ_MENU_SAVE,
+ OBJ_MENU_SAVE_AS,
OBJ_MENU_COPY,
OBJ_MENU_PASTE,
OBJ_MENU_SHOW_IN_FILE_SYSTEM,
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 05f012e5fb..719c3114f4 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -1076,11 +1076,13 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
EditorSettings::get_singleton()->set_project_metadata("export_options", "default_filename", default_filename);
Ref<EditorExportPreset> current = get_current_preset();
- ERR_FAIL_COND(current.is_null());
+ ERR_FAIL_COND_MSG(current.is_null(), "Failed to start the export: current preset is invalid.");
Ref<EditorExportPlatform> platform = current->get_platform();
- ERR_FAIL_COND(platform.is_null());
+ ERR_FAIL_COND_MSG(platform.is_null(), "Failed to start the export: current preset has no valid platform.");
current->set_export_path(p_path);
+ exporting = true;
+
platform->clear_messages();
Error err = platform->export_project(current, export_debug->is_pressed(), current->get_export_path(), 0);
result_dialog_log->clear();
@@ -1089,6 +1091,8 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
result_dialog->popup_centered_ratio(0.5);
}
}
+
+ exporting = false;
}
void ProjectExportDialog::_export_all_dialog() {
@@ -1108,19 +1112,29 @@ void ProjectExportDialog::_export_all(bool p_debug) {
String export_target = p_debug ? TTR("Debug") : TTR("Release");
EditorProgress ep("exportall", TTR("Exporting All") + " " + export_target, EditorExport::get_singleton()->get_export_preset_count(), true);
+ exporting = true;
+
bool show_dialog = false;
result_dialog_log->clear();
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
- ERR_FAIL_COND(preset.is_null());
+ if (preset.is_null()) {
+ exporting = false;
+ ERR_FAIL_MSG("Failed to start the export: one of the presets is invalid.");
+ }
+
Ref<EditorExportPlatform> platform = preset->get_platform();
- ERR_FAIL_COND(platform.is_null());
+ if (platform.is_null()) {
+ exporting = false;
+ ERR_FAIL_MSG("Failed to start the export: one of the presets has no valid platform.");
+ }
ep.step(preset->get_name(), i);
platform->clear_messages();
Error err = platform->export_project(preset, p_debug, preset->get_export_path(), 0);
if (err == ERR_SKIP) {
+ exporting = false;
return;
}
bool has_messages = platform->fill_log_messages(result_dialog_log, err);
@@ -1129,6 +1143,8 @@ void ProjectExportDialog::_export_all(bool p_debug) {
if (show_dialog) {
result_dialog->popup_centered_ratio(0.5);
}
+
+ exporting = false;
}
void ProjectExportDialog::_bind_methods() {
diff --git a/editor/export/project_export.h b/editor/export/project_export.h
index 219f45f59b..30f6812acb 100644
--- a/editor/export/project_export.h
+++ b/editor/export/project_export.h
@@ -70,7 +70,6 @@ public:
class ProjectExportDialog : public ConfirmationDialog {
GDCLASS(ProjectExportDialog, ConfirmationDialog);
-private:
TabContainer *sections = nullptr;
MenuButton *add_preset = nullptr;
@@ -118,6 +117,8 @@ private:
String default_filename;
+ bool exporting = false;
+
void _runnable_pressed();
void _update_parameters(const String &p_edited_property);
void _name_changed(const String &p_string);
@@ -199,6 +200,8 @@ public:
Ref<EditorExportPreset> get_current_preset() const;
+ bool is_exporting() const { return exporting; };
+
ProjectExportDialog();
~ProjectExportDialog();
};
diff --git a/editor/surface_upgrade_tool.cpp b/editor/surface_upgrade_tool.cpp
index 2294ff22e5..cd202ade6c 100644
--- a/editor/surface_upgrade_tool.cpp
+++ b/editor/surface_upgrade_tool.cpp
@@ -32,6 +32,7 @@
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/scene_string_names.h"
#include "servers/rendering_server.h"
@@ -75,30 +76,38 @@ void SurfaceUpgradeTool::_try_show_popup() {
void SurfaceUpgradeTool::_show_popup() {
MutexLock lock(mutex);
+ if (EditorNode::get_singleton()->is_project_exporting()) {
+ return; // We suppress the tool during the export routine, because the immediate dialog breaks everything.
+ }
if (!show_requested || popped_up) {
return;
}
show_requested = false;
popped_up = true;
- bool accepted = EditorNode::immediate_confirmation_dialog(TTR("This project uses meshes with an outdated mesh format from previous Godot versions. The engine needs to update the format in order to use those meshes.\n\nPress 'Restart & Upgrade' to run the surface upgrade tool which will update and re-save all meshes and scenes. This update will restart the editor and may take several minutes. Upgrading will make the meshes incompatible with previous versions of Godot.\n\nPress 'Upgrade Only' to continue opening the scene as normal. The engine will update each mesh in memory, but the update will not be saved. Choosing this option will lead to slower load times every time this project is loaded."), TTR("Restart & Upgrade"), TTR("Upgrade Only"), 500);
+ const String confirmation_message = TTR("This project uses meshes with an outdated mesh format from previous Godot versions. The engine needs to update the format in order to use those meshes.\n\nPress 'Restart & Upgrade' to run the surface upgrade tool which will update and re-save all meshes and scenes. This update will restart the editor and may take several minutes. Upgrading will make the meshes incompatible with previous versions of Godot.\n\nPress 'Upgrade Only' to continue opening the scene as normal. The engine will update each mesh in memory, but the update will not be saved. Choosing this option will lead to slower load times every time this project is loaded.");
+ bool accepted = EditorNode::immediate_confirmation_dialog(confirmation_message, TTR("Restart & Upgrade"), TTR("Upgrade Only"), 500);
if (accepted) {
- EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "run_on_restart", true);
-
- Vector<String> reimport_paths;
- Vector<String> resave_paths;
- _add_files(EditorFileSystem::get_singleton()->get_filesystem(), reimport_paths, resave_paths);
-
- EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "reimport_paths", reimport_paths);
- EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "resave_paths", resave_paths);
-
- // Delay to avoid deadlocks, since this dialog can be triggered by loading a scene.
- MessageQueue::get_singleton()->push_callable(callable_mp(EditorNode::get_singleton(), &EditorNode::restart_editor));
+ prepare_upgrade();
} else {
RS::get_singleton()->set_warn_on_surface_upgrade(true);
}
}
+void SurfaceUpgradeTool::prepare_upgrade() {
+ EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "run_on_restart", true);
+
+ Vector<String> reimport_paths;
+ Vector<String> resave_paths;
+ _add_files(EditorFileSystem::get_singleton()->get_filesystem(), reimport_paths, resave_paths);
+
+ EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "reimport_paths", reimport_paths);
+ EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "resave_paths", resave_paths);
+
+ // Delay to avoid deadlocks, since this dialog can be triggered by loading a scene.
+ MessageQueue::get_singleton()->push_callable(callable_mp(EditorNode::get_singleton(), &EditorNode::restart_editor));
+}
+
// Ensure that the warnings and popups are skipped.
void SurfaceUpgradeTool::begin_upgrade() {
EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "run_on_restart", false);
@@ -162,3 +171,19 @@ SurfaceUpgradeTool::SurfaceUpgradeTool() {
}
SurfaceUpgradeTool::~SurfaceUpgradeTool() {}
+
+void SurfaceUpgradeDialog::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_READY:
+ // Can't do it in the constructor because it doesn't know that the signal exists.
+ connect("confirmed", callable_mp(SurfaceUpgradeTool::get_singleton(), &SurfaceUpgradeTool::prepare_upgrade));
+ break;
+ }
+}
+
+SurfaceUpgradeDialog::SurfaceUpgradeDialog() {
+ const String confirmation_message = TTR("The mesh format has changed in Godot 4.2, which affects both imported meshes and meshes authored inside of Godot. The engine needs to update the format in order to use those meshes.\n\nIf your project predates Godot 4.2 and contains meshes we recommend you run this one time conversion tool. This update will restart the editor and may take several minutes. Upgrading will make the meshes incompatible with previous versions of Godot.\n\nYou can still use your existing meshes as is. The engine will update each mesh in memory, but the update will not be saved. Choosing this option will lead to slower load times every time this project is loaded.");
+ set_text(confirmation_message);
+ set_autowrap(true);
+ get_label()->set_custom_minimum_size(Size2(750 * EDSCALE, 0));
+}
diff --git a/editor/surface_upgrade_tool.h b/editor/surface_upgrade_tool.h
index 70e07c58a1..ae2b90decd 100644
--- a/editor/surface_upgrade_tool.h
+++ b/editor/surface_upgrade_tool.h
@@ -31,7 +31,7 @@
#ifndef SURFACE_UPGRADE_TOOL_H
#define SURFACE_UPGRADE_TOOL_H
-#include "scene/main/node.h"
+#include "scene/gui/dialogs.h"
class EditorFileSystemDirectory;
@@ -57,6 +57,7 @@ public:
bool is_show_requested() const { return show_requested; };
void show_popup() { _show_popup(); }
+ void prepare_upgrade();
void begin_upgrade();
void finish_upgrade();
@@ -64,4 +65,14 @@ public:
~SurfaceUpgradeTool();
};
+class SurfaceUpgradeDialog : public ConfirmationDialog {
+ GDCLASS(SurfaceUpgradeDialog, ConfirmationDialog);
+
+protected:
+ void _notification(int p_what);
+
+public:
+ SurfaceUpgradeDialog();
+};
+
#endif // SURFACE_UPGRADE_TOOL_H
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 94984a74b6..c0e052865f 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -2071,6 +2071,22 @@ bool EditorExportPlatformIOS::is_package_name_valid(const String &p_package, Str
}
#ifdef MACOS_ENABLED
+bool EditorExportPlatformIOS::_check_xcode_install() {
+ static bool xcode_found = false;
+ if (!xcode_found) {
+ String xcode_path;
+ List<String> args;
+ args.push_back("-p");
+ int ec = 0;
+ Error err = OS::get_singleton()->execute("xcode-select", args, &xcode_path, &ec, true);
+ if (err != OK || ec != 0) {
+ return false;
+ }
+ xcode_found = DirAccess::dir_exists_absolute(xcode_path.strip_edges());
+ }
+ return xcode_found;
+}
+
void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) {
EditorExportPlatformIOS *ea = static_cast<EditorExportPlatformIOS *>(ud);
@@ -2138,7 +2154,7 @@ void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) {
}
// Enum simulators
- if (FileAccess::exists("/usr/bin/xcrun") || FileAccess::exists("/bin/xcrun")) {
+ if (_check_xcode_install() && (FileAccess::exists("/usr/bin/xcrun") || FileAccess::exists("/bin/xcrun"))) {
String devices;
List<String> args;
args.push_back("simctl");
diff --git a/platform/ios/export/export_plugin.h b/platform/ios/export/export_plugin.h
index 27a4d73fcd..951017ddae 100644
--- a/platform/ios/export/export_plugin.h
+++ b/platform/ios/export/export_plugin.h
@@ -81,6 +81,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Thread check_for_changes_thread;
SafeFlag quit_request;
+ static bool _check_xcode_install();
static void _check_for_changes_poll_thread(void *ud);
#endif
diff --git a/platform/windows/gl_manager_windows_native.cpp b/platform/windows/gl_manager_windows_native.cpp
index b350786d11..a8c6efcea1 100644
--- a/platform/windows/gl_manager_windows_native.cpp
+++ b/platform/windows/gl_manager_windows_native.cpp
@@ -104,8 +104,8 @@ static bool nvapi_err_check(const char *msg, int status) {
}
// On windows we have to disable threaded optimization when using NVIDIA graphics cards
-// to avoid stuttering, see https://github.com/microsoft/vscode-cpptools/issues/6592
-// also see https://github.com/Ryujinx/Ryujinx/blob/master/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
+// to avoid stuttering, see see https://stackoverflow.com/questions/36959508/nvidia-graphics-driver-causing-noticeable-frame-stuttering/37632948
+// also see https://github.com/Ryujinx/Ryujinx/blob/master/src/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() {
HMODULE nvapi = 0;
#ifdef _WIN64
@@ -149,6 +149,10 @@ void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() {
NvDRSSessionHandle session_handle;
+ if (NvAPI_DRS_CreateSession == nullptr) {
+ return;
+ }
+
if (!nvapi_err_check("NVAPI: Error creating DRS session", NvAPI_DRS_CreateSession(&session_handle))) {
NvAPI_Unload();
return;
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 8dddbf78cf..69023d2056 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -2015,7 +2015,7 @@ GraphEdit::GraphEdit() {
top_layer->connect("focus_exited", callable_mp(panner.ptr(), &ViewPanner::release_pan_key));
connections_layer = memnew(Control);
- add_child(connections_layer, false);
+ add_child(connections_layer, false, INTERNAL_MODE_FRONT);
connections_layer->connect("draw", callable_mp(this, &GraphEdit::_connections_layer_draw));
connections_layer->set_name("_connection_layer");
connections_layer->set_disable_visibility_clip(true); // Necessary, so it can draw freely and be offset.
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 2456212327..1f6e453e88 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -138,7 +138,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
}
int nc = nodes.size();
- ERR_FAIL_COND_V(nc == 0, nullptr);
+ ERR_FAIL_COND_V_MSG(nc == 0, nullptr, vformat("Failed to instantiate scene state of \"%s\", node count is 0. Make sure the PackedScene resource is valid.", path));
const StringName *snames = nullptr;
int sname_count = names.size();
@@ -219,7 +219,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
Ref<PackedScene> sdata = props[n.instance & FLAG_MASK];
ERR_FAIL_COND_V(!sdata.is_valid(), nullptr);
node = sdata->instantiate(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE);
- ERR_FAIL_NULL_V(node, nullptr);
+ ERR_FAIL_NULL_V_MSG(node, nullptr, vformat("Failed to load scene dependency: \"%s\". Make sure the required scene is valid.", sdata->get_path()));
}
} else if (n.type == TYPE_INSTANTIATED) {
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
index 2397249ca5..9e10f9599e 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -2037,6 +2037,8 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
RenderListParameters render_list_params(render_list[RENDER_LIST_MOTION].elements.ptr(), render_list[RENDER_LIST_MOTION].element_info.ptr(), render_list[RENDER_LIST_MOTION].elements.size(), reverse_cull, PASS_MODE_COLOR, color_pass_flags, rb_data.is_null(), p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, p_render_data->scene_data->view_count);
_render_list_with_threads(&render_list_params, color_framebuffer, RD::INITIAL_ACTION_CONTINUE, final_color_action, RD::INITIAL_ACTION_CONTINUE, final_depth_action);
+ RD::get_singleton()->draw_command_end_label();
+
if (will_continue_color) {
// Close the motion vectors framebuffer as it'll no longer be used.
RD::get_singleton()->draw_list_begin(rb_data->get_velocity_only_fb(), RD::INITIAL_ACTION_CONTINUE, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, RD::FINAL_ACTION_CONTINUE);
@@ -2051,8 +2053,6 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
}
- RD::get_singleton()->draw_command_end_label();
-
if (debug_voxelgis) {
//debug voxelgis
bool will_continue_color = (can_continue_color || draw_sky || draw_sky_fog_only);
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
index a6b4646f43..3e19e8f01a 100644
--- a/servers/rendering/shader_types.cpp
+++ b/servers/rendering/shader_types.cpp
@@ -361,7 +361,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_PARTICLES].functions["start"].built_ins["RESTART_VELOCITY"] = constt(ShaderLanguage::TYPE_BOOL);
shader_modes[RS::SHADER_PARTICLES].functions["start"].built_ins["RESTART_COLOR"] = constt(ShaderLanguage::TYPE_BOOL);
shader_modes[RS::SHADER_PARTICLES].functions["start"].built_ins["RESTART_CUSTOM"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[RS::SHADER_PARTICLES].functions["start"].built_ins["AMOUNT_RATIO"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_PARTICLES].functions["start"].built_ins["AMOUNT_RATIO"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[RS::SHADER_PARTICLES].functions["start"].main_function = true;
shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
@@ -394,7 +394,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["COLLISION_NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["COLLISION_DEPTH"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["ATTRACTOR_FORCE"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["AMOUNT_RATIO"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["AMOUNT_RATIO"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[RS::SHADER_PARTICLES].functions["process"].main_function = true;
{
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 43615f0d7e..e84616a232 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -2148,45 +2148,47 @@ void RenderingServer::fix_surface_compatibility(SurfaceData &p_surface, const St
// The only difference for now is that Version 1 uses interleaved vertex positions while version 2 does not.
// I.e. PNTPNTPNT -> PPPNTNTNT.
- int vertex_size = 0;
- int normal_size = 0;
- int tangent_size = 0;
- if (p_surface.format & ARRAY_FORMAT_VERTEX) {
- if (p_surface.format & ARRAY_FLAG_USE_2D_VERTICES) {
- vertex_size = sizeof(float) * 2;
- } else {
- vertex_size = sizeof(float) * 3;
+ if (p_surface.vertex_data.size() > 0 && p_surface.vertex_count > 0) {
+ int vertex_size = 0;
+ int normal_size = 0;
+ int tangent_size = 0;
+ if (p_surface.format & ARRAY_FORMAT_VERTEX) {
+ if (p_surface.format & ARRAY_FLAG_USE_2D_VERTICES) {
+ vertex_size = sizeof(float) * 2;
+ } else {
+ vertex_size = sizeof(float) * 3;
+ }
}
- }
- if (p_surface.format & ARRAY_FORMAT_NORMAL) {
- normal_size += sizeof(uint16_t) * 2;
- }
- if (p_surface.format & ARRAY_FORMAT_TANGENT) {
- tangent_size = sizeof(uint16_t) * 2;
- }
- int stride = p_surface.vertex_data.size() / p_surface.vertex_count;
- int position_stride = vertex_size;
- int normal_tangent_stride = normal_size + tangent_size;
+ if (p_surface.format & ARRAY_FORMAT_NORMAL) {
+ normal_size += sizeof(uint16_t) * 2;
+ }
+ if (p_surface.format & ARRAY_FORMAT_TANGENT) {
+ tangent_size = sizeof(uint16_t) * 2;
+ }
+ int stride = p_surface.vertex_data.size() / p_surface.vertex_count;
+ int position_stride = vertex_size;
+ int normal_tangent_stride = normal_size + tangent_size;
- p_surface.vertex_data = _convert_surface_version_1_to_surface_version_2(p_surface.format, p_surface.vertex_data, p_surface.vertex_count, stride, vertex_size, normal_size, position_stride, normal_tangent_stride);
+ p_surface.vertex_data = _convert_surface_version_1_to_surface_version_2(p_surface.format, p_surface.vertex_data, p_surface.vertex_count, stride, vertex_size, normal_size, position_stride, normal_tangent_stride);
- if (p_surface.blend_shape_data.size() > 0) {
- // The size of one blend shape.
- int divisor = (vertex_size + normal_size + tangent_size) * p_surface.vertex_count;
- ERR_FAIL_COND((p_surface.blend_shape_data.size() % divisor) != 0);
+ if (p_surface.blend_shape_data.size() > 0) {
+ // The size of one blend shape.
+ int divisor = (vertex_size + normal_size + tangent_size) * p_surface.vertex_count;
+ ERR_FAIL_COND((p_surface.blend_shape_data.size() % divisor) != 0);
- uint32_t blend_shape_count = p_surface.blend_shape_data.size() / divisor;
+ uint32_t blend_shape_count = p_surface.blend_shape_data.size() / divisor;
- Vector<uint8_t> new_blend_shape_data;
- for (uint32_t i = 0; i < blend_shape_count; i++) {
- Vector<uint8_t> bs_data = p_surface.blend_shape_data.slice(i * divisor, (i + 1) * divisor);
- Vector<uint8_t> blend_shape = _convert_surface_version_1_to_surface_version_2(p_surface.format, bs_data, p_surface.vertex_count, stride, vertex_size, normal_size, position_stride, normal_tangent_stride);
- new_blend_shape_data.append_array(blend_shape);
- }
+ Vector<uint8_t> new_blend_shape_data;
+ for (uint32_t i = 0; i < blend_shape_count; i++) {
+ Vector<uint8_t> bs_data = p_surface.blend_shape_data.slice(i * divisor, (i + 1) * divisor);
+ Vector<uint8_t> blend_shape = _convert_surface_version_1_to_surface_version_2(p_surface.format, bs_data, p_surface.vertex_count, stride, vertex_size, normal_size, position_stride, normal_tangent_stride);
+ new_blend_shape_data.append_array(blend_shape);
+ }
- ERR_FAIL_COND(p_surface.blend_shape_data.size() != new_blend_shape_data.size());
+ ERR_FAIL_COND(p_surface.blend_shape_data.size() != new_blend_shape_data.size());
- p_surface.blend_shape_data = new_blend_shape_data;
+ p_surface.blend_shape_data = new_blend_shape_data;
+ }
}
}
p_surface.format &= ~(ARRAY_FLAG_FORMAT_VERSION_MASK << ARRAY_FLAG_FORMAT_VERSION_SHIFT);