Commit graph

5843 commits

Author SHA1 Message Date
Thaddeus Crews
d7d85db701
Merge pull request #103889 from clayjohn/rd-allocations-cleanup
Clean up more dynamic allocations in the RD renderers with a focus on 2D
2025-03-11 14:00:38 -05:00
Thaddeus Crews
a77a28c029
Merge pull request #101971 from clayjohn/sky-light-size-fix
Pass angular diameter into light size constants for sky shaders.
2025-03-11 09:35:09 -05:00
Thaddeus Crews
0fb0804546
Merge pull request #103641 from darksylinc/matias-mobile-shadows-update
Fix inefficient upload in Mobile Shadows
2025-03-11 09:35:05 -05:00
Thaddeus Crews
85f9c46713
Merge pull request #103880 from 100gold/fix_deadlock_on_pipelinehashmaprd
Fix deadlock between `PipelineHashMapRD::local_mutex` and `GDScriptCache::mutex`
2025-03-11 09:35:02 -05:00
clayjohn
4cf9d58dce Clean up more dynamic allocations in the RD renderers with a focus on 2D. 2025-03-10 13:16:12 -07:00
Thaddeus Crews
3d5a74cc48
Merge pull request #103897 from bruvzg/as_leak
Fix AudioServer missing deletes.
2025-03-10 10:01:09 -05:00
Thaddeus Crews
8d1c1c5867
Merge pull request #92476 from AThousandShips/string_remove_char
Add `String::remove_char(s)` methods for performance and convenience
2025-03-10 10:01:04 -05:00
100gold
477b6451a0 fix deadlock between PilelineHashMapRD::local_mutex and GDScriptCache::mutex 2025-03-10 17:48:28 +03:00
A Thousand Ships
331a43a9d8
Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
Pāvels Nadtočajevs
28a696979d
Fix AudioServer missing deletes. 2025-03-10 12:00:53 +02:00
Lukas Tenbrink
605b62cd29 Add Span struct (replacing StrRange). Spans represent read-only access to a contiguous array, resembling std::span. 2025-03-09 18:19:51 +01:00
Thaddeus Crews
cae3d722a3
Merge pull request #99321 from AThousandShips/use_get_slicec
Use `get_slicec` instead of `get_slice` for single character splitters
2025-03-09 09:05:29 -05:00
Thaddeus Crews
629b6767e6
Merge pull request #103778 from darksylinc/matias-xr-disabled-fix
Fix build errors when building with `disable_xr=yes`
2025-03-09 09:05:26 -05:00
Thaddeus Crews
bf6031890e
Merge pull request #103814 from darksylinc/matias-update_perf_report-speedup
RenderingDevice: Delay expensive operations to `get_perf_report`
2025-03-09 09:05:24 -05:00
Thaddeus Crews
dfdb5359ea
Merge pull request #103547 from clayjohn/forward-plus_instance_data_optimize
Optimize `_fill_instance_data` function in Forward+ renderer.
2025-03-09 09:05:19 -05:00
A Thousand Ships
466590d0ec
Use get_slicec instead of get_slice for single character splitters 2025-03-08 20:36:37 +01:00
Matias N. Goldberg
21133425cc Delay expensive operations to get_perf_report
The function update_perf_report() is expensive and is called every
frame.
Most of it is not necessary unless the user calls get_perf_report

Affects #102173
2025-03-08 11:25:46 -03:00
clayjohn
5efcd64b23 Reduce per-frame memory allocations from the heap in the Mobile renderer. 2025-03-07 22:01:24 -08:00
Matias N. Goldberg
860f1da3b8 Fix build errors when building with disable_xr=yes
Building with the following params (note: scu_build is enabled):

```
platform=linuxbsd builtin_embree=yes builtin_enet=no
builtin_freetype=yes builtin_graphite=yes builtin_harfbuzz=yes
builtin_libogg=no builtin_libpng=yes builtin_libtheora=no
builtin_libvorbis=no builtin_libwebp=no builtin_miniupnpc=no
builtin_pcre2=no builtin_zlib=yes builtin_zstd=no linker=mold
optimize=none debug_symbols=True tests=True dev_mode=True dev_build=True
use_llvm=yes use_lld=yes opengl3=no openxr=no disable_xr=yes -j 24
scu_build=yes scu_limit=256
```

