Commit graph

69697 commits

Author SHA1 Message Date
Matias N. Goldberg
acf439e96d Keep processing Graphics if there are pending operations
Fixes #90017
Fixes #90030
Fixes #98044

This PR makes the following changes:

# Force processing of GPU commands for frame_count frames

The variable `frames_pending_resources_for_processing` is added to track
this.

The ticket #98044 suggested to use `_flush_and_stall_for_all_frames()`
while minimized.

Technically this works and is a viable solution.

However I noticed that this issue was happening because Logic/Physics
continue to work "business as usual" while minimized(\*). Only Graphics
was being deactivated (which caused commands to accumulate until window
is restored).

To continue this behavior of "business as usual", I decided that GPU
work should also "continue as usual" by buffering commands in a double
or triple buffer scheme until all commands are done processing (if they
ever stop coming). This is specially important if the app specifically
intends to keep processing while minimized.

Calling `_flush_and_stall_for_all_frames()` would fix the leak, but it
would make  Godot's behavior different while minimized vs while the
window is presenting.

\* `OS::add_frame_delay` _does_ consider being minimized, but it just
throttles CPU usage. Some platforms such as Android completely disable
processing because the higher level code stops being called when the app
goes into background. But this seems like an implementation-detail that
diverges from the rest of the platforms (e.g. Windows, Linux & macOS
continue to process while minimized).

# Rename p_swap_buffers for p_present

