1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00
Commit Graph

2824 Commits

Author SHA1 Message Date
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
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
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
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
Chaosus
946c254cec Fix crash at using increment op for varying in light shader function 2025-02-15 17:37:18 +03: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
clayjohn
35100396e4 Validate varying count when compiling shaders
This avoids crashing on devices when a number of varyings greater than the device limit is used.

For now this accurately prints an error when compiling the shader, but the error text only pops up in the editor if the number of user varyings is above the limit.
2025-02-13 15:07:15 -08:00
Rémi Verschelde
54006f6ebf Merge pull request #102217 from clayjohn/mobile-pipelines
Reduce mobile pipeline compilations
2025-02-13 23:34:54 +01:00
Thaddeus Crews
1a0bf54677 Merge pull request #102805 from BlueCube3310/rd-tex-fetch-fix
RenderingDevice: Fix certain RD to Image format conversions
2025-02-13 10:15:47 -06:00
BlueCube3310
27c4e70ee8 RenderingDevice: Fix certain RD to Image format conversions 2025-02-13 10:44:10 +01:00
Matias N. Goldberg
4712d426ef Fix broken skeletal animated meshes
Fixes #102791
2025-02-12 22:25:22 -03:00
Thaddeus Crews
78f1918bd4 Merge pull request #102668 from jkirsteins/janiskirsteins/ios-aspect-fill-splash
[iOS] Sync the boot splash and the launch screen image scale modes
2025-02-12 12:56:26 -06:00
Thaddeus Crews
1939e87db1 Merge pull request #101561 from darksylinc/matias-device-address-api
Change how device address is requested to avoid future API breakage
2025-02-12 12:56:25 -06:00
Jānis Kiršteins
0e266b0099 [iOS] Sync the boot splash and the launch screen image scale modes 2025-02-12 17:41:18 +01:00
Matias N. Goldberg
af900a5825 Change how device address is requested to avoid future API breakage
PR #100062 introduced BUFFER_USAGE_DEVICE_ADDRESS_BIT.

However it did so by adding a boolean to uniform_buffer_create(), called
"bool p_enable_device_address".

This makes maintaining backwards compatibility harder because I am
working on another feature that would require introducing yet another
bit flag.

This would save us the need to add fallback routines when the feature I
am working on makes it to Godot 4.5.

Even if my feature doesn't make it to 4.5 either, this PR makes the
routine more future-proof.

This PR also moves STORAGE_BUFFER_USAGE_DEVICE_ADDRESS into
BUFFER_CREATION_DEVICE_ADDRESS_BIT, since it's an option available to
both storage and uniforms.

This PR also moves the boolean use_as_storage into
BUFFER_CREATION_AS_STORAGE.
2025-02-11 20:00:18 -03:00
Rémi Verschelde
cfe0fd62d0 Merge pull request #102677 from stuartcarnie/free_invalid_id
2D: Fix free of invalid ID
2025-02-11 23:59:19 +01:00
Rémi Verschelde
d967d8d9bd Merge pull request #102280 from Chaosus/fix_particles_process_shader_crash
Fix crash when assigning wrong shader to particle process material
2025-02-11 23:58:56 +01:00
Stuart Carnie
90b2d4b844 2D: Fix free of invalid ID 2025-02-11 08:17:29 +11:00
Rémi Verschelde
d497631de0 Merge pull request #102503 from clayjohn/instance-uniform-free
Ensure instance uniforms are freed by updating dirty items before freeing
2025-02-07 01:40:05 +01:00
Rémi Verschelde
0bccb0abd1 Merge pull request #102497 from BlueCube3310/mesh-uv-render-compressed-fix
Fix rendering material when UV2 is compressed
2025-02-07 01:40:02 +01:00
Rémi Verschelde
46aeded4b7 Merge pull request #102480 from DarioSamo/dont-unroll-ubershader
Add loop annotations to ubershaders to prevent loop unrolling.
2025-02-07 01:39:48 +01:00
Rémi Verschelde
c695eb9159 Merge pull request #101952 from Flarkk/fix_spotlight_peterpanning_regression
Fix shadow peter-panning with default spotlight
2025-02-07 01:39:15 +01:00
clayjohn
b676944dcf Ensure instance uniforms are freed by updating dirty items before freeing. 2025-02-06 14:45:55 -08:00
BlueCube3310
8714b36171 Fix rendering material when UV2 is compressed 2025-02-06 20:24:46 +01:00
Dario
d39ac94c41 Add loop annotations to ubershaders to prevent loop unrolling. 2025-02-06 09:39:18 -03:00
clayjohn
7444839299 Reduce mobile pipeline compilations by tracking more feature usage globally and only compile what is needed 2025-02-05 18:27:23 -08:00
Dario
1bba9dbce9 Fix erroneous logic when flushes are involved on RD async methods. 2025-02-05 09:49:15 -03:00
Rémi Verschelde
a9fa4fd7b9 Merge pull request #101642 from huwpascoe/fix_source_color
Shaders: Fix `source_color` default value
2025-02-05 11:33:54 +01:00
Thaddeus Crews
ea2770eb4f Merge pull request #101947 from Rudolph-B/Issue-101750
Add Heightfield mask to GPUParticlesCollisionHeightField3D
2025-02-04 09:04:11 -06:00
Rudolph Bester
b162c59097 Fix GPUParticlesCollisionHeightField3D adding collisions excluded by its layer_mask
Co-authored-by: Yahia Zakaria <yahiazakaria13@gmail.com>
2025-02-04 08:02:44 +02:00
Thaddeus Crews
f230b9cb12 Merge pull request #102261 from clayjohn/dummyrs-mesh-dependency
Track mesh dependencies in Dummy RenderingServer
2025-02-03 08:16:09 -06:00
Chaosus
53e6d30771 Fix crash when assigning wrong shader to particle process material 2025-02-01 15:12:02 +03:00
clayjohn
6611c863bd Use a smaller epsilon for omni and spot attenuation cutoff
We just want to avoid calculating shadows when the attenuation is zero, so we should use the smallest epsilon we can get away with
2025-01-31 17:08:23 -08:00
clayjohn
258d4d5c3d Track mesh dependencies in Dummy RenderingServer to properly resolve freeing MeshInstances 2025-01-31 12:57:10 -08:00
Chaosus
570e59df3d Fix shader uniforms has null as default value 2025-01-31 07:35:51 +03:00
Thaddeus Crews
ee4acfbfbf Merge pull request #95669 from kleonc/y_sort_fix_root_double_modulate
Fix Y-sorted root item having modulation applied twice
2025-01-29 17:45:20 -06:00