Results in compiler errors:

```
In file included from servers/register_server_types.cpp:99:
servers/xr/xr_interface.h:52:7: error: redefinition of 'RefCounted'
   52 | class XRInterface : public RefCounted {
      |       ^
./servers/rendering/rendering_method.h:40:21: note: expanded from macro
'XRInterface'
   40 | #define XRInterface RefCounted
      |                     ^
./core/object/ref_counted.h:37:7: note: previous definition is here
   37 | class RefCounted : public Object {
      |       ^
```

This happens because of:

```
#ifdef XR_DISABLED
// RendererSceneCull::render_camera is empty when 3D is disabled, but
// it and RenderingMethod::render_camera have a parameter for
XRInterface.
#define XRInterface RefCounted
#else
#include "servers/xr/xr_interface.h"
#endif // XR_DISABLED
```

In rendering_method.h
2025-03-07 21:13:09 -03:00
clayjohn
574f5126a2 Optimize _fill_instance_data function in Forward+ and Mobile renderers.
This batches together a couple of micro-optimizations that were discovered in profiling and analyzing disassembly.

Importantly, this reduces the amount of instructions in a heavy loop. This has the biggest impact when there are lots of objects and lights in the scene as the function is called once per objects + once per light that touches the object
2025-03-07 15:44:53 -08:00
Thaddeus Crews
324512e11c
Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Thaddeus Crews
7459a0361d
Merge pull request #103177 from Murrent/shader_default_at_top
Allow `default` case at the top of a switch scope in shaders
2025-03-07 15:12:55 -06:00
Thaddeus Crews
67d4a245d8
Merge pull request #103267 from YeldhamDev/reality_got_too_extended
Allow to compile the engine without XR support
2025-03-07 15:12:54 -06:00
Thaddeus Crews
3c43508ed7
Merge pull request #102427 from AThousandShips/fix_substr
Clean up some uses of `String::substr`
2025-03-07 15:12:33 -06:00
Thaddeus Crews
c937b6d180
Merge pull request #102419 from Ivorforce/std-size
Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase.
2025-03-07 15:12:25 -06:00
A Thousand Ships
5113022dfe
Clean up some uses of String::substr
Cases where the end position is either equvalent to the default or past
the end of the string.
2025-03-07 14:50:38 +01:00
Thaddeus Crews
5e77d93781
Merge pull request #98194 from bruvzg/fd_parent
Improve native file dialog parent window selection.
2025-03-06 16:36:27 -06:00
Thaddeus Crews
b6ece17de1
Merge pull request #103529 from clayjohn/RD-trivial-instance-data
Validate triviality of InstanceData struct in Mobile and Forward+ renderers
2025-03-06 16:36:14 -06:00
Thaddeus Crews
4bafafaeb3
Merge pull request #102777 from darksylinc/matias-astc-hdr
Add ASTC HDR format variants
2025-03-06 16:36:06 -06:00
bruvzg
3e4e6e6c0c Improve native file dialog parent window selection. 2025-03-06 17:15:39 +02:00
Matias N. Goldberg
e605ad93c7 Fix inefficient upload in Mobile Shadows
Clustered performs the following shadow rendering steps

1. Process objects [0; 10) for cascade 0.
2. Process objects [10; 30) for cascade 1.
3. Process objects [30; 100) for cascade 2.
4. Upload objects [0; 100) to GPU.
5. Draw all cascades.

Mobile was supposed to be doing the same, but instead was doing:

1. Process objects [0; 10) for cascade 0.
2. Upload objects [0; 10) to GPU.
3. Process objects [10; 30) for cascade 1.
4. Upload objects [0; 30) to GPU.
5. Process objects [30; 100) for cascade 2.
6. Upload objects [0; 100) to GPU.
7. Draw all cascades.

