Commit Graph

4266 Commits

Author SHA1 Message Date
alessand10
9ea97c017b Fix a command buffer leak that occurs in dx12 2024-12-17 14:55:39 -05:00
clayjohn
7c61252dd7 Optimize PointLight2D shadow rendering by reducing draw calls and RD state changes.
This dramatically reduces the CPU time spent on rendering shadows for PointLight2Ds
2024-12-17 07:41:09 -08:00
Rémi Verschelde
d60c0e21a6
Merge pull request #88313 from wagnerfs/run-time-anisotropic-filtering
Allow changing the anisotropic filter level at run-time per Viewport
2024-12-17 16:18:38 +01:00
Stayd
ed0e3d7da8 Scene Shaders - TBN Fixes
Fixes two errors related to the normal, tangent,
and bitangent vectors, namely normals not always
being inverted on backfaces, and normalization
being reversed from what MikkTSpace expects.
2024-12-16 22:36:23 -07:00
Andrew_Shobbrook
e42def12d0
Implement per-light Specular property in DirectionalLight3D 2024-12-16 19:18:18 +01:00
Lukas Tenbrink
df3e9291c6 Rename String::copy_from functions to their respective encodings (parse_latin1, parse_wstring, parse_utf32). 2024-12-15 21:46:50 +01:00
Rémi Verschelde
ffe53cba3c
Merge pull request #100374 from hpvb/fix-rendering-ubsan
Fix ubsan reported errors in rendering
2024-12-14 18:25:46 +01:00
Rémi Verschelde
736dcf72cc
Merge pull request #100125 from alessand10/uniform-variable-fix
Move uniform variables up in the `gles3/scene.glsl` template so that they are available within the `#GLOBALS` scope
2024-12-14 18:25:38 +01:00
Ramón Grill
d848835f8c Add support for thread naming on windows platform 2024-12-14 14:42:39 +01:00
Thaddeus Crews
9ecdeb3723
Merge pull request #98747 from tetrapod00/standardize-renderer-strings
Standardize terms for renderers in error strings
2024-12-13 16:19:37 -06:00
Thaddeus Crews
f2c8f17906
Merge pull request #100325 from hpvb/fix-rendering-alignment
Fix several ubsan reported misaligned accesses
2024-12-13 16:19:20 -06:00
HP van Braam
062d74bb9c Fix ubsan reported errors in rendering
This allows the TPS demo to run without an ubsan reports from any of the
rendering code.
2024-12-13 21:27:37 +01:00
HP van Braam
e674379764 Fix several ubsan reported misaligned accesses
These misaligned accesses are shown in all of our CI hooks. It turned
out to not be difficult to fix.

It is likely that this will improve performance for aarch64.
2024-12-13 15:32:35 +01:00
clayjohn
356fa37f89 Small fixups for the new reflection probe blending 2024-12-12 17:29:21 -08:00
Thaddeus Crews
bfc66f0608
Merge pull request #100282 from devloglogan/motion-vectors-openxr
Add renderer motion vectors API for use with OpenXR
2024-12-12 16:13:36 -06:00
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
b7501d219c
Merge pull request #100322 from darksylinc/matias-tf-comment-fix
Fix grammar / spelling in comments
2024-12-12 16:13:25 -06:00
Matias N. Goldberg
a1b44ec7a7 Fix grammar / spelling in comments
Minor fixes for changes introduced in #99257 that could not be fixed in
time as the PR needed to be expedited.
2024-12-12 12:47:08 -03:00
Rémi Verschelde
562dd1ad85
Merge pull request #100305 from clayjohn/directional-light-2d-mask
Remove positional light mask from directional lights in Canvas Item shaders.
2024-12-12 14:10:24 +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
BlueCube3310
189c8eb671 Implement shadowmasks for LightmapGI
Co-authored-by: dearthdev <nathandearthdev@gmail.com>
2024-12-12 11:00:28 +01:00
clayjohn
f8827271d7 Remove positional light mask from directional lights in Canvas Item shaders. 2024-12-12 00:20:07 -08:00
Thaddeus Crews
ef3086bcdb
Merge pull request #94947 from ChrisBase/issue_94946
Change some image error messages to output the file path
2024-12-11 17:35:58 -06:00
devloglogan
3deb5884d7 Renderer agnostic motion vector rendering/OpenXR changes 2024-12-10 15:59:17 -06:00
Thaddeus Crews
f962fdce0e
Merge pull request #100185 from Repiteo/scons/fix-thirdparty-warnings
SCons: Fix MSVC bypassing disabled warnings
2024-12-10 14:16:02 -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
a167afd70a
Merge pull request #96771 from clayjohn/RD-static-lighting
Avoid calculating dynamic lights when lights are already baked using the static bake mode in the Forward+ renderer
2024-12-10 14:15:41 -06:00
Allen Pestaluky
db63d3e3a0 Prevent WASAPI error spam when device cannot be initialized.
Fixes #99968 and prevents the error spam referenced in comments of #18732.
Also fixes a number of memory leaks that occur when an audio device is reinitialized or fails to reinitialize and gates reinitialization attempts to around 1 per second instead of ~1000 attempts per second.

