diff options
28 files changed, 165 insertions, 40 deletions
diff --git a/core/math/color.cpp b/core/math/color.cpp index d36306d968..1638acd74d 100644 --- a/core/math/color.cpp +++ b/core/math/color.cpp @@ -33,7 +33,7 @@ #include "color_names.inc" #include "core/math/math_funcs.h" #include "core/string/ustring.h" -#include "core/templates/rb_map.h" +#include "core/templates/hash_map.h" #include "thirdparty/misc/ok_color.h" @@ -414,7 +414,7 @@ Color Color::named(const String &p_name, const Color &p_default) { int Color::find_named_color(const String &p_name) { String name = p_name; - // Normalize name + // Normalize name. name = name.replace(" ", ""); name = name.replace("-", ""); name = name.replace("_", ""); @@ -422,23 +422,24 @@ int Color::find_named_color(const String &p_name) { name = name.replace(".", ""); name = name.to_upper(); - int idx = 0; - while (named_colors[idx].name != nullptr) { - if (name == String(named_colors[idx].name).replace("_", "")) { - return idx; + static HashMap<String, int> named_colors_hashmap; + if (unlikely(named_colors_hashmap.is_empty())) { + const int named_color_count = get_named_color_count(); + for (int i = 0; i < named_color_count; i++) { + named_colors_hashmap[String(named_colors[i].name).replace("_", "")] = i; } - idx++; + } + + const HashMap<String, int>::ConstIterator E = named_colors_hashmap.find(name); + if (E) { + return E->value; } return -1; } int Color::get_named_color_count() { - int idx = 0; - while (named_colors[idx].name != nullptr) { - idx++; - } - return idx; + return sizeof(named_colors) / sizeof(NamedColor); } String Color::get_named_color_name(int p_idx) { diff --git a/core/math/color_names.inc b/core/math/color_names.inc index eaa1b1087f..6c0d2a4bfd 100644 --- a/core/math/color_names.inc +++ b/core/math/color_names.inc @@ -189,5 +189,4 @@ static NamedColor named_colors[] = { { "WHITE_SMOKE", Color::hex(0xF5F5F5FF) }, { "YELLOW", Color::hex(0xFFFF00FF) }, { "YELLOW_GREEN", Color::hex(0x9ACD32FF) }, - { nullptr, Color() }, }; diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 688e1b70ca..e157cbb96c 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -930,6 +930,12 @@ Returns [code]true[/code] if touch events are available (Android or iOS), the capability is detected on the Web platform or if [member ProjectSettings.input_devices/pointing/emulate_touch_from_mouse] is [code]true[/code]. </description> </method> + <method name="is_window_transparency_available" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the window background can be made transparent. This method returns [code]false[/code] if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code], or if transparency is not supported by the renderer or OS compositor. + </description> + </method> <method name="keyboard_get_current_layout" qualifiers="const"> <return type="int" /> <description> @@ -2045,7 +2051,7 @@ </constant> <constant name="WINDOW_FLAG_TRANSPARENT" value="3" enum="WindowFlags"> The window background can be transparent. - [b]Note:[/b] This flag has no effect if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code]. + [b]Note:[/b] This flag has no effect if [method is_window_transparency_available] returns [code]false[/code]. [b]Note:[/b] Transparency support is implemented on Linux (X11/Wayland), macOS, and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities. </constant> <constant name="WINDOW_FLAG_NO_FOCUS" value="4" enum="WindowFlags"> diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml index efa881591c..e5e6905cd2 100644 --- a/doc/classes/EditorInspectorPlugin.xml +++ b/doc/classes/EditorInspectorPlugin.xml @@ -80,6 +80,7 @@ <param index="2" name="add_to_end" type="bool" default="false" /> <description> Adds a property editor for an individual property. The [param editor] control must extend [EditorProperty]. + There can be multiple property editors for a property. If [param add_to_end] is [code]true[/code], this newly added editor will be displayed after all the other editors of the property whose [param add_to_end] is [code]false[/code]. For example, the editor uses this parameter to add an "Edit Region" button for [member Sprite2D.region_rect] below the regular [Rect2] editor. </description> </method> <method name="add_property_editor_for_multiple_properties"> diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index 9407826ebf..b042d41524 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -2199,9 +2199,21 @@ Error RenderingDeviceDriverD3D12::swap_chain_resize(CommandQueueID p_cmd_queue, swap_chain_desc.SampleDesc.Count = 1; swap_chain_desc.Flags = creation_flags; swap_chain_desc.Scaling = DXGI_SCALING_NONE; + if (OS::get_singleton()->is_layered_allowed()) { + swap_chain_desc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED; + has_comp_alpha[(uint64_t)p_cmd_queue.id] = true; + } else { + swap_chain_desc.AlphaMode = DXGI_ALPHA_MODE_IGNORE; + has_comp_alpha[(uint64_t)p_cmd_queue.id] = false; + } ComPtr<IDXGISwapChain1> swap_chain_1; res = context_driver->dxgi_factory_get()->CreateSwapChainForHwnd(command_queue->d3d_queue.Get(), surface->hwnd, &swap_chain_desc, nullptr, nullptr, swap_chain_1.GetAddressOf()); + if (!SUCCEEDED(res) && swap_chain_desc.AlphaMode != DXGI_ALPHA_MODE_IGNORE) { + swap_chain_desc.AlphaMode = DXGI_ALPHA_MODE_IGNORE; + has_comp_alpha[(uint64_t)p_cmd_queue.id] = false; + res = context_driver->dxgi_factory_get()->CreateSwapChainForHwnd(command_queue->d3d_queue.Get(), surface->hwnd, &swap_chain_desc, nullptr, nullptr, swap_chain_1.GetAddressOf()); + } ERR_FAIL_COND_V(!SUCCEEDED(res), ERR_CANT_CREATE); swap_chain_1.As(&swap_chain->d3d_swap_chain); @@ -5980,6 +5992,13 @@ const RDD::Capabilities &RenderingDeviceDriverD3D12::get_capabilities() const { return device_capabilities; } +bool RenderingDeviceDriverD3D12::is_composite_alpha_supported(CommandQueueID p_queue) const { + if (has_comp_alpha.has((uint64_t)p_queue.id)) { + return has_comp_alpha[(uint64_t)p_queue.id]; + } + return false; +} + /******************/ RenderingDeviceDriverD3D12::RenderingDeviceDriverD3D12(RenderingContextDriverD3D12 *p_context_driver) { diff --git a/drivers/d3d12/rendering_device_driver_d3d12.h b/drivers/d3d12/rendering_device_driver_d3d12.h index 8e1223bdaa..3a9677485e 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.h +++ b/drivers/d3d12/rendering_device_driver_d3d12.h @@ -973,6 +973,7 @@ private: uint32_t frames_drawn = 0; uint32_t segment_serial = 0; bool segment_begun = false; + HashMap<uint64_t, bool> has_comp_alpha; public: virtual void begin_segment(uint32_t p_frame_index, uint32_t p_frames_drawn) override final; @@ -994,6 +995,8 @@ public: virtual String get_pipeline_cache_uuid() const override final; virtual const Capabilities &get_capabilities() const override final; + virtual bool is_composite_alpha_supported(CommandQueueID p_queue) const override final; + static bool is_in_developer_mode(); private: diff --git a/drivers/vulkan/rendering_device_driver_vulkan.cpp b/drivers/vulkan/rendering_device_driver_vulkan.cpp index 896fc6ff91..b03a8418ed 100644 --- a/drivers/vulkan/rendering_device_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_device_driver_vulkan.cpp @@ -2646,6 +2646,7 @@ Error RenderingDeviceDriverVulkan::swap_chain_resize(CommandQueueID p_cmd_queue, break; } } + has_comp_alpha[(uint64_t)p_cmd_queue.id] = (composite_alpha != VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR); } VkSwapchainCreateInfoKHR swap_create_info = {}; @@ -4945,6 +4946,13 @@ const RDD::Capabilities &RenderingDeviceDriverVulkan::get_capabilities() const { return device_capabilities; } +bool RenderingDeviceDriverVulkan::is_composite_alpha_supported(CommandQueueID p_queue) const { + if (has_comp_alpha.has((uint64_t)p_queue.id)) { + return has_comp_alpha[(uint64_t)p_queue.id]; + } + return false; +} + /******************/ RenderingDeviceDriverVulkan::RenderingDeviceDriverVulkan(RenderingContextDriverVulkan *p_context_driver) { diff --git a/drivers/vulkan/rendering_device_driver_vulkan.h b/drivers/vulkan/rendering_device_driver_vulkan.h index e70019962a..b9e7563069 100644 --- a/drivers/vulkan/rendering_device_driver_vulkan.h +++ b/drivers/vulkan/rendering_device_driver_vulkan.h @@ -494,6 +494,7 @@ private: static int caching_instance_count; PipelineCache pipelines_cache; String pipeline_cache_id; + HashMap<uint64_t, bool> has_comp_alpha; public: virtual void pipeline_free(PipelineID p_pipeline) override final; @@ -627,6 +628,8 @@ public: virtual String get_pipeline_cache_uuid() const override final; virtual const Capabilities &get_capabilities() const override final; + virtual bool is_composite_alpha_supported(CommandQueueID p_queue) const override final; + private: /*********************/ /**** BOOKKEEPING ****/ diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 7c5e3877f2..a9f32927a8 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3782,7 +3782,6 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo } emit_signal(_prop_edited, p_name); - } else if (Object::cast_to<MultiNodeEdit>(object)) { Object::cast_to<MultiNodeEdit>(object)->set_property_field(p_name, p_value, p_changed_field); _edit_request_change(object, p_name); @@ -3959,7 +3958,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) { //property checked if (autoclear) { if (!p_checked) { - object->set(p_path, Variant()); + _edit_set(p_path, Variant(), false, ""); } else { Variant to_create; List<PropertyInfo> pinfo; @@ -3971,7 +3970,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) { break; } } - object->set(p_path, to_create); + _edit_set(p_path, to_create, false, ""); } if (editor_property_map.has(p_path)) { @@ -3982,7 +3981,6 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) { E->update_cache(); } } - } else { emit_signal(SNAME("property_toggled"), p_path, p_checked); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 3cbee5c502..e52903101d 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -344,7 +344,7 @@ class EditorInspectorArray : public EditorInspectorSection { MODE_NONE, MODE_USE_COUNT_PROPERTY, MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION, - } mode; + } mode = MODE_NONE; StringName count_property; StringName array_element_prefix; String swap_method; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 6615133dea..2a6fe808dd 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -273,6 +273,10 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) { } void EditorLog::_rebuild_log() { + if (messages.is_empty()) { + return; + } + log->clear(); int line_count = 0; diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 49b30bd06e..fe50961b54 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2645,7 +2645,7 @@ void EditorPropertyColor::_color_changed(const Color &p_color) { } void EditorPropertyColor::_popup_closed() { - get_edited_object()->set(get_edited_property(), last_color); + get_edited_object()->set(get_edited_property(), was_checked ? Variant(last_color) : Variant()); if (!picker->get_pick_color().is_equal_approx(last_color)) { emit_changed(get_edited_property(), picker->get_pick_color(), "", false); } @@ -2653,6 +2653,7 @@ void EditorPropertyColor::_popup_closed() { void EditorPropertyColor::_picker_opening() { last_color = picker->get_pick_color(); + was_checked = !is_checkable() || is_checked(); } void EditorPropertyColor::_notification(int p_what) { diff --git a/editor/editor_properties.h b/editor/editor_properties.h index d16c80bfc4..f2c5497e4f 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -625,6 +625,7 @@ class EditorPropertyColor : public EditorProperty { Color last_color; bool live_changes_enabled = true; + bool was_checked = false; protected: virtual void _set_read_only(bool p_read_only) override; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index e9e5b2294f..d211bd8588 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2901,10 +2901,8 @@ void Node3DEditorViewport::_notification(int p_what) { // FPS Counter. bool show_fps = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_FRAME_TIME)); - if (show_fps != fps_label->is_visible()) { - cpu_time_label->set_visible(show_fps); - gpu_time_label->set_visible(show_fps); - fps_label->set_visible(show_fps); + if (show_fps != frame_time_panel->is_visible()) { + frame_time_panel->set_visible(show_fps); RS::get_singleton()->viewport_set_measure_render_time(viewport->get_viewport_rid(), show_fps); for (int i = 0; i < FRAME_TIME_HISTORY; i++) { // Initialize to 120 FPS, so that the initial estimation until we get enough data is always reasonable. @@ -3033,9 +3031,15 @@ void Node3DEditorViewport::_notification(int p_what) { frame_time_gradient->set_color(2, get_theme_color(SNAME("error_color"), EditorStringName(Editor))); info_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); - cpu_time_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); - gpu_time_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); - fps_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + + frame_time_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + // Set a minimum width to prevent the width from changing all the time + // when numbers vary rapidly. This minimum width is set based on a + // GPU time of 999.99 ms in the current editor language. + const float min_width = get_theme_font(SNAME("main"), EditorStringName(EditorFonts))->get_string_size(vformat(TTR("GPU Time: %s ms"), 999.99)).x; + frame_time_panel->set_custom_minimum_size(Size2(min_width, 0) * EDSCALE); + frame_time_vbox->add_theme_constant_override("separation", Math::round(-1 * EDSCALE)); + cinema_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); locked_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); } break; @@ -5379,10 +5383,6 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p top_right_vbox = memnew(VBoxContainer); top_right_vbox->set_anchors_and_offsets_preset(PRESET_TOP_RIGHT, PRESET_MODE_MINSIZE, 10.0 * EDSCALE); top_right_vbox->set_h_grow_direction(GROW_DIRECTION_BEGIN); - // Make sure frame time labels don't touch the viewport's edge. - top_right_vbox->set_custom_minimum_size(Size2(100, 0) * EDSCALE); - // Prevent visible spacing between frame time labels. - top_right_vbox->add_theme_constant_override("separation", 0); const int navigation_control_size = 150; @@ -5414,18 +5414,22 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p rotation_control->set_viewport(this); top_right_vbox->add_child(rotation_control); + frame_time_panel = memnew(PanelContainer); + top_right_vbox->add_child(frame_time_panel); + frame_time_panel->hide(); + + frame_time_vbox = memnew(VBoxContainer); + frame_time_panel->add_child(frame_time_vbox); + // Individual Labels are used to allow coloring each label with its own color. cpu_time_label = memnew(Label); - top_right_vbox->add_child(cpu_time_label); - cpu_time_label->hide(); + frame_time_vbox->add_child(cpu_time_label); gpu_time_label = memnew(Label); - top_right_vbox->add_child(gpu_time_label); - gpu_time_label->hide(); + frame_time_vbox->add_child(gpu_time_label); fps_label = memnew(Label); - top_right_vbox->add_child(fps_label); - fps_label->hide(); + frame_time_vbox->add_child(fps_label); surface->add_child(top_right_vbox); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 4990b11a47..ebdf951773 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -255,6 +255,8 @@ private: ViewportNavigationControl *look_control = nullptr; ViewportRotationControl *rotation_control = nullptr; Gradient *frame_time_gradient = nullptr; + PanelContainer *frame_time_panel = nullptr; + VBoxContainer *frame_time_vbox = nullptr; Label *cpu_time_label = nullptr; Label *gpu_time_label = nullptr; Label *fps_label = nullptr; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index ec0380f964..f90fa7603f 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -3104,7 +3104,23 @@ void SceneTreeDock::set_edited_scene(Node *p_scene) { edited_scene = p_scene; } +static bool _is_same_selection(const Vector<Node *> &p_first, const List<Node *> &p_second) { + if (p_first.size() != p_second.size()) { + return false; + } + for (Node *node : p_second) { + if (!p_first.has(node)) { + return false; + } + } + return true; +} + void SceneTreeDock::set_selection(const Vector<Node *> &p_nodes) { + // If the nodes selected are the same independently of order then return early. + if (_is_same_selection(p_nodes, editor_selection->get_full_selected_node_list())) { + return; + } editor_selection->clear(); for (Node *node : p_nodes) { editor_selection->add_node(node); diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index fb22cf5983..2491064a58 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -5192,6 +5192,22 @@ void DisplayServerX11::set_context(Context p_context) { } } +bool DisplayServerX11::is_window_transparency_available() const { + CharString net_wm_cm_name = vformat("_NET_WM_CM_S%d", XDefaultScreen(x11_display)).ascii(); + Atom net_wm_cm = XInternAtom(x11_display, net_wm_cm_name.get_data(), False); + if (net_wm_cm == None) { + return false; + } + if (XGetSelectionOwner(x11_display, net_wm_cm) == None) { + return false; + } + + if (rendering_device && !rendering_device->is_composite_alpha_supported()) { + return false; + } + return OS::get_singleton()->is_layered_allowed(); +} + void DisplayServerX11::set_native_icon(const String &p_filename) { WARN_PRINT("Native icon not supported by this display server."); } diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h index 0861789b4a..7c69df3df0 100644 --- a/platform/linuxbsd/x11/display_server_x11.h +++ b/platform/linuxbsd/x11/display_server_x11.h @@ -530,6 +530,8 @@ public: virtual void set_context(Context p_context) override; + virtual bool is_window_transparency_available() const override; + virtual void set_native_icon(const String &p_filename) override; virtual void set_icon(const Ref<Image> &p_icon) override; diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h index 3068ed071b..608c34edc6 100644 --- a/platform/macos/display_server_macos.h +++ b/platform/macos/display_server_macos.h @@ -439,6 +439,8 @@ public: virtual Rect2 status_indicator_get_rect(IndicatorID p_id) const override; virtual void delete_status_indicator(IndicatorID p_id) override; + virtual bool is_window_transparency_available() const override; + static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error); static Vector<String> get_rendering_drivers_func(); diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 747de17439..0b11bf8287 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -3314,6 +3314,13 @@ void DisplayServerMacOS::delete_status_indicator(IndicatorID p_id) { indicators.erase(p_id); } +bool DisplayServerMacOS::is_window_transparency_available() const { + if (rendering_device && !rendering_device->is_composite_alpha_supported()) { + return false; + } + return OS::get_singleton()->is_layered_allowed(); +} + DisplayServer *DisplayServerMacOS::create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error) { DisplayServer *ds = memnew(DisplayServerMacOS(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, p_screen, p_context, r_error)); if (r_error != OK) { diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 6ee35d4fbd..b84e1f8eea 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -3401,6 +3401,19 @@ DisplayServer::VSyncMode DisplayServerWindows::window_get_vsync_mode(WindowID p_ void DisplayServerWindows::set_context(Context p_context) { } +bool DisplayServerWindows::is_window_transparency_available() const { + BOOL dwm_enabled = true; + if (DwmIsCompositionEnabled(&dwm_enabled) == S_OK) { // Note: Always enabled on Windows 8+, this check can be removed after Windows 7 support is dropped. + if (!dwm_enabled) { + return false; + } + } + if (rendering_device && !rendering_device->is_composite_alpha_supported()) { + return false; + } + return OS::get_singleton()->is_layered_allowed(); +} + #define MI_WP_SIGNATURE 0xFF515700 #define SIGNATURE_MASK 0xFFFFFF00 // Keeping the name suggested by Microsoft, but this macro really answers: diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index ef9c470157..9a4eeba486 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -697,6 +697,8 @@ public: virtual void set_context(Context p_context) override; + virtual bool is_window_transparency_available() const override; + static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error); static Vector<String> get_rendering_drivers_func(); static void register_windows_driver(); diff --git a/servers/display_server.cpp b/servers/display_server.cpp index 17f1548017..2150a3038e 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -996,6 +996,8 @@ void DisplayServer::_bind_methods() { ClassDB::bind_method(D_METHOD("tablet_get_current_driver"), &DisplayServer::tablet_get_current_driver); ClassDB::bind_method(D_METHOD("tablet_set_current_driver", "name"), &DisplayServer::tablet_set_current_driver); + ClassDB::bind_method(D_METHOD("is_window_transparency_available"), &DisplayServer::is_window_transparency_available); + #ifndef DISABLE_DEPRECATED BIND_ENUM_CONSTANT(FEATURE_GLOBAL_MENU); #endif diff --git a/servers/display_server.h b/servers/display_server.h index 9a9bb28a06..5224d59c04 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -580,6 +580,8 @@ public: virtual void set_context(Context p_context); + virtual bool is_window_transparency_available() const { return false; } + static void register_create_function(const char *p_name, CreateFunction p_function, GetRenderingDriversFunction p_get_drivers); static int get_create_function_count(); static const char *get_create_function_name(int p_index); diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 96c0479ac3..b02d3def88 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -958,6 +958,8 @@ void RendererSceneCull::instance_set_blend_shape_weight(RID p_instance, int p_sh if (instance->mesh_instance.is_valid()) { RSG::mesh_storage->mesh_instance_set_blend_shape_weight(instance->mesh_instance, p_shape, p_weight); } + + _instance_queue_update(instance, false, false); } void RendererSceneCull::instance_set_surface_override_material(RID p_instance, int p_surface, RID p_material) { diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index 15e1731823..0227472d0e 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -3332,12 +3332,15 @@ Error RenderingDevice::_draw_list_setup_framebuffer(Framebuffer *p_framebuffer, } Error RenderingDevice::_draw_list_render_pass_begin(Framebuffer *p_framebuffer, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, const Vector<Color> &p_clear_colors, float p_clear_depth, uint32_t p_clear_stencil, Point2i p_viewport_offset, Point2i p_viewport_size, RDD::FramebufferID p_framebuffer_driver_id, RDD::RenderPassID p_render_pass) { - LocalVector<RDD::RenderPassClearValue> clear_values; - LocalVector<RDG::ResourceTracker *> resource_trackers; - LocalVector<RDG::ResourceUsage> resource_usages; + thread_local LocalVector<RDD::RenderPassClearValue> clear_values; + thread_local LocalVector<RDG::ResourceTracker *> resource_trackers; + thread_local LocalVector<RDG::ResourceUsage> resource_usages; bool uses_color = false; bool uses_depth = false; + clear_values.clear(); clear_values.resize(p_framebuffer->texture_ids.size()); + resource_trackers.clear(); + resource_usages.clear(); int clear_values_count = 0; { int color_index = 0; @@ -4734,6 +4737,10 @@ String RenderingDevice::get_device_api_name() const { return driver->get_api_name(); } +bool RenderingDevice::is_composite_alpha_supported() const { + return driver->is_composite_alpha_supported(main_queue); +} + String RenderingDevice::get_device_api_version() const { return driver->get_api_version(); } diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h index 42773fc347..d0fa4ab1fa 100644 --- a/servers/rendering/rendering_device.h +++ b/servers/rendering/rendering_device.h @@ -1360,6 +1360,8 @@ public: String get_device_api_version() const; String get_device_pipeline_cache_uuid() const; + bool is_composite_alpha_supported() const; + uint64_t get_driver_resource(DriverResource p_resource, RID p_rid = RID(), uint64_t p_index = 0); static RenderingDevice *get_singleton(); diff --git a/servers/rendering/rendering_device_driver.h b/servers/rendering/rendering_device_driver.h index e9464ba321..f9a861426a 100644 --- a/servers/rendering/rendering_device_driver.h +++ b/servers/rendering/rendering_device_driver.h @@ -769,6 +769,8 @@ public: virtual String get_pipeline_cache_uuid() const = 0; virtual const Capabilities &get_capabilities() const = 0; + virtual bool is_composite_alpha_supported(CommandQueueID p_queue) const { return false; } + /******************/ virtual ~RenderingDeviceDriver(); |