That is, always reuploaded everything from scratch.
Therefore it pointlessly (and with geometric growth) wasted BW.
2025-03-05 15:21:25 -03:00
Thaddeus Crews
113fc5a647
Merge pull request #102648 from bruvzg/el_force
Expose `OVERRUN_ENFORCE_ELLIPSIS` flag to the controls.
2025-03-05 12:07:55 -06:00
Thaddeus Crews
77231d81b4
Merge pull request #102514 from bruvzg/ts_wrp_indent
[TextEdit] Improve wrapped line indent handling.
2025-03-05 12:07:52 -06:00
Thaddeus Crews
729c4e9e88
Merge pull request #102905 from kleonc/render_info_fix_primitive_count_per_triangle_strip
Fix render info primitive count per `TRIANGLE_STRIP`
2025-03-05 12:07:47 -06:00
Thaddeus Crews
9911baec70
Merge pull request #103531 from darksylinc/matias-mobile-shadows-update
Fix inefficient upload in Mobile Shadows
2025-03-05 12:07:42 -06:00
Thaddeus Crews
8777f088cc
Merge pull request #103348 from huwpascoe/render_params_fix
Fix 2D instance params crashing using outside of `main()`
2025-03-05 12:07:39 -06:00
Thaddeus Crews
eda3467b6f
Merge pull request #103560 from bruvzg/rd_helper_l
[Linux/BSD] Offload RenderingDevice creation test to subprocess.
2025-03-05 12:07:37 -06:00
Thaddeus Crews
5c3e7280f4
Merge pull request #103506 from bruvzg/shader_pool
Use separate WorkThreadPool for shader compiler.
2025-03-05 12:07:34 -06:00
Pāvels Nadtočajevs
6ed12bfc5d [Linux/BSD] Offload RenderingDevice creation test to subprocess. 2025-03-04 13:18:26 +02:00
Rémi Verschelde
6536f5f2df
Merge pull request #103480 from beicause/rd-validate-pre-raster-shader
RenderingDevice: Validate pre-raster (vertex) shader in `render_pipeline_create`
2025-03-04 01:02:35 +01:00
Rémi Verschelde
d831381296
Merge pull request #103092 from darksylinc/matias-luminance-uninit
Fix uninitialized value in Tonemap
2025-03-04 01:00:38 +01:00
Rémi Verschelde
daa28e8338
Merge pull request #95912 from etodd/particle-pause-jitter-fix
Fix particle jitter when scene tree is paused
2025-03-04 01:00:10 +01:00
Matias N. Goldberg
62c1a4782d Fix inefficient upload in Mobile Shadows
Clustered performs the following shadow rendering steps

1. Process objects [0; 10) for cascade 0.
2. Process objects [10; 30) for cascade 1.
3. Process objects [30; 100) for cascade 2.
4. Upload objects [0; 100) to GPU.
5. Draw all cascades.

Mobile was supposed to be doing the same, but instead was doing:

1. Process objects [0; 10) for cascade 0.
2. Upload objects [0; 10) to GPU.
3. Process objects [10; 30) for cascade 1.
4. Upload objects [0; 30) to GPU.
5. Process objects [30; 100) for cascade 2.
6. Upload objects [0; 100) to GPU.
7. Draw all cascades.

That is, always reuploaded everything from scratch.
Therefore it pointlessly (and with geometric growth) wasted BW.
2025-03-03 19:57:27 -03:00
clayjohn
1bdb3bc88a Validate triviality of the InstanceData and RenderElementInfo structs in Mobile and Forward+ renderers.
This is needed to avoid overhead that results from calling the constructor during calls to LocalVector.resize()
2025-03-03 14:38:37 -08:00
Pāvels Nadtočajevs
53bb897458 Use separate WorkThreadPool for shader compiler. 2025-03-03 22:28:39 +02:00
LuoZhihao
808c9fbcc5 RenderingDevice: Validate pre-raster (vertex) shader in render_pipeline_create 2025-03-03 05:19:55 +08:00
yesfish
93bc18f2b0 Fix 2D instance params crashing using outside of main() 2025-02-27 22:10:56 +00:00
Rémi Verschelde
a9c5c4db71
Merge pull request #103201 from beicause/shaders-only-convert-source-color-linear
Shaders: Only convert default value to linear color if type hint is `source_color`
2025-02-27 19:34:12 +01:00
Evan Todd
87efa4d210 Fix particle jitter when scene tree is paused. 2025-02-27 08:40:40 -08:00
David Snopek
a285d1aa98 texture_create_from_native_handle() should return RID for texture from RenderingServer, not RenderingDevice 2025-02-25 14:20:33 -06:00