Co-authored-by: Kusok <118438257+kus04e4ek@users.noreply.github.com>
2024-12-10 13:32:33 -05:00
Adam Scott
a6c5373a09
[Web] Fix DirAccess::unlink() not updating the IDBFS 2024-12-09 17:48:08 -05:00
Thaddeus Crews
a3656083ca
Merge pull request #100065 from clayjohn/mesh-aabb-clear
Clear AABB when Mesh is cleared
2024-12-09 14:33:32 -06:00
Thaddeus Crews
070aeb5688
SCons: Fix MSVC bypassing disabled warnings 2024-12-09 11:49:42 -06: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
Alessandro
c153c5b3cf Moved uniform variables up so that they are available within the #GLOBAL scope 2024-12-06 17:39:31 -05:00
Lukas Tenbrink
b5c31ebb41 Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +01:00
clayjohn
9320865796 Avoid calculating dynamic lights when lights are baked into LightmapGI using the static bake mode 2024-12-06 10:17:44 -08:00
landervr
05010180ce ReflectionProbe add Blend Distance 2024-12-05 23:29:47 +01: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
85862ea718
Merge pull request #100058 from DarioSamo/d3d12-texture-limits
Add texture limits for D3D12 Driver.
2024-12-05 14:12:16 -06:00
clayjohn
deac37c464 Clear AABB when Mesh is cleared 2024-12-05 11:40:44 -08: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
Rémi Verschelde
d471210eba
libpng: Update to upstream 1.6.44 2024-12-04 00:47:54 +01:00
Thaddeus Crews
156bc92282
Merge pull request #98397 from adamscott/add-tmp-support
Add temp utilities (alias `OS::get_temp_dir()`, `FileAccess::create_temp()`, and `DirAccess::create_temp()`)
2024-12-03 14:40:59 -06:00
Thaddeus Crews
608cccc64e
Merge pull request #99919 from bruvzg/ferror
[FileAccess] Set `last_error` on file read/write errors.
2024-12-03 14:40:57 -06:00
Thaddeus Crews
70dae45dd0
Merge pull request #99905 from stuartcarnie/fix_external_texture
Metal: Ensure `texture_create_from_extension` returns correct pixel format
2024-12-03 14:40:55 -06:00
Thaddeus Crews
6478f296bc
Merge pull request #99720 from mrsaturnsan/mac_vsync_fix
Fix vsync on macOS getting disabled when using `afterMinimumDuration`
2024-12-03 14:40:44 -06:00
Stuart Carnie
7caa039183
Metal: Ensure texture_create_from_extension returns correct pixel format 2024-12-03 05:45:50 +11:00
Adam Scott
1b3e483899
Add file and dir temporary utilities
Co-authored by @Alex2782 for the Android bindings.
Many thanks to the reviewers also.