**This is potentially a breaking change** (if it actually breaks
anything, I ignore. But I strongly suspect it doesn't break anything).

"Swap Buffers" is a concept carried from OpenGL, where a frame is "done"
when `glSwapBuffers()` is called, which basically means "present to the
screen".

However it _also_ means that OpenGL internally swaps its internal
buffers in a double/triple buffer scheme (in Vulkan, we do that
ourselves and is tracked by `RenderingDevice::frame`).

Modern APIs like Vulkan differentiate between "submitting GPU work" and
"presenting".

Before this PR, calling `RendererCompositorRD::end_frame(false)` would
literally do nothing. This is often undesired and the cause of the leak.
After this PR, calling `RendererCompositorRD::end_frame(false)` will now
process commands, swap our internal buffers in a double/triple buffer
scheme **but avoid presenting to the screen**.

Hence the rename of the variable from `p_swap_buffers` to `p_present`
(which slightly alters its behavior).
If we want `RendererCompositorRD::end_frame(false)` to do nothing, then
we should not call it at all.

This PR reflects such change: When we're minimized **_and_**
`has_pending_resources_for_processing()` returns false, we don't call
`RendererCompositorRD::end_frame()` at all.

But if `has_pending_resources_for_processing()` returns true, we will
call it, but with `p_present = false` because we're minimized.

There's still the issue that Godot keeps processing work (logic,
scripts, physics) while minimized, which we shouldn't do by default. But
that's work for follow up PR.
2024-12-11 14:13:29 -03:00
Rémi Verschelde
aa8d9b83f6
Merge pull request #99960 from pafuent/fixing_tcp_server_flappy_disconnect_test
Fix `TCPServer` "Should disconnect client" test
2024-12-06 16:16:17 +01:00
Thaddeus Crews
eb5103093c
Merge pull request #99327 from colinator27/sync-bar-beats
Implement `AudioStreamSynchronized::get_bar_beats()`, fix division by zero
2024-12-05 14:12:26 -06:00
Thaddeus Crews
4b91e98656
Merge pull request #99959 from fire/vsk-csg-error-and-ctd
Print better manifold errors and avoid crash on non manifold csg input.
2024-12-05 14:12:25 -06:00
Thaddeus Crews
7bff6c827f
Merge pull request #99186 from PhairZ/wheels-of-the-bus-go-round-and-round
Fix `fade_beats` defined as `int` in `audio_stream_interactive.h`
2024-12-05 14:12:24 -06: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
c153f963ce
Merge pull request #99947 from Meorge/ignore-macosx-in-zip
Ignore `__MACOSX` directory for export template and project ZIPs
2024-12-05 14:12:22 -06:00
Thaddeus Crews
45734bd451
Merge pull request #99817 from Ivorforce/strlen-char32_t
Use `strlen()` 3 times instead of custom length check implementations in ustring
2024-12-05 14:12:21 -06:00
Thaddeus Crews
8e01601123
Merge pull request #100064 from clayjohn/atlas-realloc-time
Correctly check time since shadow was allocated in atlas to avoid unnecessary re-allocations
2024-12-05 14:12:19 -06:00
Thaddeus Crews
6588505aca
Merge pull request #96735 from bruvzg/rtl_frame_indent
[RTL] Fix indent in tables and tables in indent.
2024-12-05 14:12:18 -06:00
Thaddeus Crews
4d0ce3ce76
Merge pull request #100060 from Rudolph-B/Issue-100032
Fixed occlusion culling buffer getting overwritten in larger scenes
2024-12-05 14:12:17 -06:00
Thaddeus Crews
85862ea718
Merge pull request #100058 from DarioSamo/d3d12-texture-limits
Add texture limits for D3D12 Driver.
2024-12-05 14:12:16 -06:00
Thaddeus Crews
b34a643404
Merge pull request #96346 from DeeJayLSP/qoa-opt
Use `qoa.c` and custom compress procedure
2024-12-05 14:12:15 -06:00
Thaddeus Crews
30b32396de
Merge pull request #100053 from bruvzg/font_change
Change default Arabic font to Vazirmatn.
2024-12-05 14:12:14 -06:00
Thaddeus Crews
370e5f3b0e
Merge pull request #99920 from lander-vr/reflection-probe-ui-improvements
Clean up UI of ReflectionProbe
2024-12-05 14:12:12 -06:00
Thaddeus Crews
49e033f8e2
Merge pull request #100047 from MBCX/fix-freebsd-compilation
Make Godot compile on `FreeBSD`
2024-12-05 14:12:11 -06:00
Thaddeus Crews
63af934d74
Merge pull request #98506 from 0xafbf/build-linux-with-spaces-in-path
Fix linux builds with separate debug symbols file when there is a space in the path.
2024-12-05 14:12:10 -06:00
Thaddeus Crews
09cbe05485
Merge pull request #76231 from Calinou/inspector-text-show-tooltip
Show String properties' text in a tooltip in the inspector
2024-12-05 14:12:09 -06:00
Thaddeus Crews
f5d82af1fd
Merge pull request #99136 from DarioSamo/light-compute-attenuation-skip
Improve performance of shader lighting code in Forward renderers.
2024-12-05 14:12:08 -06:00
Thaddeus Crews
ef22b6fe82
Merge pull request #100030 from passivestar/mainmenu-valign
Fix vertical alignment of the main menu bar
2024-12-05 14:12:06 -06:00
Thaddeus Crews
a4c2e16c19
Merge pull request #100028 from clayjohn/rd-lights-array
Use a vector instead of an array in canvas shader instance buffer
2024-12-05 14:12:05 -06:00
Thaddeus Crews
68cd7f2e97
Merge pull request #100027 from timothyqiu/efd-improve
Fix UI inconsistencies in `EditorFileDialog`'s toolbar
2024-12-05 14:12:04 -06:00
Thaddeus Crews
ea12a08149
Merge pull request #100022 from DeeJayLSP/wav-load-test
`TestAudioStreamWAV`: use runtime load instead of importer
2024-12-05 14:12:02 -06:00
Thaddeus Crews
06cce0e81a
Merge pull request #100016 from Ivorforce/camelcase-to-underscore-rolling-cache
Optimize `_camelcase_to_underscore` (and thus `String.capitalize`)
2024-12-05 14:11:59 -06:00
Thaddeus Crews
3a948abdce
Merge pull request #100015 from Ivorforce/is-valid-filename-cache
Optimize `String::is_valid_filename()` and `String::validate_filename()`
2024-12-05 14:11:57 -06:00
Thaddeus Crews
df94c00f6d
Merge pull request #100010 from KoBeWi/directory_compass_for_navigating_sea_of_directories
Don't rebuild tree when navigating to path
2024-12-05 14:11:53 -06:00
Thaddeus Crews
ec7ffdcb15
Merge pull request #100008 from Chubercik/thorvg-0.15.5
thorvg: Update to 0.15.5
2024-12-05 14:11:50 -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
Thaddeus Crews
755f600173
Merge pull request #99999 from akien-mga/ufbx-0.15.0
ufbx: Update to upstream 0.15.0
2024-12-05 14:11:46 -06:00
Thaddeus Crews
9951743adf
Merge pull request #97822 from stdmnpkg/loongarch
Add loongarch64 support for Linux/*BSD
2024-12-05 14:11:44 -06:00
Thaddeus Crews
4adf4bf58f
Merge pull request #99987 from KoBeWi/preferred_mess
Fix extensions when saving resource as
2024-12-05 14:11:42 -06:00
Thaddeus Crews
e9cbfd3dad
Merge pull request #99982 from hakro/quiet_tiptool
Ignore custom tooltip if its text is empty in signals tab
2024-12-05 14:11:40 -06:00
Thaddeus Crews
8c8bfce0f9
Merge pull request #99978 from DarioSamo/more-mobile-scs
Add specialization for directional light split blend and fog to mobile renderer.
2024-12-05 14:11:29 -06:00
clayjohn
1b5a15d5d1 Correctly check time since shadow was allocated in atlas to avoid unnecessary re-allocations
Co-authored-by: jitspoe <jitspoe@yahoo.com>
2024-12-05 11:13:37 -08:00
Dario
d7d6251c30 Add texture limits for D3D12 Driver. 2024-12-05 13:55:57 -03:00
Rudolph Bester
329d25b1fa Fixed occlusion culling buffer getting overwritten in larger scenes 2024-12-05 18:54:13 +02:00
MBCX
6bc80effbb Make Godot compile on FreeBSD 2024-12-05 12:33:55 -04:00
DeeJayLSP
afd68d785b Use qoa.c and custom compress procedure 2024-12-05 13:20:09 -03:00
Student Main
f39614aa5a Ignore case when parse /proc/cpuinfo 2024-12-06 00:19:58 +08:00
Student Main
e0693f8ad8 Add loongarch64 support 2024-12-06 00:18:26 +08:00
Andrés Botero
becf5d7ac3 Fix linux builds with debug symbols when there is a space in the path. 2024-12-05 10:31:12 -05:00
Pāvels Nadtočajevs
06cae04b87 Change default Arabic font to Vazirmatn. 2024-12-05 16:26:52 +02: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
Haoyu Qiu
1ef3bd5768 Fix UI inconsistencies in EditorFileDialog's toolbar
- Sort button has different stylebox compared to others
- The top toolbar has a separator on the right side when in open mode
- Update fav up/down buttons when fav list changes
2024-12-05 16:56:59 +08:00
passivestar
73f7e1379c Fix vertical alignment of the main menu bar 2024-12-05 05:27:34 +04:00
clayjohn
e316739a13 Use a vector instead of an array in canvas shader instance buffer.
This avoids a pathological performance cliff on Adreno devices
2024-12-04 16:36:46 -08:00
DeeJayLSP
eaa0418deb TestAudioStreamWAV: use runtime load instead of importer 2024-12-04 18:44:48 -03:00
Malcolm Anderson
2336415623 Ignore __MACOSX directory in export template collection ZIP file and project import ZIP file
Update editor/export/export_template_manager.cpp

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-04 13:31:26 -08:00
Lukas Tenbrink
8d82933c7c Optimize _camelcase_to_underscore (and thus String.capitalize) by using a rolling cache of character attributes, instead of re-computing each iteration. 2024-12-04 18:39:38 +01:00
Thaddeus Crews
1f47e4c4e3
Merge pull request #99990 from KoBeWi/update_tree_after_updating_tree
Fix FileSystem dock filter reset when tree rebuilds
2024-12-04 11:02:11 -06:00