Commit Graph

437 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Rémi Verschelde 408d07109b
Merge pull request #99551 from DarioSamo/fragment-density-map
Implement Fragment density map support.
2025-03-28 14:31:19 +07:00
Dario 76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 +07: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 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 +07: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 +07:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 +07: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 +07: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 +07:00
kleonc b691a997a3 Fix render info primitive count per TRIANGLE_STRIP 2025-02-15 23:50:07 +07: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 +07:00
Thaddeus Crews 4b9f88280b
Merge pull request #102122 from DarioSamo/default-sdfgi-fix
Fix default SDFGI variant not being compiled in time.
2025-01-29 17:45:17 +07:00
Thaddeus Crews 7e97ada3b7
Merge pull request #102125 from DarioSamo/ubershader-thread-priority
Mark pipeline compilation of ubershaders as high priority.
2025-01-29 17:45:16 +07:00
DarioSamo 5c7fd16eea Fix framebuffer clear for particle collider heightfield. 2025-01-28 14:22:30 +07:00
Dario d0c29faa15 Mark pipeline compilation of ubershaders as high priority. 2025-01-28 11:40:05 +07:00
Dario 655e98b2ea Fix default SDFGI variant not being compiled in time. 2025-01-28 10:24:46 +07:00
Matias N. Goldberg 7b2f1e1d09 Fix union order to simplify empty initializers
This is a followup to PR #101344 (commit
0e06eb80bc).

Some of them were not an issue because Godot was initializing all
members, but they were "fixed" just in case since it could become a
problem in the future.

Valgrind was specifically complaining about HashMapData &
GlobalPipelineData.
2025-01-14 19:05:01 +07:00
David House e6daec9cf8 Added indirect drawing functionality to MultiMesh
Update doc/classes/RenderingServer.xml

Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com>
2025-01-13 14:51:51 +07:00
Rémi Verschelde 3014eec40d Merge pull request #99407 from devloglogan/rec-resolution
Allow using custom `Rect2i` for rendering with OpenXR
2025-01-10 23:05:46 +07:00
devloglogan e7f6b7ea0b Allow using custom Rect2i for rendering with OpenXR 2025-01-09 09:46:15 +07:00
Dario 0e06eb80bc Fix union order to simplify empty initializers. 2025-01-09 10:39:13 +07:00
Rémi Verschelde 21fdf1678a Merge pull request #101193 from clayjohn/FSR-y-aspect
Correct aspect ratio used in FSR2 calculations
2025-01-07 23:18:04 +07:00
clayjohn 25a9b04ecc Correct aspect ratio used in FSR2 calculations to remove a source of depth-based ghosting 2025-01-06 14:00:58 +07:00
Stuart Carnie 11dc4f2e5e Metal: Add MetalFX upscaling support
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-01-06 06:03:18 +07:00
Yufeng Ying e88e30c273 Remove unused headers in servers.
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2024-12-20 18:51:01 +07:00
Thaddeus Crews 2fcd8223e8
Merge pull request #99538 from Geometror/lightmap-gi-transparent-surface
Add transparency support for LightmapGI
2024-12-19 19:59:52 +07:00
Alex Threlfo 5f617663aa fix: separate sky luminance and user brightness calculations around fog 2024-12-20 11:25:11 +07:00
Hendrik Brucker a3525bc015 Add transparency support for LightmapGI
Co-authored-by: Guerro323 <kaltobattle@gmail.com>
2024-12-18 19:36:16 +07: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 +07:00
Thaddeus Crews dc5f1b7a28
Merge pull request #100319 from Flarkk/fix_light_shadow_range
Fix shadows of long range `OmniLight3D` and `SpotLight3D`
2024-12-13 16:19:39 +07:00
Thaddeus Crews 6594a6364e
Merge pull request #100213 from DarioSamo/pipeline-hash-map-thread-safety
Improve thread-safety of pipeline hash map.
2024-12-13 16:19:34 +07: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 +07:00
Florent Guiocheau 5125adf40b Fix large range point lights shadows 2024-12-12 15:37:38 +07:00
BlueCube3310 189c8eb671 Implement shadowmasks for LightmapGI
Co-authored-by: dearthdev <nathandearthdev@gmail.com>
2024-12-12 11:00:28 +07:00
clayjohn fce34f22a2 Avoid error spam when shaders fail to compile by freeing shader_data version when compilation fails 2024-12-09 10:51:57 +07:00
Dario be1dce1071 Improve thread-safety of pipeline hash map. 2024-12-09 15:12:40 +07:00
CrazyRoka d9ef826c54
Optimize RenderForwardClustered::_setup_render_pass_uniform_set by reducing Vector allocations during push_back operations 2024-12-02 15:03:50 +07:00
Dario 6d5ac8f7ef Resolve load and store ops automatically for render passes for discardable textures. 2024-11-25 11:27:48 +07:00
clayjohn 02efdb28dc Unify y-flip behavior for sky in RD backends 2024-11-19 16:59:04 +07: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 +07:00
Thaddeus Crews 88d9903f6d
Merge pull request #86138 from EnlightenedOne/master
Fix Frustum Sky projection translation logic shearing
2024-11-04 21:52:07 +07:00
Dario 53099c56f0 Add multiple specialization constants to Forward+ and Mobile. 2024-11-04 14:35:40 +07:00
EnlightenedOne 1d141ab32a Fix Frustum Sky projection translation logic, all pipelines, fixes 63863 2024-11-02 21:34:55 +07:00
Dario 427ba09efc Fix soft shadows by increasing the bit count for specialization constants. 2024-10-28 10:26:50 +07:00
Chaosus 463e81413e Make `OUTPUT_IS_SRGB/CLIP_SPACE_FAR` shader built-ins global 2024-10-24 12:32:05 +07:00
Dario e2c6daf7ef Implement asynchronous transfer queues, thread guards on RenderingDevice. Add ubershaders and rework pipeline caches for Forward+ and Mobile.
- Implements asynchronous transfer queues from PR #87590.
- Adds ubershaders that can run with specialization constants specified as push constants.
- Pipelines with specialization constants can compile in the background.
- Added monitoring for pipeline compilations.
- Materials and shaders can now be created asynchronously on background threads.
- Meshes that are loaded on background threads can also compile pipelines as part of the loading process.
2024-10-02 15:11:58 +07:00
ywmaa 0a9ad8f9de
Implement vertex shading
This adds support in all backends, but the Compatibility renderer works the best.
Mobile and Forward+ can only support one directional light shader (the first in the tree)
While the Compatibility renderer supports any number of shadows.