Co-authored-by: Alex <alex.hart.278@gmail.com>
2024-12-02 12:08:14 -05:00
Rémi Verschelde
101b7414d2
Merge pull request #99036 from bruvzg/propkey_rename
[Windows] Rename `PKEY_Device_FriendlyName` to avoid duplicate symbols with newer MinGW SDKs.
2024-12-02 15:51:02 +01:00
bruvzg
d97313cd7d [FileAccess] Set last_error on file read/write errors. 2024-12-02 15:05:50 +02:00
Wagner
6995b6a03e Allow changing the anisotropic filter level at run-time per Viewport 2024-11-30 00:50:45 -03:00
Rémi Verschelde
c2f19e98bc
Merge pull request #98921 from RandomShaper/win_many_files
Raise the number of file handles on Windows
2024-11-29 22:46:54 +01:00
bruvzg
a4b17e7852 [FileAccess] Return error codes from store_* methods. 2024-11-29 23:22:31 +02:00
Fabio Alessandrelli
c831f635fe [Web] Implement dummy IPWeb instead of IPUnix
Note: This commit ties the IPUnix to the UNIX_SOCKET_UNAVAILABLE define,
disabling it when set. It is maybe not semantically correct (getifaddrs)
is not part of the "socket" API, but it's reasonable to expect that a
platform not supporting Unix-style sockets, would also not support other
Unix network functions.
2024-11-28 20:47:18 +01:00
Thaddeus Crews
6e533b5ee4
Merge pull request #99606 from jamie-pate/fix_99592
Fix gl_compatibility lightmap uniforms not being set
2024-11-27 10:46:58 -06:00
ze2j
97e0b43faa Add ArrayMesh::surface_remove 2024-11-27 13:46:15 +01:00
mrsaturnsan
627d10e4c4 Fix vsync on macOS getting disabled when using afterMinimumDuration 2024-11-26 15:38:32 -06:00
Thaddeus Crews
127738c08b
Merge pull request #99387 from 0x0ACB/direct_composition
Use direct composition for d3d12 backend
2024-11-26 13:04:53 -06:00
0x0ACB
a8cd0e9677
Use direct composition for d3d12 backend 2024-11-26 10:28:40 +01:00
Jamie Pate
45a7bcc477 Fix gl_compatibility lightmap uniforms not being set
Fixes #99592

The following variables were set too early, and later code never ran..
prev_shader, prev_variant, prev_spec_constants variables

These variables were shared in two different branch conditions but were
updated inside the first one, so the second could never be true..

The condition to update lighting also should check prev_spec_constants
since it updates that uniform.
2024-11-23 16:43:07 -08:00
Pāvels Nadtočajevs
e9b57fce82 Convert line breaks to \n and strip line break from the end of string returned by OS::read_string_from_stdin/OS::get_stdin_string. 2024-11-23 15:11:50 +02:00
Thaddeus Crews
dcb59f0e7e Merge pull request #99548 from Repiteo/style/clang-format-19-options
Style: Add 19.1.0 LLVM options to `.clang-format`
2024-11-22 14:54:29 -06:00
Thaddeus Crews
e8a4b45ce4
Style: Add 19.1.0 LLVM options to .clang-format 2024-11-22 09:24:32 -06:00
clayjohn
2b68c63a88 Mask out shadows on CanvasItems that don't have a matching item_shadow_mask
This restores the behavior from 3.x
2024-11-21 22:15:54 -08:00
Thaddeus Crews
030cc69771
Merge pull request #96399 from andyprice/fileperms
Unix: Don't create world-writable files when safe save is enabled
2024-11-21 17:56:53 -06:00
Thaddeus Crews
8eee5066eb
Merge pull request #94981 from Chaosus/shader_fix_screen_uv_in_spatial_light
Allow `SCREEN_UV` to be used in light function of spatial shader
2024-11-21 17:56:45 -06:00
Chaosus
a64b3fd3f8 Allow SCREEN_UV to be used in light function of spatial shader 2024-11-19 11:39:49 +03:00
Alexander Hartmann
8e170248b3 Fix: Error output is not require, VK_QUEUE_TRANSFER_BIT is optional. 2024-11-19 03:01:07 +01:00
Thaddeus Crews
fd4c29a189
Merge pull request #98683 from clayjohn/wireframe
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
🔗 GHA / 🪲 Godot CPP (push) Has been cancelled
Ensure shadow material and mesh are not used with wireframe mode
2024-11-18 09:23:54 -06:00
Thaddeus Crews
0a50cef751
Merge pull request #98788 from Bonkahe/master
Add `multimesh_get_buffer_rd_rid` method to `RenderingServer`.
2024-11-18 09:23:46 -06:00
Thaddeus Crews
1dcb686325
Merge pull request #99026 from Faless/net/split_ip
[Net] Split Unix/Windows IP implementation
2024-11-18 09:23:43 -06:00
Thaddeus Crews
2dbf195af5
Merge pull request #98983 from nikitalita/patch-2
Prevent stack-use-after-scope in rendering_device_driver_metal.mm
2024-11-18 09:23:33 -06:00
Thaddeus Crews
6330db475f
Merge pull request #87558 from clayjohn/GLES3-canvas-spec
Reduce shader permutations in the compatibility backend
2024-11-18 09:23:29 -06:00
A Thousand Ships
68f638cf02
Use (r)find_char instead of (r)find for single characters 2024-11-17 10:02:18 +01:00
clayjohn
90b4b48b5a Ensure shadow material and mesh are not used with wireframe mode
And in the Compatibility renderer actually use the wireframe render mode
2024-11-16 22:25:00 -08:00
clayjohn
c810ea4c1b Reduce shader permutations in the compatibility backend 2024-11-15 23:13:33 -08:00
Chris
fb75078308 Changed some image error messages to print the file path 2024-11-15 20:42:03 +01:00
Stuart Carnie
9c2ca820f2
Metal: Ensure position invariance is captured from SPIRV-Cross
Closes #99029
2024-11-15 14:06:32 +11:00
David House
6e9d31f602 Implemented multimesh_get_buffer_rd_rid function into RenderingServer.
Fixed style error.

