Commit Graph

149 Commits

Author SHA1 Message Date
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
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
clayjohn
258d4d5c3d Track mesh dependencies in Dummy RenderingServer to properly resolve freeing MeshInstances 2025-01-31 12:57:10 -08: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 -06:00
Rémi Verschelde
133db1fd60 Merge pull request #92089 from QbieShay/qbe/particle_seek
Implement particle seek request and seed options.
2025-01-13 20:21:28 +01:00
QbieShay
e9eb0b6082 Implemented tools around particles seed randomization.
The purpose of this code is to expose the necessary
functions for users and engine devs to develop tooling
for properly timing and seeking inside particles.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-11 16:31:24 +01: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 +01:00
devloglogan
e7f6b7ea0b Allow using custom Rect2i for rendering with OpenXR 2025-01-09 09:46:15 -06:00
Aarni Koskela
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
clayjohn
49846cf79a Save instance and global uniform data in RenderingServerDummy so they can be exported with headless exports 2025-01-06 19:25:11 -08: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 +08:00
Thaddeus Crews
b715fabd70
Merge pull request #76371 from ze2j/array_mesh_surface_remove
Add `ArrayMesh::surface_remove`
2024-12-19 19:59:56 -06: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 -06:00
Hendrik Brucker
a3525bc015 Add transparency support for LightmapGI
Co-authored-by: Guerro323 <kaltobattle@gmail.com>
2024-12-18 19:36:16 +01:00
Rémi Verschelde
190ae9f9dc
Merge pull request #100302 from clayjohn/light2d-optimize
Optimize PointLight2D shadow rendering by reducing draw calls and RD state changes
2024-12-17 22:59:54 +01:00
clayjohn
7c61252dd7 Optimize PointLight2D shadow rendering by reducing draw calls and RD state changes.
This dramatically reduces the CPU time spent on rendering shadows for PointLight2Ds
2024-12-17 07:41:09 -08:00
Thaddeus Crews
bfc66f0608
Merge pull request #100282 from devloglogan/motion-vectors-openxr
Add renderer motion vectors API for use with OpenXR
2024-12-12 16:13:36 -06:00
Thaddeus Crews
7c015a768f
Merge pull request #99958 from lander-vr/reflection-probe-blend-property
Add Blend Distance property to ReflectionProbe
2024-12-12 16:13:32 -06:00
Rémi Verschelde
0e5c337453
Merge pull request #85653 from BlueCube3310/lightmap-gi-shadowmask
Implement LightmapGI shadowmasks
2024-12-12 14:09:30 +01:00
BlueCube3310
189c8eb671 Implement shadowmasks for LightmapGI
Co-authored-by: dearthdev <nathandearthdev@gmail.com>
2024-12-12 11:00:28 +01:00
Matias N. Goldberg
acf439e96d Keep processing Graphics if there are pending operations
Fixes #90017
Fixes #90030
Fixes #98044

This PR makes the following changes:

# Force processing of GPU commands for frame_count frames

The variable `frames_pending_resources_for_processing` is added to track
this.

The ticket #98044 suggested to use `_flush_and_stall_for_all_frames()`
while minimized.

Technically this works and is a viable solution.

However I noticed that this issue was happening because Logic/Physics
continue to work "business as usual" while minimized(\*). Only Graphics
was being deactivated (which caused commands to accumulate until window
is restored).

To continue this behavior of "business as usual", I decided that GPU
work should also "continue as usual" by buffering commands in a double
or triple buffer scheme until all commands are done processing (if they
ever stop coming). This is specially important if the app specifically
intends to keep processing while minimized.

Calling `_flush_and_stall_for_all_frames()` would fix the leak, but it
would make  Godot's behavior different while minimized vs while the
window is presenting.

\* `OS::add_frame_delay` _does_ consider being minimized, but it just
throttles CPU usage. Some platforms such as Android completely disable
processing because the higher level code stops being called when the app
goes into background. But this seems like an implementation-detail that
diverges from the rest of the platforms (e.g. Windows, Linux & macOS
continue to process while minimized).

# Rename p_swap_buffers for p_present

