Commit Graph

2284 Commits

Author SHA1 Message Date
Thaddeus Crews 9700abd3ba Merge pull request #119123 from blueskythlikesclouds/group-task-for-shader-cache-load
Allow shader containers to be loaded in parallel.
2026-06-19 12:05:58 -05:00
Thaddeus Crews c85abe1020 Merge pull request #118973 from realkotob/kotob/arraymesh-expose-gdextension
Expose mesh surface RD buffer RIDs to GDExtension
2026-06-19 12:05:56 -05:00
Thaddeus Crews 82e7c213a4 Merge pull request #110911 from Kaleb-Reid/fix-clear-colour
Apply sky brightness multiplier in correct color space
2026-06-18 13:15:30 -05:00
Thaddeus Crews 1c518a8f87 Merge pull request #119342 from blueskythlikesclouds/uniform-set-texture-type-format-validation
Add error checks for texture type and storage format mismatches.
2026-06-18 13:15:29 -05:00
Thaddeus Crews 3408519fcc Merge pull request #120230 from clayjohn/multimesh-zero-initialize
Initialize multimesh buffers to 0
2026-06-18 13:15:29 -05:00
Thaddeus Crews aee86943d6 Merge pull request #119941 from blueskythlikesclouds/mv-two-frames-fix
Fix previous transform getting remembered for 2 frames after the instance stops moving.
2026-06-18 10:19:04 -05:00
Thaddeus Crews 99c4eac0c6 Merge pull request #119989 from ttencate/fix/generated_tangents_warning_106276
Suppress warning about missing mesh tangents if TANGENT is assigned in the shader
2026-06-18 10:19:04 -05:00
Thaddeus Crews 237cdd7158 Merge pull request #119792 from brycehutchings/shaderrd_variant_skip_fix
Seek past skipped shader variant payloads to avoid reading incorrect data
2026-06-18 10:19:03 -05:00
Thaddeus Crews eb316c6177 Merge pull request #119994 from blueskythlikesclouds/directional-light-zero-out
Zero out the memory of disabled directional lights.
2026-06-18 10:19:03 -05:00
Thaddeus Crews feeea39cb2 Merge pull request #120363 from blueskythlikesclouds/adreno-660-ubershader-workaround
Add workaround for Vulkan pipeline compilation errors on Adreno 660.
2026-06-17 12:34:23 -05:00
Thaddeus Crews 2301f36122 Merge pull request #120344 from bruvzg/area_light_shader_adreno
Inline `integrate_edge_hill` to work around Adreno shader compiler bug.
2026-06-17 12:34:16 -05:00
Skyth 823e2db6b1 Add workaround for Vulkan pipeline compilation errors on Adreno 660. 2026-06-17 15:39:27 +03:00
Pāvels Nadtočajevs 9fc8a9c0d8 Inline integrate_edge_hill to work around Adreno shader compiler bug. 2026-06-16 14:58:42 +03:00
Rangal 679b70a45f Fix the center of AreaLight3Ds being incorrect, per Sarcen on discord 2026-06-12 18:24:37 -07:00
clayjohn 34cdc6e43f Initialize multimesh buffers to 0 instead of letting them contain garbage data.
In the editor, we read back the data from the GPU to display the buffer values. So when we create the buffer uninitialized, we end up reading back garbage data and displaying it in the editor.

Many GPUs zero-initialize buffers by default, but it isn't guaranteed behaviour, so its best to initialize it ourselves to be safe
2026-06-11 22:18:56 -07:00
Skyth af2fea0ad3 Fix leftover particle data when updating particle buffers.
Co-authored-by:  Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
2026-06-11 21:02:05 +02:00
Skyth d9ea5c261e Add error checks for texture type and storage format mismatches. 2026-06-11 13:25:35 +03:00
HP van Braam 52f27370ab Fix a deadlock in CanvasRenderRD
RenderingServerDefault::_draw wants to get all of the materials. The threaded
loader is still loading the materials:

1) The main thread locks canvas_singleton->shader.mutex via
   RendererRD::Utilities::update_dirty_resources
    -> RendererRD::MaterialStorage::_update_queued_materials
      -> RendererCanvasRenderRD::CanvasMaterialData::update_parameters()