Updated dummy mesh_storage to move from cpp to h the return of a blank Rid on _multimesh_get_buffer_rd_rid.
2024-11-14 15:52:08 -06:00
Thaddeus Crews
48d13ca11b
Merge pull request #99041 from mrsaturnsan/metal_frame_pacing
Use afterMinimumDuration to correct frame pacing
2024-11-14 14:51:49 -06:00
Thaddeus Crews
15d09a5767
Merge pull request #99149 from mrsaturnsan/set_max_fps_fix
Fix max FPS initialization
2024-11-13 08:34:21 -06:00
Thaddeus Crews
150590a7e8
Merge pull request #98975 from clayjohn/D3D12-event-timing
Move D3D12 fence `SetEventOnCompletion` call to `fence_wait` to avoid stalling on some platforms
2024-11-13 08:33:55 -06:00
Fabio Alessandrelli
fc52821cfb [Net] Properly rename NetSocketPosix to NetSocketUnix 2024-11-13 10:27:01 +01:00
mrsaturnsan
376c6c0c7d Use afterMinimumDuration to correct frame pacing 2024-11-12 21:19:38 -06:00
mrsaturnsan
4b94162320 Fix max FPS initialization
Remove unnecessary get_max_fps
2024-11-12 21:10:27 -06:00
Thaddeus Crews
179321a0a3
Merge pull request #91201 from bruvzg/con_type
[OS] Add functions to determine standard I/O device type.
2024-11-12 12:13:12 -06:00
Fabio Alessandrelli
168a2a1466 [Net] Split Unix/Windows IP implementation 2024-11-12 17:33:47 +01:00
Thaddeus Crews
1cbe9715ea
Merge pull request #98969 from Faless/net/split_sockets
[Net] Split Unix/Windows NetSocket implementation
2024-11-12 09:27:40 -06:00
tetrapod00
899f5151c3 Standardize terms for renderers in error strings
Use "Forward+", "Mobile", "Compatibility", and "renderer" or "rendering method".
2024-11-10 13:30:44 -08:00
Pāvels Nadtočajevs
c363e13051 [Windows] Rename PKEY_Device_FriendlyName to avoid duplicate symbols with newer MinGW SDKs. 2024-11-10 21:46:10 +02:00
Thaddeus Crews
246e8e9ecc
Merge pull request #98803 from stuartcarnie/metal_multiview
Metal: Multiview support
2024-11-10 12:13:02 -06:00
Thaddeus Crews
b80aa65467
Merge pull request #98927 from fire/warn-file-case-mismatch
Warn on filesystem case mismatch
2024-11-10 12:13:01 -06:00
Thaddeus Crews
bbde4ed324
Merge pull request #98883 from ducklin5/fix/VkResultError
Add vulkan error checks in command_queue_execute_and_present
2024-11-10 12:12:41 -06:00
Thaddeus Crews
2b02143d35
Merge pull request #98307 from clayjohn/Light2D-shadow-projection
Precompute projection matrices when rendering 2D shadows
2024-11-10 12:12:14 -06:00
Fabio Alessandrelli
0c620b29cd [Net] Split Unix/Windows NetSocket implementation 2024-11-10 16:13:50 +01:00
nikitalita
78895c709c
Prevent stack-use-after-scope in rendering_device_driver_metal.mm 2024-11-09 00:07:33 -06:00
Valentin Cocaud
c09731c413 Warn on filesystem case mismatch
When a file is opened with a wrong case, it can work on the developer system but break on a user system with a case-sensitive filesystem.