Co-authored-by: Clay John <claynjohn@gmail.com>
2024-09-29 00:36:09 +07:00
Thaddeus Crews 9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 +07:00
clayjohn 7ff106f828 Use distance to AABB surface to calculate Mesh LOD instead of using supports 2024-09-11 14:17:09 +07:00
viksl 929c69bad8 Fixes alpha materials being rendered with a reverse cull which is visible in reflections from reflection probes. 2024-09-01 12:10:04 +07:00
Chaosus f538376c3b Add `CLIP_SPACE_FAR` built-in to spatial shader 2024-08-27 08:48:46 +07:00
Rémi Verschelde 8acd82f70e
Merge pull request #89919 from BlueCube3310/bicubic-lightmap
Implement bicubic sampling for lightmaps
2024-08-20 10:01:41 +07:00
BlueCube3310 ef9bb1a207 Implement support for bicubic lightmap filtering
Co-authored-by: Calinou <hugo.locurcio@hugo.pro>
2024-08-19 09:52:09 +07:00
Rémi Verschelde 5b6d9a7dd8
Merge pull request #95659 from clayjohn/RD-sky-affect
Ensure `fog_sky_affect` is used even when using a background color
2024-08-16 23:49:58 +07:00
clayjohn 37be585fdf Ensure fog_sky_affect is used even when using a background color 2024-08-16 14:11:08 +07:00
kevinkuo52 3388a4a360 pass in render_info to _fill_instance_data for alpha to fix overdraw call count 2024-08-16 08:59:36 +07:00
Garteal 2606831d71 SDFGI: fix crash if update_data is nullptr 2024-07-19 18:27:32 +07:00
Rémi Verschelde 590628feda
Merge pull request #86516 from jsjtxietian/fix-camera-direction
Fix incorrect `CAMERA_DIRECTION_WORLD` calculation
2024-07-18 10:45:20 +07:00
Rémi Verschelde 6f9c0aa40d
Merge pull request #93630 from BastiaanOlij/scene_data_projection_correction
Make RenderSceneData take projection correction into account
2024-07-09 00:03:14 +07:00
Bastiaan Olij 6ed6212949 Make RenderSceneData take projection correction into account 2024-06-27 10:44:30 +07:00
jsjtxietian a313fa13fd Add safety check when setting several rendering effect quality 2024-06-26 17:06:21 +07:00
clayjohn 267ea14616 Fix LOD selection in compatibility backend and clean up LOD code 2024-05-23 11:30:22 +07:00
Rémi Verschelde c9fdcde20f
Merge pull request #91642 from BastiaanOlij/fix_transparent_sky
Skip rendering sky if viewport is set to transparent background
2024-05-14 12:06:44 +07:00
Rémi Verschelde c322a9b7ee
Merge pull request #91808 from DarioSamo/debug_mv_msaa
Do not use MSAA versions of textures on debug views.
2024-05-13 12:05:46 +07:00
Bastiaan Olij 6efaaecde2 Skip rendering sky if viewport is set to transparent background 2024-05-13 11:04:06 +07:00
Dario a3ecc86f47 Do not use MSAA versions of textures on debug views. 2024-05-10 14:01:58 +07:00
Dario 3f64eeb393 Rewrite reprojection for FSR2 to work correctly with Reverse-Z. 2024-05-10 11:57:27 +07:00
QbieShay e41064388e reverted naming to premul alpha (no T)
Initially 3d had premulT alpha as a keyword.
Since Canvas item uses mixed premul and premult as keywords,
3D is changed as well to keep consistency with 2D.
Unfortunately this keeps inconsistency with the internal ENUM.
2024-05-01 22:24:49 +07:00
Rémi Verschelde 7733ecd1ee
Merge pull request #91344 from tactical-fluke/vk_fix_unshaded_sdfgi
Fix SDFGI being used in unshaded debug draw
2024-05-01 09:55:18 +07:00
QbieShay 41a2b0e83e Added premult alpha blending to 3D (spatial) shaders.
Co-authored-by: jitspoe <jitspoe@yahoo.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2024-05-01 00:53:29 +07:00
tactical-fluke 216c9a6bd9 Fix SDFGI being used in unshaded debug draw
Fixes #62758
2024-04-30 11:28:29 +07:00
Rob Blanckaert ffe0b869f5 Add LIGHT_VERTEX to fragment shader
Adds a new variable to the fragment shader to specify
the vertex position used when calculating lighting.
2024-04-25 06:56:02 +07:00
clayjohn eb62c5b27f Revert change to default depth clear value in draw_list_begin 2024-04-17 19:08:22 +07:00
Rémi Verschelde a28be933ee
Merge pull request #89398 from clayjohn/visual-debugger-coverage
Increase coverage of timestamps for visual profiler
2024-04-04 14:31:19 +07:00
Khasehemwy d950f5f838
Use Reverse Z for the depth buffer 2024-04-04 13:54:15 +07:00
clayjohn ac6c648645 Increase coverage of timestamps for visual profiler 2024-04-03 19:29:02 +07:00
Rémi Verschelde 2597f60de1
Merge pull request #88830 from beiller/bugfix/taa_xr_fix
Add fix for TAA passes rendering black meshes on XR
2024-03-26 13:45:10 +07:00
Hugo Locurcio 26a220bd31
Make Overdraw, Lighting and Shadow Splits debug draw modes ignore decals
This also makes the Overdraw and Shadow Splits debug draw modes ignore fog.
The Lighting debug draw mode still displays fog as that debug draw mode
is intended to preview scene lighting, and fog has an impact on how
lighting is perceived.
2024-03-07 17:40:49 +07:00
Bastiaan Olij a5d3d23db4 Fix never ending loop with overlapping probes 2024-03-05 10:07:56 +07:00
Bill b44f1c5176 Add fix for TAA passes rendering black meshes on XR 2024-02-25 14:25:49 +07:00
Bastiaan Olij 5a98845655 Implement hooks into renderer 2024-02-18 21:54:21 +07:00
Eidolon 08f4560e69 Add optional depth fog 2024-02-17 22:39:34 +07:00
Erik Johnson eab95698cd
Fix shadows for billboarded Sprite3D's 2024-02-13 10:36:38 +07:00
Yuri Sizov 3f7ea71e88 Merge pull request #87495 from jsjtxietian/USE_LIGHT_SHADER_CODE
Clean up outdated `USE_LIGHT_SHADER_CODE` usage
2024-01-25 16:27:14 +07:00
Yuri Sizov 2ce450f8bc Merge pull request #84894 from clayjohn/tangent-error-message
Store ArrayMesh path in RenderingServer for use in error messages
2024-01-24 14:07:47 +07:00
jsjtxietian 2004ad1ac5 Clean up outdated `USE_LIGHT_SHADER_CODE` usage 2024-01-24 12:30:27 +07:00
Dario cc4d39b0c1 Acyclic Command Graph for RenderingDevice.
Adds a new system to automatically reorder commands, perform layout transitions and insert synchronization barriers based on the commands issued to RenderingDevice.
2024-01-08 14:54:56 +07:00
EddieBreeg 8747c67d9e
Fix potential integer underflow in rounded up divisions
A new `Math::division_round_up()` function was added, allowing for easy
and correct computation of integer divisions when the result needs to
be rounded up.