2) RendererCanvasRenderRD::CanvasMaterialData::update_parameters() wants
   to get the current shader via ShaderRD::version_get_shader. This
   eventually wants to wait on the load of that shader via
   WorkerThreadPool::wait_for_group_task_completion in
   ShaderRD::_compile_version_end

At this point the main thread is waiting for the threaded load to finish
loading the shader. Meanwhile in a thread not too far away the load is
progressing:

1) The loader is loading the tres in ResourceLoaderText::load which
   eventually wants to ShaderMaterial::set_shader
2) We eventually end up in RendererCanvasRenderRD::CanvasShaderData::set_code
3) set_code wants to lock canvas_singleton->shader.mutex to protect
   against concurrent compilation

At this point the main thread is waiting on the load to complete, but
holds "canvas_singleton->shader.mutex" via update_parameters(), and the
loader is waiting on "canvas_singleton->shader.mutex" in set_code.

Tragedy ensues etc.

To fix the problem we don't acquire the lock until after we're sure
we're done compiling the shader.

The same pattern exists in scene_shader_forward_clustered.cpp which
was created in the same commit as the code in the canvas singleton.

With this change the deadlock can no longer occur as set_code() can now run
concurrently with RenderingServerDefault::_draw() as the path where the
main thread waits on the workerthreadpool with
canvas_singleton->shader.mutex held can no longer occur.

Data integrity wise: previously you'd think that
canvas_singleton->shader.mutex would have protected against metadata
changes to uniforms, ubo_offsets, and texture_uniforms but set_code() used
to write to some of these (uniforms, ubo_size) without taking the lock with
no ill effects because the material isn't updated until the shader has loaded.

A similar pattern was found in scene_shader_forward_mobile.cpp and was
fixed in the same way.
2026-06-08 00:22:02 +02:00
Thomas ten Cate d3219bdf07 Suppress warning about missing mesh tangents if TANGENT is assigned in the shader
Fixes #106276
2026-06-03 20:17:12 +02:00
Skyth 2896cd9ef4 Fix area light atlas also destroying VoxelGI uniform sets. 2026-06-03 20:04:49 +03:00
Skyth f94049f8d8 Zero out the memory of disabled directional lights. 2026-06-03 18:35:21 +03:00
Skyth 48f9cf19af Put area light cluster iterations behind a spec constant. 2026-06-02 17:49:44 +03:00
Skyth adb14a5397 Fix previous transform getting remembered for 2 frames after the instance stops moving. 2026-06-02 00:46:11 +03:00
Pāvels Nadtočajevs 586d613f43 Fix drawable texture access before null check. 2026-06-01 09:35:34 +03:00
Kaleb Reid 50238693ef Apply sky brightness multiplier in correct color space 2026-05-27 13:18:20 -07:00
Bryce Hutchings 3e997dbc88 Seek past skipped shader variant payload 2026-05-26 11:13:38 -07:00
Thaddeus Crews 243f3537ed Merge pull request #119639 from blueskythlikesclouds/adreno-disable-ubershader
Disable ubershaders on problematic Adreno compiler versions.
2026-05-25 11:19:00 -05:00
Thaddeus Crews 4354aa9806 Merge pull request #116203 from blueskythlikesclouds/shader-race-condition-fix
Fix `MaterialStorage::material_set_shader` race condition.
2026-05-25 11:18:59 -05:00
Kotob M 7cbebab1d0 Expose ArrayMesh surface RD buffer RIDs to GDExtensions
Adds Mesh equivalents of `multimesh_get_buffer_rd_rid` so GPU-driven mesh
workflows in a GDExtension can write directly into a surface's vertex,
attribute, skin, or index buffer from a compute pipeline, avoiding the
CPU round-trip through `mesh_surface_update_*_region`.

A new `ARRAY_FLAG_USE_STORAGE_BUFFER` surface format flag opts the backing
buffers into storage-buffer usage so they can be bound in compute shaders.

