1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00
Commit Graph

1794 Commits

Author SHA1 Message Date
kobewi
10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +01:00
Thaddeus Crews
70d37274aa Merge pull request #60178 from Calinou/directional-shadow-normal-bias-split
Use lower shadow normal bias for distant directional shadow splits
2025-03-17 10:52:13 -05:00
Lukas Tenbrink
f4de2cd22a Use resize_zeroed instead of resize then fill(0) in several places. 2025-03-14 12:09:39 +01:00
Thaddeus Crews
701505eb4f Merge pull request #104044 from bruvzg/rd_pipeline_err_spam
Fix `Invalid Task ID` error spam in `PipelineHashMapRD`.
2025-03-13 08:57:45 -05:00
Thaddeus Crews
c1b7865ae9 Merge pull request #103557 from aaronfranke/godot-version-defines
Rename version defines to `GODOT_VERSION_*` to match GDExtension godot-cpp
2025-03-13 08:57:42 -05:00
Stuart Carnie
5e1fe8040a rendering: compositor has is_opengl API; minor optimisations 2025-03-13 15:41:44 +11:00
Aaron Franke
97ee05e9b7 Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp 2025-03-12 11:11:38 -07:00
Pāvels Nadtočajevs
047afb1b1d Fix Invalid Task ID error spam in PipelineHashMapRD. 2025-03-12 19:59:13 +02:00
Thaddeus Crews
2f5f3c9a5a Merge pull request #103617 from stuartcarnie/fix_texture_pixel_size
2D: Fix light shader accessing `TEXTURE_PIXEL_SIZE`
2025-03-12 10:31:50 -05:00
Thaddeus Crews
15a5a2f309 Merge pull request #103766 from BlueCube3310/basisu-hdr-astc
BasisUniversal: Ensure ASTC's HDR variant is supported when transcoding
2025-03-12 10:31:49 -05:00
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
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
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
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
clayjohn
5efcd64b23 Reduce per-frame memory allocations from the heap in the Mobile renderer. 2025-03-07 22:01:24 -08: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
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
BlueCube3310
4d46ef8e8e BasisUniversal: Ensure ASTC's HDR variant is supported when transcoding 2025-03-07 15:26:03 +01: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
Stuart Carnie
b3694662a2 2D: Fix light shader accessing TEXTURE_PIXEL_SIZE 2025-03-06 05:30:20 +11: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
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
5c3e7280f4 Merge pull request #103506 from bruvzg/shader_pool
Use separate WorkThreadPool for shader compiler.
2025-03-05 12:07:34 -06: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
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
Michael Alexsander
aea559b39a Allow to compile the engine without XR support 2025-02-25 17:07:21 -03:00
LuoZhihao
5ca3862636 Shaders: Only convert default value to linear color if type is source_color 2025-02-23 12:35:53 +08:00
Matias N. Goldberg
8888f9e649 Fix uninitialized value in Tonemap
And anything that uses luminance.

The class Luminance in luminance.cpp is in charge of averaging the
luminance of all pixels.
It performs multiple passes until it reaches a 1x1 texture containing
the total average. This is standard luminance averaging on GPU.

Then the "result" of this frame and the "prev_frame_result" are averaged
together at a certain speed to mimic eye adaptation.

Then this avarege becomes the "source" for the next frame. This is done
here:

```cpp
SWAP(p_luminance_buffers->current,
p_luminance_buffers->reduce.write[p_luminance_buffers->reduce.size() -
1]);
```

So far pretty normal stuff.

**The problem is: prev_frame_result IS UNINITIALIZED**. Therefore it's
possible for prev_frame_result to contain garbage values like -5+e15
which causes the screen to stay black for a minute until eye adaptation
catches up.

Windows will always force allocations to be reset to 0, but Linux does
not do that.
However Windows just delays the bug; because it's possible for VMA to
reuse a block.

You can repro this bug by downloading Bistro, creating a camera,
selecting a default scene; and then launching Bistro.

Everything will work fine.
Until you decide to resize the window. It takes a few tries on Godot,
but eventually the screen becomes black.

If you wait around a minute, the screen will "unblack" itself back to
normal.

Even if it's not stuck in black after resize, you may notice that every
resize is inconsistent in how the eye adaptation catches up (i.e.
sometimes it flashes to white, sometimes it does not).

If you can't repro the bug, you need to try harder by doing arbitrary
resizes until it triggers.
Also, I advise to try this on Linux; since Windows' sanitization of
memory gets in the way.

There's probably multiple tickets already filled around issues that were
rooted in luminance calculations starting from uninitialized memory.

This PR sets a default value of 0, which causes the screen to always
flash white after resize. Setting a different value like 0.1 makes the
flash effect weaker. Setting it to a high value like 5.0 makes the
screen flash from dark instead.

This bug can be backported to 4.3. I don't know if it can be backported
to earlier; as the render graph makes sure the texture_clear() calls
gets issued in the right place; whereas in <= 4.2 it might be
problematic depending on when Luminance::LuminanceBuffers::configure is
being called.
2025-02-20 16:51:41 -03:00
kleonc
2bb6ad5cdf Fix debug CanvasItem redraw rects in RD renderer 2025-02-18 23:49:43 +01:00
kleonc
b691a997a3 Fix render info primitive count per TRIANGLE_STRIP 2025-02-15 23:50:07 +01:00
Thaddeus Crews
b607110ad2 Merge pull request #102792 from clayjohn/varying-crash
Validate varying count when compiling shaders
2025-02-14 08:25:39 -06:00