Commit graph

10691 commits

Author SHA1 Message Date
Thaddeus Crews
7c015a768f
Merge pull request #99958 from lander-vr/reflection-probe-blend-property
Add Blend Distance property to ReflectionProbe
2024-12-12 16:13:32 -06:00
Thaddeus Crews
31bc6afcad
Merge pull request #96802 from dsnopek/expose-resource-importer-get-format-version
Expose `ResourceImporter::get_format_version` via `EditorImportPlugin::_get_format_version()`
2024-12-12 16:13:26 -06:00
Thaddeus Crews
c5f0d571b5
Merge pull request #97985 from RobProductions/add-tablet-nav-preset
Add `Tablet/Trackpad` 3D navigation preset
2024-12-12 16:13:24 -06:00
HP van Braam
6f7525c396 Improve Scene Tree editor performance
We now cache the Node*<>TreeItem* mapping in the SceneTreeEditor. This
allows us to make targeted updates to the Tree used to display the scene
tree in the editor.

Previously on almost all changes to the scene tree the editor would
rebuild the entire widget, causing a large number of deallocations an
allocations. We now carefully manipulate the Tree widget in-situ saving
a large number of these allocations.

In order to know what Nodes need to be updated we add a
editor_state_changed signal to Node, this is a TOOLS_ENABLED,
editor-only signal fired when changes to Node happen that are relevant
to editor state.

We also now make sure that when nodes are moved/renamed we don't check
expensive properties that cannot contain NodePaths. This saves a lot of
time when SceneTreeDock renames a node in a scene with a lot of
MeshInstances. This makes renaming nodes go from ~27 seconds to ~2
seconds on large scenes.

SceneTreeEditor instances will now also not do all of the potentially
expensive update work if they are invisible. This behavior is turned off
by default so it won't affect existing users. This change allows the
editor to only update SceneTreeEditors that actually in view. In
practice this means that for most changes instead of updating 6
SceneTreeEditors we only update 1 instantly, and the others only when
they become visible.

There is definitely more that could be done, but this is already a
massive improvement. In complex scenes we see an improvement of 10x,
things that used to take ~30 seconds now only take 2.

This fixes #83460

I want to thank KoBeWi, TokisanGames, a-johnston, aniel080400 for
their tireless testing. And AeioMuch for their testing and providing a
fix for the hover issue.
2024-12-12 22:47:05 +01:00
Robin Ward
b3e970dde8 Adds get_selection_line_offset to RichTextLabel
This new method allow you to get the line offset of the current
selection (returns -1 if nothing is selected.)

This is useful if you want to pop up a control or menu above the
currently selected text. Previously there was no accurate way to get
this information.