This will display a warning when it happens.

CAVEATS: It will also display the warning if a symlink is in the path.

Adapt warning if the file is a symlink. Avoid warning on symlinks.

Fix memory leak and avoid `lstat` usage.

Avoid exposing real_path when not in TOOLS_ENABLED mode.
2024-11-08 14:23:41 -08:00
clayjohn
05576a2324 Move D3D12 fence SetEventOnCompletion call to fence_wait to avoid stalling on some platforms 2024-11-08 13:20:05 -08:00
Pedro J. Estébanez
a5f86ee07e Raise the amount of file handles on Windows 2024-11-07 12:13:08 +01:00
Azeez Abass
ddf5c03f4b fix: add vulkan error checks in command_queue_execute_and_present
fix: add debug helper functoin and update messaging vulkan result
2024-11-06 22:13:20 +00:00
bruvzg
76164c2aa9
[OS] Add functions to determine standard I/O device type. 2024-11-06 13:33:38 +02:00
Stuart Carnie
3dac3887e9
Metal: Multiview support
* Adds support for multiview
* Returns native handles for more driver resources
2024-11-06 05:37:35 +11:00
Trevor Davenport
a5070af460 Account for the case surface_capabilities.currentExtent is unset
Wayland in particular sets surface_capabilities.currentExtent.width to
the special value 0xFFFFFFFF, which is valid per spec.
Fixes #98779

It may also fix misc issues when resizing on all platforms.

Superseedes PR #98780 , thanks to user tdaven for the original patch.
PR #98780 would break Android support as it did not account that width
and height might need to be swapped.

Replaced manual swap by Godot's SWAP(), which indicates intention much
easier.
2024-11-05 11:52:26 -03:00
Thaddeus Crews
88d9903f6d
Merge pull request #86138 from EnlightenedOne/master
Fix Frustum Sky projection translation logic shearing
2024-11-04 21:52:07 -06:00
Thaddeus Crews
2450dee1bc
Merge pull request #93401 from Repiteo/style/clang-tidy-fixes
Style: Apply `clang-tidy` fixes
2024-11-04 21:52:05 -06:00
Thaddeus Crews
8536506bf2
Merge pull request #98774 from dustdfg/scons_use_glob_remove_stale_check
Delete stale check, make SCons support globbing with `#` inside path
2024-11-04 21:52:02 -06:00
Thaddeus Crews
2b49543478
Merge pull request #98709 from darksylinc/matias-upsidedown-splash
Fix splash screen upside down on Android
2024-11-04 21:52:01 -06:00
Thaddeus Crews
edc60c63f1
Merge pull request #98701 from DarioSamo/rd-graph-improvements
Add dependency detection improvements to the render graph.
2024-11-04 21:51:58 -06:00
Thaddeus Crews
11b90086b7
Merge pull request #96705 from elmajime/camera_from_external_feed
Add support for external camera feed from external plugin on Android
2024-11-04 21:51:50 -06:00
Thaddeus Crews
bb5f390fb9
Style: Apply clang-tidy fixes (superficial)
• `modernize-use-bool-literals`, `modernize-use-nullptr`, and `readability-braces-around-statements`
2024-11-04 12:11:14 -06:00
Thaddeus Crews
89a311205f
Style: Apply clang-tidy fixes
• `modernize-use-default-member-init` and `readability-redundant-member-init`
• Minor adjustments to `.clang-tidy` to improve syntax & remove redundancies
2024-11-04 12:11:06 -06:00
EnlightenedOne
1d141ab32a Fix Frustum Sky projection translation logic, all pipelines, fixes 63863 2024-11-02 21:34:55 +00:00
Yevhen Babiichuk (DustDFG)
81a032337c Deleted stale check. Now SCons supports globbing with # inside path
Some parts of the buildsystem already were using it with `#` in path

Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
2024-11-02 22:20:17 +02:00
A Thousand Ships
ec650a2f09
[Core,Drivers] Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-11-01 16:50:11 +01:00
Dario
5216ef5f9c Add dependency detection improvements to the render graph.
- Buffers changing their usage are no longer treated as write usage unless the API requires it.
- Draw lists are not treated as being dependent on each other if their regions do not intersect despite both being write commands.
- Particles were tweaked to use different unused buffers to reduce dependencies.
2024-11-01 09:46:52 -03:00
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
maxime.chambefort
6f846eb5c5 Added external camera feed from external plugin on Android 2024-10-30 18:30:28 +01:00
clayjohn
940e9c2a43 Revert "Fix GPUParticles are not rendered for older AMD GPUs with OpenGL+Angle"
This reverts commit 9cc9df52eb.

