1
0
Fork 0
Godot Engine – Multi-platform 2D and 3D game engine
Go to file
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
.github CI: Add explicit problem matchers 2024-11-27 16:47:34 -06:00
core Merge pull request #99817 from Ivorforce/strlen-char32_t 2024-12-05 14:12:21 -06:00
doc Merge pull request #94193 from BastiaanOlij/buildin_includes 2024-12-05 14:12:23 -06:00
drivers Merge pull request #100064 from clayjohn/atlas-realloc-time 2024-12-05 14:12:19 -06:00
editor Merge pull request #99947 from Meorge/ignore-macosx-in-zip 2024-12-05 14:12:22 -06:00
main Keep processing Graphics if there are pending operations 2024-12-11 14:13:29 -03:00
misc Merge pull request #99051 from bruvzg/ios_entitlements 2024-12-02 17:20:11 +01:00
modules Merge pull request #99327 from colinator27/sync-bar-beats 2024-12-05 14:12:26 -06:00
platform Merge pull request #100047 from MBCX/fix-freebsd-compilation 2024-12-05 14:12:11 -06:00
scene Merge pull request #96735 from bruvzg/rtl_frame_indent 2024-12-05 14:12:18 -06:00
servers Keep processing Graphics if there are pending operations 2024-12-11 14:13:29 -03:00
tests Merge pull request #99960 from pafuent/fixing_tcp_server_flappy_disconnect_test 2024-12-06 16:16:17 +01:00
thirdparty Merge pull request #99959 from fire/vsk-csg-error-and-ctd 2024-12-05 14:12:25 -06:00
.clang-format Style: Downgrade `.clang-format` arguments to 17.x 2024-11-27 10:11:17 -06:00
.clang-tidy Style: Apply `clang-tidy` fixes 2024-11-04 12:11:06 -06:00
.editorconfig CI: Add `svgo` pre-commit hook 2024-06-23 08:14:54 -05:00
.git-blame-ignore-revs clang-tidy commit to `.git-blame-ignore-revs` 2024-11-04 12:11:39 -06:00
.gitattributes Correct C++ highlighting settings in .gitattributes 2024-08-27 23:24:30 +02:00
.gitignore Merge pull request #98093 from zynga-jpetersen/jpetersen/ios_xcode_PROVISIONING_PROFILE_SPECIFIER_support 2024-11-29 22:46:29 +01:00
.mailmap Update AUTHORS and DONORS list 2024-09-17 13:07:39 +02:00
.pre-commit-config.yaml Merge pull request #99490 from dalexeev/gds-tests-track-multiple-errors 2024-11-29 22:02:02 +01:00
AUTHORS.md Update AUTHORS and DONORS list 2024-09-17 13:07:39 +02:00
CHANGELOG.md Add changelog for Godot 4.3 2024-08-15 00:57:57 +02:00
CONTRIBUTING.md Update godot documentation contribution link 2024-07-20 20:51:11 -06:00
COPYRIGHT.txt Change default Arabic font to Vazirmatn. 2024-12-05 16:26:52 +02:00
DONORS.md Update AUTHORS and DONORS list 2024-09-17 13:07:39 +02:00
LICENSE.txt One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
LOGO_LICENSE.txt Cleanup various repository documentation files 2023-10-10 13:58:13 +02:00
README.md Cleanup various repository documentation files 2023-10-10 13:58:13 +02:00
SConstruct Merge pull request #99351 from dustdfg/scons_android_refactor 2024-11-21 17:56:59 -06:00
gles3_builders.py SCons: Add method to generate raw cstrings 2024-07-31 14:22:04 -05:00
glsl_builders.py SCons: Add method to generate raw cstrings 2024-07-31 14:22:04 -05:00
godot.manifest [Windows] Always use absolute UNC paths and long path aware APIs, add "long path aware" flag to the application manifest. 2024-08-28 11:15:57 +03:00
icon.png
icon.svg Style: Optimize `.svg` files with `svgo` 2024-06-23 08:15:19 -05:00
icon_outlined.png
icon_outlined.svg Style: Optimize `.svg` files with `svgo` 2024-06-23 08:15:19 -05:00
logo.png
logo.svg Style: Optimize `.svg` files with `svgo` 2024-06-23 08:15:19 -05:00
logo_outlined.png Convert the logo's text outlines into paths 2023-04-07 17:51:56 +02:00
logo_outlined.svg Style: Optimize `.svg` files with `svgo` 2024-06-23 08:15:19 -05:00
methods.py [Buildsystem] Fix path format for SCU builds on Windows 2024-11-24 15:33:47 +01:00
platform_methods.py Add loongarch64 support 2024-12-06 00:18:26 +08:00
pyproject.toml Style: Update `pyproject.toml` syntax 2024-11-14 13:05:21 -06:00
scu_builders.py Make SCons SCU build banner less intrusive 2024-11-08 13:46:26 +01:00
version.py Bump version to 4.4-dev 2024-08-15 11:39:34 +02:00

README.md

Godot Engine

Godot Engine logo

2D and 3D cross-platform game engine

Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unified interface. It provides a comprehensive set of common tools, so that users can focus on making games without having to reinvent the wheel. Games can be exported with one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), as well as Web-based platforms and consoles.

Free, open source and community-driven

Godot is completely free and open source under the very permissive MIT license. No strings attached, no royalties, nothing. The users' games are theirs, down to the last line of engine code. Godot's development is fully independent and community-driven, empowering users to help shape their engine to match their expectations. It is supported by the Godot Foundation not-for-profit.

Before being open sourced in February 2014, Godot had been developed by Juan Linietsky and Ariel Manzur (both still maintaining the project) for several years as an in-house engine, used to publish several work-for-hire titles.

Screenshot of a 3D scene in the Godot Engine editor

Getting the engine

Binary downloads

Official binaries for the Godot editor and the export templates can be found on the Godot website.

Compiling from source

See the official docs for compilation instructions for every supported platform.

Community and contributing

Godot is not only an engine but an ever-growing community of users and engine developers. The main community channels are listed on the homepage.

The best way to get in touch with the core engine developers is to join the Godot Contributors Chat.

To get started contributing to the project, see the contributing guide. This document also includes guidelines for reporting bugs.

Documentation and demos

The official documentation is hosted on Read the Docs. It is maintained by the Godot community in its own GitHub repository.

The class reference is also accessible from the Godot editor.

We also maintain official demos in their own GitHub repository as well as a list of awesome Godot community resources.

There are also a number of other learning resources provided by the community, such as text and video tutorials, demos, etc. Consult the community channels for more information.

Code Triagers Badge Translate on Weblate TODOs