**This is potentially a breaking change** (if it actually breaks
anything, I ignore. But I strongly suspect it doesn't break anything).

"Swap Buffers" is a concept carried from OpenGL, where a frame is "done"
when `glSwapBuffers()` is called, which basically means "present to the
screen".

However it _also_ means that OpenGL internally swaps its internal
buffers in a double/triple buffer scheme (in Vulkan, we do that
ourselves and is tracked by `RenderingDevice::frame`).

Modern APIs like Vulkan differentiate between "submitting GPU work" and
"presenting".

Before this PR, calling `RendererCompositorRD::end_frame(false)` would
literally do nothing. This is often undesired and the cause of the leak.
After this PR, calling `RendererCompositorRD::end_frame(false)` will now
process commands, swap our internal buffers in a double/triple buffer
scheme **but avoid presenting to the screen**.

Hence the rename of the variable from `p_swap_buffers` to `p_present`
(which slightly alters its behavior).
If we want `RendererCompositorRD::end_frame(false)` to do nothing, then
we should not call it at all.

This PR reflects such change: When we're minimized **_and_**
`has_pending_resources_for_processing()` returns false, we don't call
`RendererCompositorRD::end_frame()` at all.

But if `has_pending_resources_for_processing()` returns true, we will
call it, but with `p_present = false` because we're minimized.

There's still the issue that Godot keeps processing work (logic,
scripts, physics) while minimized, which we shouldn't do by default. But
that's work for follow up PR.
2024-12-11 14:13:29 -03:00
devloglogan
3deb5884d7 Renderer agnostic motion vector rendering/OpenXR changes 2024-12-10 15:59:17 -06:00
landervr
05010180ce ReflectionProbe add Blend Distance 2024-12-05 23:29:47 +01:00
ze2j
97e0b43faa Add ArrayMesh::surface_remove 2024-11-27 13:46:15 +01:00
David House
6e9d31f602 Implemented multimesh_get_buffer_rd_rid function into RenderingServer.
Fixed style error.

Updated dummy mesh_storage to move from cpp to h the return of a blank Rid on _multimesh_get_buffer_rd_rid.
2024-11-14 15:52:08 -06:00
Adam Scott
0d350e7108
Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
Thaddeus Crews
cfc05c5e0f
Merge pull request #85338 from EMBYRDEV/shadow-caster-mask
Add `shadow_caster_mask` to Light3D.
2024-10-24 13:22:59 -05: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 -03:00
Thaddeus Crews
9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
David Snopek
1a6f8512bc Add external texture support (GLES3)
Co-authored-by: Fredia Huya-Kouadio <fhuyakou@gmail.com>
Co-authored-by: Mauricio Narvaez <nvz@meta.com>
2024-09-20 10:48:32 -05:00
Thaddeus Crews
b37fc1014a
Style: Apply new clang-format changes 2024-09-20 08:09:48 -05:00
David Snopek
7d56b09f23 Expose a function to create textures from a native handle in the compatibility renderer 2024-09-19 09:05:32 -05:00
rune-scape
f04a9bb630 Avoid const_cast in mesh_storage.h 2024-08-28 14:46:03 -07:00
Rémi Verschelde
6a9ecdcf0c
Merge pull request #91818 from rburing/fti_multimesh
Physics interpolation: `MultiMesh`
2024-08-20 10:01:46 +02:00
Rémi Verschelde
8acd82f70e
Merge pull request #89919 from BlueCube3310/bicubic-lightmap
Implement bicubic sampling for lightmaps
2024-08-20 10:01:41 +02:00
Rémi Verschelde
6bf64027b7
Merge pull request #94785 from Chaosus/shader_fix_samplers_order
Fix texture samplers to not being last in the property list
2024-08-19 16:05:21 +02:00
BlueCube3310
ef9bb1a207 Implement support for bicubic lightmap filtering
Co-authored-by: Calinou <hugo.locurcio@hugo.pro>
2024-08-19 09:52:09 +02:00
Ricardo Buring
1728f80e7c Fixed Timestep Interpolation: MultiMesh
Adds fixed timestep interpolation to multimeshes.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-08-18 17:14:59 +02:00
Hannah Crawford
a54b71bbdf Add shadow_caster_mask to Light3D. 2024-08-12 00:17:11 +01:00
Jamie Pate
f8c99efc3b
Fix LightmapGI causes crash when using --headless
Fixes #89119

Add dummy LightmapInstance and Lightmap resources for headless rendering

Prevents the RenderingServer from crashing when it accesses
lightmap_instance->base_data
2024-08-07 11:38:05 +02:00
Yuri Rubinsky
e41048e16e Fix texture samplers to not being last in the property list 2024-07-29 09:19:09 +03:00
Bastiaan Olij
1eb0039b6e Fix regression around OpenGL swapchain optimisation for OpenXR 2024-07-29 12:46:58 +10:00
Bastiaan Olij
9042ddf19f Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +10:00
jitspoe
a0969a0931 Shadow fade for omni lights actually stops the shadow from updating while faded out to improve performance. 2024-03-25 21:25:56 -04:00
Bastiaan Olij
a5d3d23db4 Fix never ending loop with overlapping probes 2024-03-05 10:07:56 +11:00
Rémi Verschelde
b82855bcc1
Merge pull request #88581 from jsjtxietian/dummy-crash
Fail early if shader mode is invalid in dummy renderer
2024-02-23 11:29:42 +01:00
jsjtxietian
a382e9539b Fail early if shader mode is invalid in dummy renderer 2024-02-23 12:25:02 +08:00
Bastiaan Olij
5a98845655 Implement hooks into renderer 2024-02-18 21:54:21 +11:00
Rémi Verschelde
1b8e12c499
Merge pull request #88409 from jsjtxietian/high-end
Make dummy rendering server appear as a high end platform to fix vulkan shader compile error when exporting
2024-02-17 00:27:30 +01:00