diff options
-rw-r--r-- | editor/scene_tree_editor.cpp | 4 | ||||
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs | 73 | ||||
-rw-r--r-- | scene/main/node.cpp | 12 | ||||
-rw-r--r-- | scene/main/node.h | 2 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp | 15 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h | 2 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_render_rd.cpp | 8 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_render_rd.h | 1 | ||||
-rw-r--r-- | servers/rendering/shader_language.cpp | 49 | ||||
-rw-r--r-- | servers/rendering/shader_language.h | 5 | ||||
-rw-r--r-- | servers/rendering/shader_warnings.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/shader_warnings.h | 2 |
12 files changed, 96 insertions, 81 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index b2c66ee1e7..5958a09169 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -526,6 +526,10 @@ void SceneTreeEditor::_node_removed(Node *p_node) { } void SceneTreeEditor::_node_renamed(Node *p_node) { + if (!get_scene_node()->is_ancestor_of(p_node)) { + return; + } + emit_signal("node_renamed"); if (!tree_dirty) { diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index c71c44d79d..1faa6eeac0 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -26,8 +26,6 @@ namespace GodotTools private PopupMenu menuPopup; private AcceptDialog errorDialog; - private AcceptDialog aboutDialog; - private CheckBox aboutDialogCheckBox; private Button bottomPanelBtn; private Button toolBarBuildButton; @@ -130,13 +128,6 @@ namespace GodotTools toolBarBuildButton.Show(); } - private void _ShowAboutDialog() - { - bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start"); - aboutDialogCheckBox.Pressed = showOnStart; - aboutDialog.PopupCentered(); - } - private void _MenuOptionPressed(int id) { switch ((MenuOptions)id) @@ -144,9 +135,6 @@ namespace GodotTools case MenuOptions.CreateSln: CreateProjectSolution(); break; - case MenuOptions.AboutCSharp: - _ShowAboutDialog(); - break; case MenuOptions.SetupGodotNugetFallbackFolder: { try @@ -183,21 +171,11 @@ namespace GodotTools base._Ready(); MSBuildPanel.BuildOutputView.BuildStateChanged += BuildStateChanged; - - bool showInfoDialog = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start"); - if (showInfoDialog) - { - aboutDialog.Exclusive = true; - _ShowAboutDialog(); - // Once shown a first time, it can be seen again via the Mono menu - it doesn't have to be exclusive from that time on. - aboutDialog.Exclusive = false; - } } private enum MenuOptions { CreateSln, - AboutCSharp, SetupGodotNugetFallbackFolder, } @@ -439,57 +417,6 @@ namespace GodotTools AddToolSubmenuItem("C#", menuPopup); - // TODO: Remove or edit this info dialog once Mono support is no longer in alpha - { - menuPopup.AddItem("About C# support".TTR(), (int)MenuOptions.AboutCSharp); - menuPopup.AddItem("Setup Godot NuGet Offline Packages".TTR(), (int)MenuOptions.SetupGodotNugetFallbackFolder); - aboutDialog = new AcceptDialog(); - editorBaseControl.AddChild(aboutDialog); - aboutDialog.Title = "Important: C# support is not feature-complete"; - - // We don't use DialogText as the default AcceptDialog Label doesn't play well with the TextureRect and CheckBox - // we'll add. Instead we add containers and a new autowrapped Label inside. - - // Main VBoxContainer (icon + label on top, checkbox at bottom) - var aboutVBox = new VBoxContainer(); - aboutDialog.AddChild(aboutVBox); - - // HBoxContainer for icon + label - var aboutHBox = new HBoxContainer(); - aboutVBox.AddChild(aboutHBox); - - var aboutIcon = new TextureRect(); - aboutIcon.Texture = aboutIcon.GetThemeIcon("NodeWarning", "EditorIcons"); - aboutHBox.AddChild(aboutIcon); - - var aboutLabel = new Label(); - aboutHBox.AddChild(aboutLabel); - aboutLabel.RectMinSize = new Vector2(600, 150) * EditorScale; - aboutLabel.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill; - aboutLabel.Autowrap = true; - aboutLabel.Text = - "C# support in Godot Engine is in late alpha stage and, while already usable, " + - "it is not meant for use in production.\n\n" + - "Projects can be exported to Linux, macOS, Windows, Android, iOS and HTML5, but not yet to UWP. " + - "Bugs and usability issues will be addressed gradually over future releases, " + - "potentially including compatibility breaking changes as new features are implemented for a better overall C# experience.\n\n" + - "If you experience issues with this Mono build, please report them on Godot's issue tracker with details about your system, MSBuild version, IDE, etc.:\n\n" + - " https://github.com/godotengine/godot/issues\n\n" + - "Your critical feedback at this stage will play a great role in shaping the C# support in future releases, so thank you!"; - - EditorDef("mono/editor/show_info_on_start", true); - - // CheckBox in main container - aboutDialogCheckBox = new CheckBox {Text = "Show this warning when starting the editor"}; - aboutDialogCheckBox.Toggled += enabled => - { - bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start"); - if (showOnStart != enabled) - editorSettings.SetSetting("mono/editor/show_info_on_start", enabled); - }; - aboutVBox.AddChild(aboutDialogCheckBox); - } - toolBarBuildButton = new Button { Text = "Build", diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 787b283e8c..0935e64678 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1822,6 +1822,18 @@ Node *Node::get_deepest_editable_node(Node *p_start_node) const { return node; } +String Node::to_string() { + if (get_script_instance()) { + bool valid; + String ret = get_script_instance()->to_string(&valid); + if (valid) { + return ret; + } + } + + return (get_name() ? String(get_name()) + ":" : "") + Object::to_string(); +} + void Node::set_scene_instance_state(const Ref<SceneState> &p_state) { data.instance_state = p_state; } diff --git a/scene/main/node.h b/scene/main/node.h index c6727ce884..20315d7a86 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -329,6 +329,8 @@ public: bool is_editable_instance(const Node *p_node) const; Node *get_deepest_editable_node(Node *p_start_node) const; + virtual String to_string() override; + /* NOTIFICATIONS */ void propagate_notification(int p_notification); diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index 29cb597798..03419ec8f5 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -65,9 +65,13 @@ void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_b color = p_color_buffer; depth = p_depth_buffer; - // re-introduce setting up msaa? For now we ignore this... + RD::DataFormat color_format = RenderForwardMobile::singleton->_render_buffers_get_color_format(); if (p_msaa == RS::VIEWPORT_MSAA_DISABLED) { + if (color_format == RD::DATA_FORMAT_B10G11R11_UFLOAT_PACK32) { + // @TODO add a second color buffer for alpha as this format is RGB only + } + Vector<RID> fb; fb.push_back(p_color_buffer); fb.push_back(depth); @@ -80,7 +84,7 @@ void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_b } else { tf.texture_type = RD::TEXTURE_TYPE_2D; } - tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; + tf.format = color_format; tf.width = p_width; tf.height = p_height; tf.array_layers = view_count; // create a layer for every view @@ -131,6 +135,13 @@ bool RenderForwardMobile::free(RID p_rid) { /* Render functions */ +RD::DataFormat RenderForwardMobile::_render_buffers_get_color_format() { + // Using 32bit buffers enables AFBC on mobile devices which should have a definate performance improvement (MALI G710 and newer support this on 64bit RTs) + // NO ALPHA and unsigned float. + // @TODO No alpha is an issue, recommendation here is to add a second RT for alpha + return RD::DATA_FORMAT_B10G11R11_UFLOAT_PACK32; +} + RID RenderForwardMobile::_setup_render_pass_uniform_set(RenderListType p_render_list, const RenderDataRD *p_render_data, RID p_radiance_texture, bool p_use_directional_shadow_atlas, int p_index) { //there should always be enough uniform buffers for render passes, otherwise bugs ERR_FAIL_INDEX_V(p_index, (int)scene_state.uniform_buffers.size(), RID()); diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h index 53650a7a5e..bf3aa7ed5c 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h @@ -151,6 +151,8 @@ protected: } }; + virtual RD::DataFormat _render_buffers_get_color_format() override; + RID _setup_render_pass_uniform_set(RenderListType p_render_list, const RenderDataRD *p_render_data, RID p_radiance_texture, bool p_use_directional_shadow_atlas = false, int p_index = 0); virtual void _render_scene(RenderDataRD *p_render_data, const Color &p_default_bg_color) override; diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 3b7c14d4ff..9b32971e30 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -654,7 +654,7 @@ bool RendererSceneRenderRD::reflection_probe_instance_begin_render(RID p_instanc //reflection atlas was unused, create: RD::TextureFormat tf; tf.array_layers = 6 * atlas->count; - tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; + tf.format = _render_buffers_get_color_format(); tf.texture_type = RD::TEXTURE_TYPE_CUBE_ARRAY; tf.mipmaps = mipmaps; tf.width = atlas->size; @@ -2118,6 +2118,10 @@ float RendererSceneRenderRD::render_buffers_get_volumetric_fog_detail_spread(RID return rb->volumetric_fog->spread; } +RD::DataFormat RendererSceneRenderRD::_render_buffers_get_color_format() { + return RD::DATA_FORMAT_R16G16B16A16_SFLOAT; +} + void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) { ERR_FAIL_COND_MSG(p_view_count == 0, "Must have atleast 1 view"); @@ -2144,7 +2148,7 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p if (rb->view_count > 1) { tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; } - tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; + tf.format = _render_buffers_get_color_format(); tf.width = rb->width; tf.height = rb->height; tf.array_layers = rb->view_count; // create a layer for every view diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h index 69c56cf4a7..58d9a765d0 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h @@ -1130,6 +1130,7 @@ public: /* render buffers */ + virtual RD::DataFormat _render_buffers_get_color_format(); virtual RID render_buffers_create() override; virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override; virtual void gi_set_use_half_resolution(bool p_enable) override; diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 9b2ba36358..f771d6d0ef 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -918,6 +918,7 @@ void ShaderLanguage::clear() { used_uniforms.clear(); used_functions.clear(); used_structs.clear(); + used_local_vars.clear(); warnings.clear(); #endif // DEBUG_ENABLED @@ -936,7 +937,7 @@ void ShaderLanguage::clear() { } #ifdef DEBUG_ENABLED -void ShaderLanguage::_parse_used_identifier(const StringName &p_identifier, IdentifierType p_type) { +void ShaderLanguage::_parse_used_identifier(const StringName &p_identifier, IdentifierType p_type, const StringName &p_function) { switch (p_type) { case IdentifierType::IDENTIFIER_CONSTANT: if (HAS_WARNING(ShaderWarning::UNUSED_CONSTANT_FLAG) && used_constants.has(p_identifier)) { @@ -958,6 +959,11 @@ void ShaderLanguage::_parse_used_identifier(const StringName &p_identifier, Iden used_functions[p_identifier].used = true; } break; + case IdentifierType::IDENTIFIER_LOCAL_VAR: + if (HAS_WARNING(ShaderWarning::UNUSED_LOCAL_VARIABLE_FLAG) && used_local_vars.has(p_function) && used_local_vars[p_function].has(p_identifier)) { + used_local_vars[p_function][p_identifier].used = true; + } + break; default: break; } @@ -4171,7 +4177,13 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons expr = func; #ifdef DEBUG_ENABLED if (check_warnings) { - _parse_used_identifier(name, IdentifierType::IDENTIFIER_FUNCTION); + StringName func_name; + + if (p_block && p_block->parent_function) { + func_name = p_block->parent_function->name; + } + + _parse_used_identifier(name, IdentifierType::IDENTIFIER_FUNCTION, func_name); } #endif // DEBUG_ENABLED } @@ -4319,7 +4331,13 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } #ifdef DEBUG_ENABLED if (check_warnings) { - _parse_used_identifier(identifier, ident_type); + StringName func_name; + + if (p_block && p_block->parent_function) { + func_name = p_block->parent_function->name; + } + + _parse_used_identifier(identifier, ident_type, func_name); } #endif // DEBUG_ENABLED } @@ -5537,6 +5555,20 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun } } +#ifdef DEBUG_ENABLED + if (check_warnings && HAS_WARNING(ShaderWarning::UNUSED_LOCAL_VARIABLE_FLAG)) { + if (p_block && p_block->parent_function) { + StringName func_name = p_block->parent_function->name; + + if (!used_local_vars.has(func_name)) { + used_local_vars.insert(func_name, Map<StringName, Usage>()); + } + + used_local_vars[func_name].insert(name, Usage(tk_line)); + } + } +#endif // DEBUG_ENABLED + BlockNode::Variable var; var.type = type; var.precision = precision; @@ -7984,6 +8016,15 @@ String ShaderLanguage::get_shader_type(const String &p_code) { #ifdef DEBUG_ENABLED void ShaderLanguage::_check_warning_accums() { + for (Map<ShaderWarning::Code, Map<StringName, Map<StringName, Usage>> *>::Element *E = warnings_check_map2.front(); E; E = E->next()) { + for (Map<StringName, Map<StringName, Usage>>::Element *T = (*E->get()).front(); T; T = T->next()) { + for (const Map<StringName, Usage>::Element *U = T->get().front(); U; U = U->next()) { + if (!U->get().used) { + _add_warning(E->key(), U->get().decl_line, U->key()); + } + } + } + } for (Map<ShaderWarning::Code, Map<StringName, Usage> *>::Element *E = warnings_check_map.front(); E; E = E->next()) { for (const Map<StringName, Usage>::Element *U = (*E->get()).front(); U; U = U->next()) { if (!U->get().used) { @@ -8456,6 +8497,8 @@ ShaderLanguage::ShaderLanguage() { warnings_check_map.insert(ShaderWarning::UNUSED_STRUCT, &used_structs); warnings_check_map.insert(ShaderWarning::UNUSED_UNIFORM, &used_uniforms); warnings_check_map.insert(ShaderWarning::UNUSED_VARYING, &used_varyings); + + warnings_check_map2.insert(ShaderWarning::UNUSED_LOCAL_VARIABLE, &used_local_vars); #endif // DEBUG_ENABLED } diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index 4120e04ee1..a91fa57a8e 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -848,6 +848,9 @@ private: Map<StringName, Usage> used_structs; Map<ShaderWarning::Code, Map<StringName, Usage> *> warnings_check_map; + Map<StringName, Map<StringName, Usage>> used_local_vars; + Map<ShaderWarning::Code, Map<StringName, Map<StringName, Usage>> *> warnings_check_map2; + List<ShaderWarning> warnings; bool check_warnings = false; @@ -917,7 +920,7 @@ private: bool _find_identifier(const BlockNode *p_block, bool p_allow_reassign, const FunctionInfo &p_function_info, const StringName &p_identifier, DataType *r_data_type = nullptr, IdentifierType *r_type = nullptr, bool *r_is_const = nullptr, int *r_array_size = nullptr, StringName *r_struct_name = nullptr, ConstantNode::Value *r_constant_value = nullptr); #ifdef DEBUG_ENABLED - void _parse_used_identifier(const StringName &p_identifier, IdentifierType p_type); + void _parse_used_identifier(const StringName &p_identifier, IdentifierType p_type, const StringName &p_function); #endif // DEBUG_ENABLED bool _is_operator_assign(Operator p_op) const; bool _validate_assign(Node *p_node, const FunctionInfo &p_function_info, String *r_message = nullptr); diff --git a/servers/rendering/shader_warnings.cpp b/servers/rendering/shader_warnings.cpp index aa11b4e397..0c1d6408c9 100644 --- a/servers/rendering/shader_warnings.cpp +++ b/servers/rendering/shader_warnings.cpp @@ -59,6 +59,8 @@ String ShaderWarning::get_message() const { return vformat("The uniform '%s' is declared but never used.", subject); case UNUSED_VARYING: return vformat("The varying '%s' is declared but never used.", subject); + case UNUSED_LOCAL_VARIABLE: + return vformat("The local variable '%s' is declared but never used.", subject); default: break; } @@ -79,6 +81,7 @@ String ShaderWarning::get_name_from_code(Code p_code) { "UNUSED_STRUCT", "UNUSED_UNIFORM", "UNUSED_VARYING", + "UNUSED_LOCAL_VARIABLE", }; static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names."); @@ -106,6 +109,7 @@ static void init_code_to_flags_map() { code_to_flags_map->insert(ShaderWarning::UNUSED_STRUCT, ShaderWarning::UNUSED_STRUCT_FLAG); code_to_flags_map->insert(ShaderWarning::UNUSED_UNIFORM, ShaderWarning::UNUSED_UNIFORM_FLAG); code_to_flags_map->insert(ShaderWarning::UNUSED_VARYING, ShaderWarning::UNUSED_VARYING_FLAG); + code_to_flags_map->insert(ShaderWarning::UNUSED_LOCAL_VARIABLE, ShaderWarning::UNUSED_LOCAL_VARIABLE_FLAG); } ShaderWarning::CodeFlags ShaderWarning::get_flags_from_codemap(const Map<Code, bool> &p_map) { diff --git a/servers/rendering/shader_warnings.h b/servers/rendering/shader_warnings.h index c40aeefa2d..db872d8fb1 100644 --- a/servers/rendering/shader_warnings.h +++ b/servers/rendering/shader_warnings.h @@ -46,6 +46,7 @@ public: UNUSED_STRUCT, UNUSED_UNIFORM, UNUSED_VARYING, + UNUSED_LOCAL_VARIABLE, WARNING_MAX, }; @@ -57,6 +58,7 @@ public: UNUSED_STRUCT_FLAG = 8U, UNUSED_UNIFORM_FLAG = 16U, UNUSED_VARYING_FLAG = 32U, + UNUSED_LOCAL_VARIABLE_FLAG = 64U, }; private: |