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

109 Commits

Author SHA1 Message Date
Thaddeus Crews
01fc9aee6c Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
Thaddeus Crews
3947cbe3b2 Merge pull request #104386 from Repiteo/core/cpp-math
Core: Replace C math headers with C++ equivalents
2025-04-27 19:21:22 -05:00
Thaddeus Crews
98aced4e65 Merge pull request #99768 from dsnopek/openxr-vulkan-foveated-rendering
OpenXR: Use the `XR_FB_foveation_vulkan` extension to get the density map for VRS
2025-04-17 09:14:23 -05:00
Thaddeus Crews
ad40939b6f Core: Replace C math headers with C++ equivalents
- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
2025-04-16 15:49:02 -05:00
Thaddeus Crews
94282d88f9 Core: Use Math namespace for constants 2025-04-10 16:29:30 -05:00
Thaddeus Crews
6bd249a4c2 Merge pull request #104850 from Repiteo/core/warning-macros
Core: Integrate warning suppression macro helpers
2025-04-03 16:50:22 -05:00
Thaddeus Crews
207a2b6472 Core: Integrate warning suppression macro helpers 2025-04-03 10:13:46 -05:00
Aaron Franke
2800948d61 Organize ifdefs for disabling navigation, physics, and XR 2025-04-02 08:24:24 -07:00
Thaddeus Crews
f25fc34439 SCons: Add CPPEXTPATH for external includes 2025-04-02 07:29:08 -05:00
David Snopek
79f5a4d9fe OpenXR: Use the XR_FB_foveation_vulkan extension to get the density map for VRS 2025-03-31 07:21:58 -05:00
Rémi Verschelde
408d07109b Merge pull request #99551 from DarioSamo/fragment-density-map
Implement Fragment density map support.
2025-03-28 14:31:19 +01:00
Dario
76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 -05: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
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
Michael Alexsander
aea559b39a Allow to compile the engine without XR support 2025-02-25 17:07:21 -03: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
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
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
Rémi Verschelde
6e23de0aa6 Merge pull request #100653 from stuartcarnie/remove_moltenvk_hack
Rendering: MoltenVK hack is no longer required, as bug was fixed.
2024-12-20 23:57:27 +01:00
Stuart Carnie
9344a29f0e Rendering: MoltenVK hack is no longer required, as bug was fixed.
Original issue: https://github.com/godotengine/godot/pull/51679#issuecomment-976900929

And related fix in SPIRV-Cross: https://github.com/KhronosGroup/SPIRV-Cross/issues/2046
2024-12-20 06:38:42 -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 +08:00
CrazyRoka
d9ef826c54 Optimize RenderForwardClustered::_setup_render_pass_uniform_set by reducing Vector allocations during push_back operations 2024-12-02 15:03:50 +01:00
Dario
6d5ac8f7ef Resolve load and store ops automatically for render passes for discardable textures. 2024-11-25 11:27:48 -03:00
Dario
5216ef5f9c Add dependency detection improvements to the render graph.
- Buffers changing their usage are no longer treated as write usage unless the API requires it.
- Draw lists are not treated as being dependent on each other if their regions do not intersect despite both being write commands.
- Particles were tweaked to use different unused buffers to reduce dependencies.
2024-11-01 09:46:52 -03:00
Thaddeus Crews
9f9ee0c813 SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
Rémi Verschelde
49ed6c558c Merge pull request #86809 from clayjohn/TAA-disocclusion
Tune TAA disocclusion scale to avoid rejecting all samples during motion.
2024-09-03 16:13:26 +02:00
Arseny Kapoulkine
0024cface5 Fix double free in FSR2 destructor
Before this change, using FSR2 resulted in the following error when the
effect was destroyed:

	ERROR: Attempted to free invalid ID: 662734928609453
	   at: _free_internal (servers/rendering/rendering_device.cpp:4957)

