Commit graph

81 commits

Author SHA1 Message Date
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
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
Matias N. Goldberg
53837adc00 Use 16-bit index buffers instead of 32 when unnecessary 2023-09-03 19:59:10 -03:00
Dario
e7d3a7c2aa Improve visual feedback when using the motion vectors debug view option.
Replaces the current method of showing the raw values of the motion vectors buffer to display a grid of lines instead with a new shader.
2023-08-28 10:14:21 -03:00
Bastiaan Olij
715ebcc3f1 Fix tonemapper, incorrect vertex count was specified 2023-08-11 10:07:16 +10:00
Rémi Verschelde
1163dac9e3
Merge pull request #80215 from clayjohn/HDR-2D
Add option to enable HDR rendering in 2D
2023-08-08 16:57:33 +02:00
Rémi Verschelde
40ca09364d
Merge pull request #80311 from darksylinc/matias-fullscreen-tri
Use fullscreen tri instead of quad
2023-08-07 14:54:21 +02:00
Rémi Verschelde
faaf27f284
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +02:00
clayjohn
57eb762bae Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance

Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear.
This is necessary for proper HDR screen support in the future.
2023-08-07 11:24:03 +02:00
Matias N. Goldberg
6e7d87fb25 Use fullscreen tri instead of quad 2023-08-05 17:09:06 -03:00
Bastiaan Olij
a22f495a3c Split raster barrier into vertex and fragment barrier 2023-07-15 12:30:32 +10:00
Yuri Sizov
0fa808ba5e Merge pull request #77085 from BastiaanOlij/visualise_direction_shadowmap_frustum
Draw frustum splices ontop of direction shadow atlas for debug purposes
2023-07-12 21:02:25 +02:00
Markus Sauermann
890fdd56df Code simplifications
CPPcheck found most of them.

no need to assign the variable twice:
- AnimationTrackEditTypeAudio
- SSEffects

variable is assigned in all if-else clauses:
- EditorHelp
- AndroidInputHandler
- MenuBar
- ShaderCompiler

same if clause:
- ItemList

clearing an empty bitfield has no effect:
- Viewport
2023-06-21 22:37:26 +02:00
Bastiaan Olij
d9eb9665da Draw frustum splices ontop of direction shadow atlas for debug purposes 2023-06-11 11:48:11 +10:00
Bradley Clemetson
2302c7102f
Allow for external python scripts to call the build python headers via external scripts
Change GLES3 to not use a relative path
Make the parameters more explicit and ensure the shaders generated are not using relative paths
2023-03-19 21:18:52 -07:00
Bastiaan Olij
a8ec72cf94 Move roughness limiter and sort into their own classes 2023-03-09 21:58:55 +11:00
Bastiaan Olij
4c2f33cfae Fixing issues with SSIL artifacts 2023-02-24 16:13:18 +11:00
Yuri Rubinsky
94831c7209 Forbid passing multiview sampler to the custom function in shaders 2023-02-21 11:23:17 +03:00
clayjohn
c9c14410e9 Fix sampling bug when SSAO is using half size 2023-02-16 00:37:12 -08:00
Bastiaan Olij
694c8ec273 Add render buffer support to screen space effects 2023-02-10 10:27:59 +11:00
Bastiaan Olij
9b549231e4 Move luminance effect into its own class and use new buffers system 2023-01-07 14:40:42 +11:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
465d4c1d95
Merge pull request #70009 from clayjohn/glow-hq
Remove high quality glow as it is not any higher quality than regular glow
2022-12-13 23:32:15 +01:00
clayjohn
bdd4001ef0 Various fixes and documentation for CanvasGroup
Properly apply custom materials with CanvasGroups in the GLES3 backend

Properly blur backbuffer when using a partial rect in forward_plus and
gl_compatibility renderers

Properly set fit_margin when clear_margin is set

Fix shader error during backbuffer clear in mobile renderer
2022-12-13 10:22:18 -08:00
clayjohn
5b5cd2b98b Remove high quality glow as it is not any higher quality than regular glow 2022-12-13 10:15:45 -08:00
clayjohn
b2b89d7294 Properly remap roughness when reading from radiance map
This ensures that we consistently use perceptual roughness which matches the behaviour of most other PBR renderers like Blender, Ue4 and Godot 3
2022-12-02 15:39:20 -08:00
Rémi Verschelde
e7418cac3d
Merge pull request #68942 from Chaosus/barrier_mask_flags
Expose `BarrierMask` as flags enum in `RenderingDevice`
2022-11-22 08:31:12 +01:00
Yuri Rubinsky
acaf38cfbc Expose BarrierMask as flags enum in RenderingDevice 2022-11-22 09:45:20 +03:00
Markus Sauermann
28af870750 Code simplifications found by cppcheck
They are based on:
- Boolean arithmetic simplifications
- setting variables that are not accessed
- constant variables
2022-11-21 08:43:36 +01:00
Rémi Verschelde
58cb11b396
Merge pull request #68710 from BastiaanOlij/fix_vrs
Fix VRS issues
2022-11-18 16:19:22 +01:00