The logic is moved from the implementation of `scroll_to_selection`
verbatim, and that method has been adjusted to avoid repetition.
2024-12-12 16:02:21 -05:00
havi05
b29e93bb51 ItemList - Add Toggle mode 2024-12-12 17:33:04 +01:00
Robert Yevdokimov
7f09804154 Add inherit parameter to open_scene_from_path 2024-12-12 10:24:58 -05:00
David Snopek
af47df1005 Expose ResourceImporter::get_format_version via EditorImportPlugin::_get_format_version() 2024-12-12 08:15:28 -06:00
Rémi Verschelde
4cf1b0d94c
Merge pull request #100135 from Lazy-Rabbit-2001/expose-create-dialog-new
Add `popup_create_dialog()` for `EditorInterface` to create custom create dialog
2024-12-12 14:10:13 +01:00
Rémi Verschelde
d1b683d413
Merge pull request #97140 from BastiaanOlij/xr_action_map_enhancements
OpenXR: Add support for binding modifiers
2024-12-12 14:09:41 +01:00
Rémi Verschelde
0e5c337453
Merge pull request #85653 from BlueCube3310/lightmap-gi-shadowmask
Implement LightmapGI shadowmasks
2024-12-12 14:09:30 +01:00
Lazy-Rabbit-2001
9c34ad1791 Add popup_create_dialog() for EditorInterface to create custom create dialog 2024-12-12 18:13:31 +08:00
BlueCube3310
189c8eb671 Implement shadowmasks for LightmapGI
Co-authored-by: dearthdev <nathandearthdev@gmail.com>
2024-12-12 11:00:28 +01:00
Thaddeus Crews
dee79d55fe
Merge pull request #100204 from KoBeWi/nananananan
Clarify `limit_length()` for infinite vectors
2024-12-11 17:36:03 -06:00
Thaddeus Crews
e9d343805e
Merge pull request #94636 from Calinou/doc-process-delta-low-fps
Document `_process()` and `_physics_process()` delta behavior at low FPS
2024-12-11 17:35:42 -06:00
Thaddeus Crews
153ef23483
Merge pull request #100129 from smix8/pathunspaghettification
Despaghettify NavigationServer path queries
2024-12-11 17:35:38 -06:00
Thaddeus Crews
db2088b0cd
Merge pull request #100126 from dsnopek/gdextension-missing-gdvirtual-bind
Add missing `GDVIRTUAL_BIND()` for `AudioStream::_has_loop()` and `::_get_bar_beats()`
2024-12-11 17:35:33 -06:00
Thaddeus Crews
4146bcc0dc
Merge pull request #99089 from Mickeon/documentation-truth-csharp-rabbit-hoole
Fix C# boolean "Prints" comments in documentation
2024-12-11 17:35:30 -06:00
Thaddeus Crews
c5e6f6276b
Merge pull request #100110 from DarioSamo/rd-get-data-async
Implement `RD::buffer_get_data_async()` and `RD::texture_get_data_async()`
2024-12-11 17:35:29 -06:00
Thaddeus Crews
f20ab9b2cf
Merge pull request #99338 from KoBeWi/consider_it_fixed
Clarify Button's text clipping
2024-12-11 17:35:27 -06:00
Thaddeus Crews
61f2001aba
Merge pull request #99081 from Mickeon/documentation-floats-now-print-the-trailing-zero
Update documentation's "Prints" comments after #47502
2024-12-11 17:35:26 -06:00
Bastiaan Olij
0a61ebdcea OpenXR: Add support for binding modifiers 2024-12-12 09:46:19 +11:00
smix8
476479419b Despaghettify NavigationServer path queries
Despaghettify NavigationServer path queries.
2024-12-11 22:29:48 +01:00
Dario
054891de04 Implement buffer_get_data_async and texture_get_data_async. 2024-12-11 11:55:23 -08:00
Rémi Verschelde
44dfa7e710
Merge pull request #99895 from mihe/jolt-physics
Add Jolt Physics as an alternative 3D physics engine
2024-12-11 14:53:57 +01:00
Mikael Hermansson
d470c2ac6a Add Jolt Physics as an alternative 3D physics engine
Co-authored-by: Jorrit Rouwe <jrouwe@gmail.com>
2024-12-11 13:57:25 +01:00
Thaddeus Crews
69c67ede17
Merge pull request #88950 from bruvzg/excap
[macOS, Windows] Add support for excluding windows from a screenshot.
2024-12-10 14:16:10 -06:00
Thaddeus Crews
66dea152b5
Merge pull request #99257 from darksylinc/matias-TheForge-pr04-excluded-ubo+render_opt
Improvements from TheForge
2024-12-10 14:15:55 -06:00
Thaddeus Crews
8f16f864a6
Merge pull request #99765 from dalexeev/core-fix-json-from-to-native
Core: Fix `JSON.{from,to}_native()` issues
2024-12-10 14:15:53 -06:00
Thaddeus Crews
ef0d1e0eb9
Merge pull request #100001 from clayjohn/rd-uniform-set-cache
Increase the size of the uniform set cache to 4096 to avoid cache thrashing from projects with high numbers of unique textures
2024-12-10 14:15:48 -06:00
bruvzg
9fece033ab [macOS, Windows] Add support for excluding windows from a screenshot. 2024-12-10 11:00:13 +02:00
Thaddeus Crews
e9679a28ff
Merge pull request #91604 from nongvantinh/implement-7946
Save color palette as resources to reuse later
2024-12-09 14:33:29 -06:00
Thaddeus Crews
94711acfe1
Merge pull request #87375 from limbonaut/instantiate_property_editor
Export `EditorInspector::instantiate_property_editor` for use by plugins
2024-12-09 14:33:28 -06:00
Thaddeus Crews
473c28b1ad
Merge pull request #98118 from bruvzg/escape_colors
Add support for 24-bit color escape sequences, simplify `print_rich` BBCode parsing.
2024-12-09 14:33:25 -06:00
kobewi
3aebcaf4d3 Clarify limit_length() for infinite vectors 2024-12-09 15:53:11 +01:00
Matias N. Goldberg
c77cbf096b Improvements from TheForge (see description)
The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.