Vulkan/D3D12/Metal only, OpenGL returns an invalid RID.
2026-05-25 18:35:01 +03:00
Skyth c6987624ef Disable ubershaders on problematic Adreno compiler versions. 2026-05-21 22:13:32 +03:00
Thaddeus Crews 1078619908 Merge pull request #119414 from clayjohn/legacy-fog-blend
Add project setting to disable new Volumetric fog blending behavior
2026-05-12 17:54:07 -05:00
Clay John c76223a35e Add project setting to disable new Volumetric fog blending behavior for existing projects that want to upgrade.
Setting is off by default, so its only intended for people who really need to rollback to the previous behavior.
2026-05-12 10:48:46 -07:00
Thaddeus Crews 872f2f073c Merge pull request #119337 from blueskythlikesclouds/sdfgi-barrier-fix
Fix undefined barrier usage in SDFGI preprocess shader.
2026-05-11 10:59:47 -05:00
Skyth c22117dacd Fix null uniform set error when enabling SDFGI. 2026-05-08 17:28:22 +03:00
Skyth 0bba587614 Fix undefined barrier usage in SDFGI preprocess shader. 2026-05-08 17:10:58 +03:00
Thaddeus Crews aaaf76403e Merge pull request #119223 from Calinou/render-timestamp-add-setup-shadows
Add Setup Shadows render timestamp for the visual profiler
2026-05-07 16:22:28 -05:00
Thaddeus Crews ce26629ff5 Merge pull request #119230 from stuartcarnie/compute_barrier_before_end
Rendering: Remove `compute_list_add_barrier` before `compute_list_end`
2026-05-07 16:22:28 -05:00
Stuart Carnie 64a1a66a14 Rendering: Zero double InstanceData fields
Root cause was unitinitialised stack variable.

I was able to reproduce by enabling this build-flag:

```
-ftrivial-auto-var-init=pattern
```

which initialises stack allocated variables with hostile values.

Closes #118918
2026-05-07 19:06:42 +10:00
Stuart Carnie 0b561521fe Rendering: Remove compute_list_add_barrier before compute_list_end
`compute_list_add_barrier` ends and begins a new compute list with the
same state, so calling this immediately before `compute_list_end` is
redundant, and ends up creating empty compute encoders in Metal.
2026-05-05 06:41:06 +10:00
Hugo Locurcio 376bea65e0 Add Setup Shadows render timestamp for the visual profiler
- Rename shadow timestamp to clarify it's for directional and spot shadows.
- Fix Render OmniLight Shadows timestamp being visible even when no
  omnilight shadows are being rendered.
2026-05-04 19:30:14 +02:00
Skyth d751f5bbfb Allow shader containers to be loaded in parallel. 2026-05-04 18:09:53 +03:00
Thaddeus Crews f059d64e3d Merge pull request #118968 from CookieBadger/area-light-lut-textures
Fix GPU validation errors due to area light LUT format
2026-04-30 10:58:09 -05:00
Thaddeus Crews 179899680b Merge pull request #118198 from viksl/volumetric-fog-nan-handling-reprojected
Filter and sanitize volumetric fog to stop invalid values flooding the screen with black pixels through temporal reprojection.
2026-04-30 10:58:06 -05:00
Skyth f379b84004 Fix material_set_shader race condition. 2026-04-29 17:31:24 +03:00
LiveTrower 936d67b7c7 Fix area light texture color conversion 2026-04-28 10:54:57 -06:00
CookieBadger 7c532acc09 change LTC lookup table texture format to RGBAF and set p_8bit_dst to true in gaussian_blur 2026-04-27 21:35:46 +02:00
Thaddeus Crews 75444feae7 Merge pull request #118857 from LiveTrower/clearcoat-reflection-fixes
Fix and clean up clearcoat reflection probe process
2026-04-27 12:05:47 -05:00
LiveTrower 4b94f459f4 Fix and cleanup clearcoat reflection probe process 2026-04-24 16:04:41 -06:00
LiveTrower 5dac818f77 Fix clearcoat intensity for area lights 2026-04-22 13:07:53 -06:00
Thaddeus Crews 0e25644655 Merge pull request #118796 from deralmas/gotta-go-wrap
Buildsystem: Simplify `format_buffer` utility method
2026-04-22 09:58:29 -05:00