Commit Graph

2556 Commits

Author SHA1 Message Date
Matias N. Goldberg
b9a2f108fc Fix splash screen upside down on Android
Fixes an issue introduced in #96439 (see
https://github.com/godotengine/godot/pull/96439#issuecomment-2447288702)

Godot was relying on Java's
activity.getWindowManager().getDefaultDisplay().getRotation(); to apply
pre-rotation but this is wrong.

First, getRotation() may temporarily return a different value from the
correct one; which is what was causing the splash screen to be upside
down. It would return -90 instead of 90 for the first rendered frame.

But unfortunately, the splash screen is just one frame rendered for a
very long time, so the error lingered for a long time for everyone to
see.

Second, to determine what rotation to use, we should be looking at what
Vulkan told us, which is the value we pass to
VkSurfaceTransformFlagBitsKHR::preTransform.

This commit removes the now-unnecessary
screen_get_internal_current_rotation() function (which was introduced by
#96439) and now saves the preTransform value in the swapchain.
2024-10-31 16:52:26 -03:00
Thaddeus Crews
6d09a20c82
Merge pull request #97247 from thimenesup/draw_indirect_rd
Add draw indirect to Rendering Device
2024-10-29 19:25:57 -05:00
Thaddeus Crews
a8931f1aa9
Merge pull request #98652 from stuartcarnie/2d_texture_state_fixes
2D: Fix various issues and minor performance optimisations
2024-10-29 19:25:54 -05:00
Thaddeus Crews
7a661eaa7c
Merge pull request #98612 from DarioSamo/alignment-transfer-fix
Fix transfer alignment on initial texture transfer.
2024-10-29 19:25:46 -05:00
Thaddeus Crews
b7a0971ad2
Merge pull request #97934 from adamscott/give-AThousandShips-a-break
[Codestyle] Set clang-format `RemoveSemicolon` rule to `true`
2024-10-29 19:25:36 -05:00
Thaddeus Crews
64b68192cc
Merge pull request #98562 from Rudolph-B/Issue-98561
Fix Occlusion Culling not working for an orthogonal camera.
2024-10-29 19:25:34 -05:00
Stuart Carnie
0d1d945727
2D: Fix various issues and minor performance optimisations 2024-10-30 08:36:45 +11:00
Clay John
748f4079e3
Merge pull request #96439 from darksylinc/matias-TheForge-pr03-rebased
Add Swappy & Pre-Transformed Swapchain
2024-10-29 12:34:40 -07:00
thimenesup
d36a872432 Add draw indirect to Rendering Device 2024-10-29 17:40:28 +01:00
Matias N. Goldberg
aaa0e2fddf Add Swappy & Pre-Transformed Swapchain
- Adds Swappy for Android for stable frame pacing
- Implements pre-transformed Swapchain so that Godot's compositor is in
charge of rotating the screen instead of Android's compositor
(performance optimization for phones that don't have HW rotator)

============================

The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.

Changes from original PR:

- Removed "display/window/frame_pacing/android/target_frame_rate" option
to use Engine::get_max_fps instead.
- Target framerate can be changed at runtime using Engine::set_max_fps.
- Swappy is enabled by default.
- Added documentation.
- enable_auto_swap setting is replaced with swappy_mode.
2024-10-28 18:55:37 -03:00
Dario
427ba09efc Fix soft shadows by increasing the bit count for specialization constants. 2024-10-28 10:26:50 -03:00
Dario
03f56fc15d Fix transfer alignment on initial texture transfer.
Fixes the regression caused by transfer workers with textures with non-standard dimensions such as the ones provided in #98601.
2024-10-28 09:56:02 -03:00
Rudolph Bester
76c20383d1 Fix Occlusion Culling not working for an orthogonal camera. 2024-10-26 20:07:34 +02:00
Thaddeus Crews
edad871a2d
Merge pull request #98425 from darksylinc/matias-breadcrumbs-race-fix
Fix race conditions in breadcrumbs
2024-10-25 13:04:12 -05:00
Adam Scott
0d350e7108
Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
Yuri Rubinsky
6732a0fd86
Merge pull request #98448 from Chaosus/shader_global_builtins
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions
Make `OUTPUT_IS_SRGB/CLIP_SPACE_FAR` shader built-ins global
2024-10-25 13:55:14 +03:00
Clay John
78a4e634f0
Merge pull request #98257 from Rudolph-B/94210-B
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions
Fix to occlusion culling where all math is based on Euclidean distance.
2024-10-24 21:06:56 -07:00
Thaddeus Crews
cfc05c5e0f
Merge pull request #85338 from EMBYRDEV/shadow-caster-mask
Add `shadow_caster_mask` to Light3D.
2024-10-24 13:22:59 -05:00
Thaddeus Crews
ba4e67e55e
Merge pull request #98266 from m-pranav-r/fix-light-visual-instance
Fix light culling mask behavior in Mobile and Compat renderers
2024-10-24 13:22:58 -05:00
Thaddeus Crews
9f908a3a5b
Merge pull request #86103 from ecmjohnson/fix-inside-volfog
Fix volumetric fog artifacts when inside the fog
2024-10-24 13:22:57 -05:00
Thaddeus Crews
52bbbd4338
Merge pull request #98247 from TCROC/fix-headless-graphics-driver-and-shader-crash
Don't create rendering device or parse glsl shader in headless mode
2024-10-24 13:22:53 -05:00
Chaosus
463e81413e Make OUTPUT_IS_SRGB/CLIP_SPACE_FAR shader built-ins global 2024-10-24 12:32:05 +03:00
Yuri Rubinsky
ff9fb0abea
Merge pull request #93590 from Chaosus/shader_custom_func_discard
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions
Allow usage of `discard` inside custom shader functions
2024-10-24 09:38:10 +03:00
Yuri Rubinsky
03641a425f
Merge pull request #93650 from Chaosus/shader_stage_custom_funcs
Allow using stage functions inside custom shader functions
2024-10-24 09:32:04 +03:00
m-pranav-r
fcea158927 Fixed light culling mask behavior in Mobile and Compat renderers 2024-10-23 08:38:56 +05:30
Matias N. Goldberg
668c9b74e2 Fix race conditions in breadcrumbs
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
2024-10-22 22:08:46 -03:00
Travis Lange
2e1fc241f9 fix headless import attempting to load graphics driver 2024-10-22 16:17:09 -04:00
Clay John
533c616cb8
Merge pull request #98391 from RandomShaper/rd_thread_switch
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions
Implement thread ownership change for RenderingDevice
2024-10-22 13:10:32 -07:00
Thaddeus Crews
7815ccbdd5
Merge pull request #98294 from Calinou/texture-placeholders-use-shared-copy
Use a shared copy of placeholder textures, tweak placeholder appearance
2024-10-21 16:39:29 -05:00
Thaddeus Crews
1a9628f937
Merge pull request #98267 from Chaosus/shader_pp_error
Add `#error` preprocessor directive to shading language
2024-10-21 16:39:23 -05:00
Thaddeus Crews
a14e9e99e5
Merge pull request #98388 from DarioSamo/sync-fixes
Improve synchronization of rendering after changes from transfer queues.
2024-10-21 16:39:21 -05:00
Thaddeus Crews
178342b058
Merge pull request #98258 from LainAmongYou/fix-bgra
Add support for BGRA textures with Texture*RD
2024-10-21 16:39:20 -05:00
Thaddeus Crews
291e4b78e2
Merge pull request #98237 from dustdfg/os_transitive_image_headers_refactor
Don't include `core/io/image.h` in `core/os/os.h`
2024-10-21 16:39:15 -05:00
Thaddeus Crews
c145e85011
Merge pull request #98226 from m-pranav-r/fix-volumetric-shadows
Fix incorrect depth comparison used to calculate volumetric fog shadowing
2024-10-21 16:39:11 -05:00
Thaddeus Crews
5e65747d90
Merge pull request #97925 from huwpascoe/lightmap_dynamic_bugfix
Fix updating dynamic objects in LightmapGI
2024-10-21 16:39:04 -05:00
Pedro J. Estébanez
d5d509bbd6 Implement thread ownership change for RenderingDevice 2024-10-21 20:56:42 +02:00
Dario
4ad424234f Improve synchronization of rendering commands after changes from transfer queues.
Fix an error where barriers are expected to be inserted for the swap chain textures.
Add the relevant synchronization stages and accesses to resources between frames.
Fix an error where debug labels weren't finished correctly between frames.
Breadcrumbs are now behind an optional macro as they currently lead to synchronization errors which are harmless.
2024-10-21 11:27:56 -03:00
Yevhen Babiichuk (DustDFG)
af6d260c17 Don't include core/io/image.h in core/os/os.h
`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>
2024-10-18 19:04:19 +03:00
Hugo Locurcio
35a20fa96a Use a shared copy of placeholder textures, tweak placeholder appearance
This reduces memory usage a bit in case multiple placeholders were
requested, e.g. when using multiple NoiseTextures with no noise property
defined.

The placeholder texture's appearance was also changed from a plain magenta
color to a checkerboard alternating between magenta and black pixels.
This makes it easier to spot when the placeholder texture ends up
being used in a complex scene (usually by accident).
The texture's dimensions remain identical to keep the physical size
identical in 2D.
2024-10-18 14:51:51 +02:00
Dario
8c3e46b13b Move transitions of textures initialized by transfer workers to the main graphics queue.
Also adds a new possible texture layout and API trait to support a particular behavior in D3D12 where only the COMMON layout is supported in copy queues. Fixes #98158.
2024-10-18 09:15:25 -03:00
Chaosus
155cf6a5b6 Add #error preprocessor directive to shading language 2024-10-18 10:56:58 +03:00
Clay John
0ce4d8fcd3
Merge pull request #98086 from DarioSamo/transfer-queues-semaphores
Rewrite semaphore handling for transfer workers.
2024-10-17 16:54:43 -07:00
Clay John
a2117f5796
Merge pull request #98187 from EnlightenedOne/98102
Fix Mobile Renderer - Shadow Disabled and User Vertex Lighting flags
2024-10-17 16:37:09 -07:00
Dario
7a936e8bac Rewrite semaphore handling for transfer workers. 2024-10-17 14:07:08 -03:00
yesfish
274076c5be Lightmap Dynamic Bugfix 2024-10-17 16:27:30 +01:00
Yuri Rubinsky
ad7e7a51b2 Allow usage of discard inside custom shader functions 2024-10-17 16:06:33 +03:00
Yuri Rubinsky
74c000db17 Allow using stage functions inside custom shader functions 2024-10-17 15:47:01 +03:00
Lain
4e6d9813b2 Add support for BGRA textures with Texture*RD
This adds the ability to use BGRA textures created with RenderingDevice
with classes such as Texture2DRD.
2024-10-16 22:31:43 -07:00
Rudolph Bester
ed3f990952 Alternative fix to occlusion culling where all math is based on Euclidean distance. 2024-10-17 05:59:37 +02:00
m-pranav-r
c12001a9dc Fix incorrect depth comparison used to calculate volumetric fog shadowing 2024-10-16 14:55:41 +05:30