This also adds a fallback to avoid using the Godot versions of the half 2 float functions when using ANGLE.
2024-10-29 22:17:16 -07:00
Thaddeus Crews
73830b3c12
Merge pull request #88628 from bruvzg/i_have_no_idea_what_im_doing
[macOS/iOS] Use hardware sampling rates for audio I/O.
2024-10-29 19:25:47 -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
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
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
Clay John
683d11a69f
Merge pull request #98279 from Calinou/vulkan-d3d12-silence-using-present-mode
Remove "Using present mode" verbose prints in Vulkan and Direct3D 12
2024-10-27 19:24:35 -07: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
Thaddeus Crews
07e759b74a
Merge pull request #97771 from dsnopek/openxr-linux-egl
OpenXR: Add support for Wayland on Linux
2024-10-25 13:04:08 -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
bruvzg
c8609f4c0f
[macOS/iOS] Use hardware sampling rates for audio I/O. 2024-10-25 19:26:24 +03: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
a1c7998d5f
Merge pull request #98305 from cadence-s/fix-ios-audio-driver-error
Fix iOS audio driver attempting to start output too early
2024-10-24 19:40:34 -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
Chaosus
463e81413e Make OUTPUT_IS_SRGB/CLIP_SPACE_FAR shader built-ins global 2024-10-24 12:32:05 +03:00
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
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
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
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
4630cbc487
Merge pull request #98212 from stuartcarnie/sgc/metal_improvements
Metal: Performance improvements and bug fixes
2024-10-21 16:39:09 -05: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
Stuart Carnie
83ac274e25
Metal: Performance improvements and bug fixes 2024-10-20 11:15:13 +11:00
clayjohn
62516df757 Precompute projection matrices when rendering 2D shadows 2024-10-18 11:55:00 -07:00
Cadence
b4fd9d1f38 Fix iOS audio driver attempting to start output too early 2024-10-18 13:05:30 -04: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
Hugo Locurcio
5ed10e3604 Remove "Using present mode" verbose prints in Vulkan and Direct3D 12
These messages were printed every time the swapchain was recreated
(e.g. on viewport size change), which could easily end up spamming
the output.

The chosen present mode is already displayed when using the Print FPS
project setting or command line argument.
2024-10-17 23:18:28 +02:00
Thaddeus Crews
bb20444998
Merge pull request #97744 from Nazarwadim/use_local_vector_for_skeleton
Use `LocalVector` for skeleton
2024-10-10 18:13:19 -05:00
Thaddeus Crews
16dfaa5e80
Merge pull request #94952 from alvinhochun/angle-d3d11-flip-y
Optimize ANGLE on D3D11 to remove an extra blit
2024-10-10 18:13:17 -05:00
Thaddeus Crews
a44f691fc7
CI: Add MinGW/GCC build to Windows GHA 2024-10-10 10:10:55 -05:00
Clay John
842f982397
Merge pull request #96819 from clayjohn/GLES3-instance-uniforms
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 instance uniforms in Compatibility renderer
2024-10-07 13:41:47 -06:00
Clay John
e7c39efdb1
Merge pull request #97309 from kroketio/metal-expose-device-handle
Metal: expose MTLDevice
2024-10-07 11:00:53 -06:00
David Snopek
256699ee31 OpenXR: Add support for Wayland on Linux 2024-10-04 11:44:05 -05:00