This is the most "risky" PR so far because the previous ones have been
miscellaneous stuff aimed at either [improve
debugging](https://github.com/godotengine/godot/pull/90993) (e.g. device
lost), [improve Android
experience](https://github.com/godotengine/godot/pull/96439) (add Swappy
for better Frame Pacing + Pre-Transformed Swapchains for slightly better
performance), or harmless [ASTC
improvements](https://github.com/godotengine/godot/pull/96045) (better
performance by simply toggling a feature when available).

However this PR contains larger modifications aimed at improving
performance or reducing memory fragmentation. With greater
modifications, come greater risks of bugs or breakage.

Changes introduced by this PR:

TBDR GPUs (e.g. most of Android + iOS + M1 Apple) support rendering to
Render Targets that are not backed by actual GPU memory (everything
stays in cache). This works as long as load action isn't `LOAD`, and
store action must be `DONT_CARE`. This saves VRAM (it also makes
painfully obvious when a mistake introduces a performance regression).
Of particular usefulness is when doing MSAA and keeping the raw MSAA
content is not necessary.

Some GPUs get faster when the sampler settings are hard-coded into the
GLSL shaders (instead of being dynamically bound at runtime). This
required changes to the GLSL shaders, PSO creation routines, Descriptor
creation routines, and Descriptor binding routines.

 - `bool immutable_samplers_enabled = true`

Setting it to false enforces the old behavior. Useful for debugging bugs
and regressions.

Immutable samplers requires that the samplers stay... immutable, hence
this boolean is useful if the promise gets broken. We might want to turn
this into a `GLOBAL_DEF` setting.

Instead of creating dozen/hundreds/thousands of `VkDescriptorSet` every
frame that need to be freed individually when they are no longer needed,
they all get freed at once by resetting the whole pool. Once the whole
pool is no longer in use by the GPU, it gets reset and its memory
recycled. Descriptor sets that are created to be kept around for longer
or forever (i.e. not created and freed within the same frame) **must
not** use linear pools. There may be more than one pool per frame. How
many pools per frame Godot ends up with depends on its capacity, and
that is controlled by
`rendering/rendering_device/vulkan/max_descriptors_per_pool`.

- **Possible improvement for later:** It should be possible for Godot
to adapt to how many descriptors per pool are needed on a per-key basis
(i.e. grow their capacity like `std::vector` does) after rendering a few
frames; which would be better than the current solution of having a
single global value for all pools (`max_descriptors_per_pool`) that the
user needs to tweak.

 - `bool linear_descriptor_pools_enabled = true`

Setting it to false enforces the old behavior. Useful for debugging bugs
and regressions.
Setting it to false is required when workarounding driver bugs (e.g.
Adreno 730).

A ridiculous optimization. Ridiculous because the original code
should've done this in the first place. Previously Godot was doing the
following:

  1. Create a command buffer **pool**. One per frame.
  2. Create multiple command buffers from the pool in point 1.