This happened because ACCUMULATE and ACCUMULATE_SHARPEN passes shared
the same shader_version object but had different pipeline IDs. When
version_free was called for ACCUMULATE pass, it destroyed pipelines
created from that version, including the pipeline for the
ACCUMULATE_SHARPEN pass.

Using a unique version could work around this problem, but it's easier
to rely on version_free destroying the created pipelines through the
dependency mechanism.
2024-08-16 22:44:57 -07:00
Dario
3f64eeb393 Rewrite reprojection for FSR2 to work correctly with Reverse-Z. 2024-05-10 11:57:27 -03:00
Rémi Verschelde
259d576f6e Merge pull request #91480 from clayjohn/Mobile-mipmaps-bug
Use a full screen triangle for mipmap calculations in mobile renderer
2024-05-07 14:25:42 +02:00
Bastiaan Olij
9042ddf19f Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +10:00
clayjohn
bebf85487e Use a full screen triangle for mipmap calculations in mobile renderer 2024-05-02 13:17:09 -07:00
A Thousand Ships
308dbb8c63 [Core] Add scalar versions of Vector* min/max/clamp/snap(ped)
Convenience for a number of cases operating on single values
2024-05-02 10:31:13 +02:00
clayjohn
adfc9ccc44 Use a src rect for copying from screen with CanvasGroup in the mobile backend 2024-04-17 15:19:20 -07:00
Khasehemwy
d950f5f838 Use Reverse Z for the depth buffer 2024-04-04 13:54:15 +02:00
Aaron Franke
9e0b38ecd3 Disable XR server when compiling without 3D 2024-03-13 09:02:10 -07:00
Bastiaan Olij
df8ff797b7 Consistantly use USE_MULTIVIEW as the define in shaders 2024-03-11 14:40:00 +11:00
clayjohn
2657593462 Use barriers between all blur passes with SSAO and SSIL 2024-02-21 14:35:20 -08: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 -03:00
clayjohn
7f1863f83d Tune TAA disocclusion scale to avoid rejecting all samples during motion. 2024-01-04 17:06:57 -08: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 +01:00
clayjohn
43cf21cb71 Use best fit normals for storing screen space normals 2023-12-21 14:41:29 -07:00
Bastiaan Olij
22cd145177 Merge passes in Vulkan mobile renderer 2023-12-16 09:51:35 +11:00
Lasuch
608d41a969 Expose copy_effects copy compute shader in Mobile backend 2023-12-05 21:22:46 +01:00
Rémi Verschelde
6f4da7a976 Merge pull request #83736 from darksylinc/matias-broken_buffer_update
Fix buffer updates going to the wrong cmd buffer if barriers were 0
2023-12-04 22:58:24 +01:00
Bastiaan Olij
b1c4d4e55b Ensure optional variants are loaded last. 2023-11-15 14:31:25 +11:00
Matias N. Goldberg
c9ec1f7727 Fix buffer updates going to the wrong cmd buffer if barriers were 0
From what I could see only SSAO & SSIL were affected when they both
call:

int zero[1] = { 0 };
RD::get_singleton()->buffer_update(ssao.importance_map_load_counter, 0,
sizeof(uint32_t), &zero, 0);

int zero[1] = { 0 };
RD::get_singleton()->buffer_update(ssil.importance_map_load_counter, 0,
sizeof(uint32_t), &zero, 0);

Also documented what setup_command_buffer & draw_command_buffer are for.
2023-10-21 13:14:38 -03:00
stoofin
1a2b66d4fc Fix shadow debug frustum index buffer size 2023-10-19 13:48:11 -07:00
Pedro J. Estébanez
f84c3d4477 Avoid trying to free null RIDs in FSR2 teardown 2023-09-27 16:07:41 +02:00
Dario
057367bf4f Add FidelityFX Super Resolution 2.2 (FSR 2.2.1) support.
Introduces support for FSR2 as a new upscaler option available from the project settings. Also introduces an specific render list for surfaces that require motion and the ability to derive motion vectors from depth buffer and camera motion.
2023-09-25 10:37:47 -03:00