Fixes#90017Fixes#90030Fixes#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.
This eases troubleshooting when working with command line arguments.
Warnings are only printed if the argument does not exist as a file
or directory path (relative or absolute). This allows positional arguments
to keep working as they are now, without printing warnings when a project
reads positional arguments to perform operations on files (e.g. when
drag-and-dropping a file onto a project executable).
This now prints a warning:
godot --non-existent-argument
This still doesn't print a warning, as it's an user argument:
godot -- --non-existent-argument
This doesn't print a warning if the file/folder path exists:
godot /path/to/file.txt
A warning is still printed if the file/folder doesn't exist. Drag-and-drop
associations always refer to existing files/folders, so that scenario was
unlikely to be encountered.
Adds "--accurate-breadcrumbs" CLI command
Additionally, leave out breadcrumbs code in non-debug, non-dev builds.
Fix regression introduced in #98388 where command_insert_breadcrumb() is
called even in non-debug builds.
Fixes#98338
`core/os/os.h` doesn't use `core/io/image.h`. It just brings
transitive dependencies. Lots of dependencies because `core/os/os.h`
is transitively included in almost every file of godot
Also added `core/io/image.h` into files^1 where `Ref<Image>` and `core/os/os.h`
were used to prevent obscure errors involving `Ref<Image>`
^1 except those which include `core/io/image_loader.h` or `core/io/image.h` by
corresponding .h file with the same name
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
- Implements asynchronous transfer queues from PR #87590.
- Adds ubershaders that can run with specialization constants specified as push constants.
- Pipelines with specialization constants can compile in the background.
- Added monitoring for pipeline compilations.
- Materials and shaders can now be created asynchronously on background threads.
- Meshes that are loaded on background threads can also compile pipelines as part of the loading process.
XR is disabled when 3D is disbled so there is no sense in
setting xr specific settings and adding `--xr-mode` option
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
If the module is enabled (default), 2D physics works as it did before.
If the module is disabled and no other 2D physics server is registered
(via a module or GDExtension), then we fall back to a dummy
implementation which effectively disables 2D physics functionality (and
a warning is printed).
The dummy 2D physics server can also be selected explicitly, in which
case no warning is printed.
If the module is enabled (default), 3D physics works as it did before.
If the module is disabled and no other 3D physics server is registered
(via a module or GDExtension), then we fall back to a dummy
implementation which effectively disables 3D physics functionality (and
a warning is printed).
The dummy 3D physics server can also be selected explicitly, in which
case no warning is printed.