3. Call `vkBeginCommandBuffer` on the cmd buffer in point 2. This
resets the cmd buffer because Godot requests the
`VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT` flag.
  4. Add commands to the cmd buffers from point 2.
  5. Submit those commands.
6. On frame N + 2, recycle the buffer pool and cmd buffers from pt 1 &
2, and repeat from step 3.

The problem here is that step 3 resets each command buffer individually.
Initially Godot used to have 1 cmd buffer per pool, thus the impact is
very low.

But not anymore (specially with Adreno workarounds to force splitting
compute dispatches into a new cmd buffer, more on this later). However
Godot keeps around a very low amount of command buffers per frame.

The recommended method is to reset the whole pool, to reset all cmd
buffers at once. Hence the new steps would be:

  1. Create a command buffer **pool**. One per frame.
  2. Create multiple command buffers from the pool in point 1.
3. Call `vkBeginCommandBuffer` on the cmd buffer in point 2, which is
already reset/empty (see step 6).
  4. Add commands to the cmd buffers from point 2.
  5. Submit those commands.
6. On frame N + 2, recycle the buffer pool and cmd buffers from pt 1 &
2, call `vkResetCommandPool` and repeat from step 3.

**Possible issues:** @dariosamo added `transfer_worker` which creates a
command buffer pool:

```cpp
transfer_worker->command_pool =
driver->command_pool_create(transfer_queue_family,
RDD::COMMAND_BUFFER_TYPE_PRIMARY);
```

As expected, validation was complaining that command buffers were being
reused without being reset (that's good, we now know Validation Layers
will warn us of wrong use).
I fixed it by adding:

```cpp
void RenderingDevice::_wait_for_transfer_worker(TransferWorker
*p_transfer_worker) {
	driver->fence_wait(p_transfer_worker->command_fence);
	driver->command_pool_reset(p_transfer_worker->command_pool); //
! New line !
```

**Secondary cmd buffers are subject to the same issue but I didn't alter
them. I talked this with Dario and he is aware of this.**
Secondary cmd buffers are currently disabled due to other issues (it's
disabled on master).

 - `bool RenderingDeviceCommons::command_pool_reset_enabled`

Setting it to false enforces the old behavior. Useful for debugging bugs
and regressions.

There's no other reason for this boolean. Possibly once it becomes well
tested, the boolean could be removed entirely.

Adds `command_bind_render_uniform_sets` and
`add_draw_list_bind_uniform_sets` (+ compute variants).

It performs the same as `add_draw_list_bind_uniform_set` (notice
singular vs plural), but on multiple consecutive uniform sets, thus
reducing graph and draw call overhead.

 - `bool descriptor_set_batching = true;`

Setting it to false enforces the old behavior. Useful for debugging bugs
and regressions.

There's no other reason for this boolean. Possibly once it becomes well
tested, the boolean could be removed entirely.

Godot currently does the following:

 1. Fill the entire cmd buffer with commands.
 2. `submit()`
    - Wait with a semaphore for the swapchain.
- Trigger a semaphore to indicate when we're done (so the swapchain
can submit).
 3. `present()`

The optimization opportunity here is that 95% of Godot's rendering is
done offscreen.
Then a fullscreen pass copies everything to the swapchain. Godot doesn't
practically render directly to the swapchain.

The problem with this is that the GPU has to wait for the swapchain to
be released **to start anything**, when we could start *much earlier*.
Only the final blit pass must wait for the swapchain.

TheForge changed it to the following (more complicated, I'm simplifying
the idea):

 1. Fill the entire cmd buffer with commands.
 2. In `screen_prepare_for_drawing` do `submit()`
    - There are no semaphore waits for the swapchain.
    - Trigger a semaphore to indicate when we're done.
3. Fill a new cmd buffer that only does the final blit to the
swapchain.
 4. `submit()`
    - Wait with a semaphore for the submit() from step 2.
- Wait with a semaphore for the swapchain (so the swapchain can
submit).
- Trigger a semaphore to indicate when we're done (so the swapchain
can submit).
 5. `present()`

