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

134 Commits

Author SHA1 Message Date
clayjohn
986786dc8c Use proper bitshift for tonemap srgb flag in Forward+ renderer 2025-10-31 18:35:39 -07:00
clayjohn
2e59cb41f4 Optimize glow and tonemap gather step in the mobile renderer
Mobile devices are typically bandwidth bound which means we need to do as few texture samples as possible.

They typically use TBDR GPUs which means that all rendering takes place on special optimized tiles. As a side effect, reading back memory from tile to VRAM is really slow, especially on Mali devices.

This commit uses a technique where you do a small blur while downsampling, and then another small blur while upsampling to get really high quality glow. While this doesn't reduce the renderpass count very much, it does reduce the texture read bandwidth by almost 10 times. Overall glow was more texture-read bound than memory write, bound, so this was a huge win.

A side effect of this new technique is that we can gather the glow as we upsample instead of gathering the glow in the final tonemap pass. Doing so allows us to significantly reduce the cost of the tonemap pass as well.
2025-10-30 21:56:26 -07:00
Skyth
c128886c63 Overhaul screen space reflections. 2025-10-21 19:23:38 +03:00
Clay John
36b92128b1 Merge pull request #110671 from allenwp/environment-glow-consistent
Blend glow before tonemapping and change default to screen.
2025-10-14 21:29:43 -07:00
Thaddeus Crews
0400b703e4 Merge pull request #111577 from Kaleb-Reid/fix-lightmap-luminance
Apply luminance multiplier in copy_cubemap_to_panorama
2025-10-14 10:31:34 -05:00
Kaleb Reid
8173f43770 Apply luminance multiplier in copy_cubemap_to_panorama 2025-10-13 21:41:03 -07:00
Dario
ba268416d5 Push pipeline compilation of various effects to the worker thread pool. 2025-10-13 12:00:23 -03:00
Allen Pestaluky
cafc012b05 Blend Environment glow before tonemapping and change default blend mode to screen.
Additionally, change the minimum `tonemap_white` parameter to `1.0`; users can increase `tonemap_exposure` for a similar effect to decreasing `tonemap_white` below `1.0`.

Co-authored-by: Hei <40064911+Lielay9@users.noreply.github.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-10-10 12:08:08 -04:00
Thaddeus Crews
b17aa3343a Revert "SCons: Add CPPEXTPATH for external includes" 2025-10-06 13:09:22 -05:00
Aaron Franke
3d1c9fd5de Move server files into their subfolders 2025-09-30 19:39:39 -07:00
Thaddeus Crews
2b7f39ea28 Merge pull request #110505 from Calinou/tweak-draw-command-labels
Tweak draw command label names for consistency
2025-09-30 20:10:37 -05:00
Aaron Franke
9fbf5808a0 Rename server "free" functions to "free_rid" to match exposed API 2025-09-30 16:52:25 -07:00
Thaddeus Crews
8c7c96e2c4 Merge pull request #108636 from clayjohn/MSAA-depth-mobile
Add depth resolve to the mobile renderer
2025-09-17 11:34:13 -05:00
Hugo Locurcio
204e310914 Tweak draw command label names for consistency
- Use Title Case for all labels, and add hyphens where relevant.
- Mention Roughness in SSR Filter's label name, as it's only enabled
  when the SSR roughness quality is not set to Disabled.
2025-09-14 01:23:47 +02:00
Allen Pestaluky
5a3e69d16e Add debanding to SMAA and apply debanding before spatial upscalers. 2025-08-25 16:55:36 -04:00
Allen Pestaluky
a033656eda Fix debanding for Mobile rendering method with HDR 2D. 2025-07-24 16:11:49 -04:00
clayjohn
a8efa55bed Add depth resolve to the mobile renderer 2025-07-16 20:37:39 -07:00
Allen Pestaluky
a1591512f8 Always perform color correction and debanding on nonlinear sRGB values.
Fixes #107730

Co-authored-by: LuoZhihao <luo_zhihao@outlook.com>
2025-07-08 13:44:53 -04:00
Dario
46277836a6 Optimize Mobile renderer by using FP16 explicitly. 2025-06-09 14:39:35 -03:00
Thaddeus Crews
de37627404 Merge pull request #102552 from DarioSamo/shader-baker
Add shader baker to project exporter.
2025-05-28 17:09:38 -05:00
Stuart Carnie
7d93119353 Renderer: Eliminates String allocations for all labels in the renderer
Uses `Span<char>` to avoid additional allocations in the graph.
2025-05-28 06:01:35 +10:00
Dario
5a30a7e7cd Add shader baker to project exporter.
Metal Support contributed by Migeran (https://migeran.com) and Stuart Carnie.

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
Co-authored-by: Gergely Kis <gergely.kis@migeran.com>
2025-05-27 12:45:27 -03:00
Thaddeus Crews
e89c4b0f9f Merge pull request #102330 from RGDTAB/add_partial_smaa
Add SMAA 1x to screenspace AA options
2025-05-26 11:24:35 -05:00
Raymond DiDonato
6b99608950 Add SMAA 1x 2025-05-21 15:02:09 -04:00
Ricardo Sanchez-Saez
47971c0a27 Introduce 'visionos' platform derived from 'apple_embedded' 2025-05-19 15:47:01 -07:00
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