Fixes #80358.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-01-02 14:14:47 +07:00
jsjtxietian 89d7a2f0a5 Fix incorrect CAMERA_DIRECTION_WORLD calculation 2023-12-26 14:09:44 +07:00
clayjohn 43cf21cb71 Use best fit normals for storing screen space normals 2023-12-21 14:41:29 +07:00
clayjohn a5399ab5af Reduce the number of samplers used by the scene shaders
The hard limit for Apple devices is 16 samplers per stage. So we need to ensure we use less than that
2023-12-15 17:13:44 +07:00
Yuri Sizov ee1bf15924 Merge pull request #84637 from clayjohn/RD-sampler-bias
Use render pass uniform set to store viewport samplers.
2023-12-08 15:23:18 +07:00
clayjohn e2a5d2bf46 Enable non-multiview advanced shader group whenever advanced shaders are requested
This is needed because xr_enabled does not guarantee that we won't use the non-multiview variants
2023-11-21 15:16:25 +07:00
Pedro J. Estébanez 5c25fa4c78 Fix potential double-close of draw command label 2023-11-20 18:59:06 +07:00
clayjohn ead36fdcc4 Store ArrayMesh path in RenderingServer for use in error messages 2023-11-14 16:27:10 +07:00
clayjohn 2b9e6d2972 Use render pass uniform set to store viewport samplers.
This fixes a bugs where per-viewport samplers were being used for internal texture fetches (probes, sky, etc.).

This also fixes a bug when using multiple viewports in the same scene.

This also fixes a bug where the texture bias would override the bias from 3D scale.
2023-11-08 23:26:08 +07:00
clayjohn a74cfc2629 Use default samplers in base uniform set when rendering to reflection probes 2023-11-07 17:46:05 +07:00
clayjohn d1043a5f93 Enhance checks and user experience around tangents.
Ensure `ensure_tangents` option actually creates tangent array. Even if it is just a dummy array.

Allow mesh to generate its own tangents when using compression. This allows users to compress meshes without tangents.

Warn users if they are trying to read from tangents without providing tangents.
2023-11-01 22:40:42 +07:00
Rémi Verschelde 815b24d280
Merge pull request #83491 from jsjtxietian/pass-screen-size-when-render-shadow
Pass viewport size to shadow pass instead of using Vector2i(1,1)
2023-10-26 12:09:21 +07:00
jsjtxietian 26d32554bd Pass viewport size to shadow pass instead of using vector2i(1,1) 2023-10-26 15:25:22 +07:00
Rémi Verschelde f021d33940
Merge pull request #81167 from bitsawer/fix_sdfgi_editor_change
Reset SDFGI when changing editor scene tabs
2023-10-25 10:27:03 +07:00