Dario discovered this problem independently while working on a different
platform.

**However TheForge's solution had to be rewritten from scratch:** The
complexity to achieve the solution was high and quite difficult to
maintain with the way Godot works now (after Übershaders PR).
But on the other hand, re-implementing the solution became much simpler
because Dario already had to do something similar: To fix an Adreno 730
driver bug, he had to implement splitting command buffers. **This is
exactly what we need!**. Thus it was re-written using this existing
functionality for a new purpose.

To achieve this, I added a new argument, `bool p_split_cmd_buffer`, to
`RenderingDeviceGraph::add_draw_list_begin`, which is only set to true
by `RenderingDevice::draw_list_begin_for_screen`.

The graph will split the draw list into its own command buffer.

 - `bool split_swapchain_into_its_own_cmd_buffer = true;`

Setting it to false enforces the old behavior. This might be necessary
for consoles which follow an alternate solution to the same problem.
If not, then we should consider removing it.

PR #90993 added `shader_destroy_modules()` but it was not actually in
use.

This PR adds several places where `shader_destroy_modules()` is called
after initialization to free up memory of SPIR-V structures that are no
longer needed.
2024-12-09 11:49:28 -03:00
David Snopek
3866a7f818 Add missing GDVIRTUAL_BIND() for AudioStream::_has_loop() and ::_get_bar_beats() 2024-12-08 06:38:47 -06:00
Serhii Snitsaruk
803fa8f2e8
Export EditorInspector::instantiate_property_editor for use by plugins
And export useful properties and methods in the `EditorProperty` class.
2024-12-07 14:07:04 +01:00
Nông Văn Tình
e6a49ab6ac Save color palette as resources to reuse later
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
2024-12-06 20:16:06 +07:00
Danil Alexeev
8bf2afd341
Fix CollisionShape{2D,3D}.debug_color inconsistencies 2024-12-06 15:12:20 +03:00
landervr
05010180ce ReflectionProbe add Blend Distance 2024-12-05 23:29:47 +01:00
David
174e659a48
Add 3D translation sensitivity to Editor Settings 2024-12-05 22:50:52 +01:00
Thaddeus Crews
637239e979
Merge pull request #94193 from BastiaanOlij/buildin_includes
Add ability to include built-in include files
2024-12-05 14:12:23 -06:00
Thaddeus Crews
a27d744506
Merge pull request #100002 from wyvrtn/master
Fix a very slight grammatical issue
2024-12-05 14:11:48 -06:00
clayjohn
2535423719 Increase the size of the uniform set cache to 4096 to avoid cache thrashing from projects with high numbers of unique textures. 2024-12-05 12:01:05 -08:00
Michael Alexsander
eb5839dcbb
Add "At Start" mode for sub-emitter particles 2024-12-05 11:48:34 -03:00
Wyv
8a5eef95aa Fix a very slight grammatical issue
Changed the incorrect verb "have" into its correct form, "has."
Fixes #99972

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-05 14:14:32 +00:00
Guilherme Sousa
d7462d223c Add animation node extension 2024-12-05 04:27:16 -08:00
Matt Enad
bd47e4f1ba Add Tablet/Trackpad nav preset
This commit adds a new navigation preset called `Tablet/Trackpad` which enables "Emulate 3 Button Mouse" to more quickly set up good default keys for tablet users.

It also adds support for mouse buttons 4 and 5 in the navigation settings which will be helpful if users want to customize 3D navigation further for specific pens/mice.
2024-12-04 13:02:11 -05:00
Hugo Locurcio
b43c47d6dd Adjust StyleBoxFlat antialiasing to account for 2D stretch scale
This prevents the antialiasing feather from becoming too wide
at viewport sizes higher than the default, which can lead to blurry visuals.

This is adjusted to account for the 2D scale factor returned on the root
Window, so it takes both the `canvas_items` scaling and
`content_scale_factor` into account.
2024-12-04 01:07:25 +01:00