Commit graph

4456 commits

Author SHA1 Message Date
Hugo Locurcio
6f1152bdbe
Add a --audio-output-latency command-line argument
This allows optimizing the audio output latency on higher-end CPUs,
especially in projects that do not expose a way to override this setting.
2023-08-17 14:45:17 +02:00
Rémi Verschelde
04306777a7
Merge pull request #80618 from DarioSamo/skeleton-motion-vectors
Add motion vector support for animated surfaces
2023-08-17 11:26:40 +02:00
Rémi Verschelde
12a9ed0fbf
Merge pull request #80171 from RedMser/audio-randomizer-defaults
Simpler default values for AudioStreamRandomizer
2023-08-17 11:23:49 +02:00
Rémi Verschelde
37d213b24e
Merge pull request #79972 from smix8/navgenerator_multithreading_4.x
Add multi-threaded NavMesh baking to NavigationServer
2023-08-17 11:22:11 +02:00
Dario
e2984af013 Add motion vector support for animated surfaces like skeletons or blend shapes.
Extends mesh instances that required custom vertex buffers to create two alternating buffers that are written to and binds them to use them as the previous vertex buffer when generating motion vectors.
2023-08-16 11:37:42 -03:00
Rémi Verschelde
9d9043a9c8
Merge pull request #80654 from bitsawer/fix_global_uniform_texture_set
Fix global shader uniform texture loading
2023-08-16 09:17:25 +02:00
Rémi Verschelde
623156a05c
Merge pull request #80651 from clayjohn/RD-2D-HDR-MSDF
Fallback to linear color texture when using 2D HDR and MSDF font
2023-08-16 09:17:01 +02:00
Rémi Verschelde
04c2bc5a37
Merge pull request #80424 from DarioSamo/rd-buffer-copy-vulkan
Add `buffer_copy` method to RenderingDevice
2023-08-16 09:13:06 +02:00
bitsawer
41def3740a Fix global shader uniform texture loading 2023-08-15 14:18:26 +03:00
clayjohn
40d70bf9b8 Fallback to linear color texture when using 2D HDR and MSDF font 2023-08-15 11:08:29 +02:00
bruvzg
5d3fcc5766
[TextServer] Fix system font fallback and caret/selection behavior for composite characters. 2023-08-15 11:42:40 +03:00
Dario
420f3890b0 Fix incorrect error checking and notifications introduced in PR #80414.
There was an error in the other branch of the refactored function where the size of the array was not properly multiplied by the size of the float to check against the buffer size. This was only an error in the error-checking itself and not the functionality. There was also an error where the proper notification was not emitted whenever the buffer for the multimesh is recreated to invalidate the previous references the renderer might've created to it. This fixes CPU Particles getting corrupted when they're created without emission being enabled.
2023-08-13 09:08:20 -03:00
Dario
0d7deca4e2 Add buffer_copy method to RenderingDevice interface and an implementation for the Vulkan driver.
Direct buffer copies are required to perform certain operations more efficiently, as the only current alternative is to download the buffer to the CPU and upload it again. As the first use case, the new function is used when enabling motion vectors on multimeshes.
2023-08-12 09:38:39 -03:00
Bastiaan Olij
715ebcc3f1 Fix tonemapper, incorrect vertex count was specified 2023-08-11 10:07:16 +10:00
Dario
5155870d64 Improve handling of motion vectors for multimesh instances.
Fixes #67287. There was a subtle error where due to how enabling motion vectors for multi-meshes was handled, only the first instance would have a valid transforms buffer and the rest would point to an invalid buffer. This change moves over the responsibility of enabling motion vectors only when changes happen to the individual 3D transforms or the entire buffer itself. It also fixes an unnecessary download of the existing buffer that'd get overwritten by the current cache if it exists. Another fix is handling the case where the buffer was not set, and enabling motion vectors would not cause the buffer to be recreated correctly.
2023-08-09 08:17:07 -03:00
Rémi Verschelde
70e77a8383
Merge pull request #80381 from Calinou/audio-bus-master-use-scenestringnames
Use StringName consistently to refer to the Master audio bus name
2023-08-08 16:59:11 +02:00
Rémi Verschelde
00de140d46
Merge pull request #80368 from BastiaanOlij/fix_mobile_error_on_scale
Fix issue with four subpasses always been requested in mobile renderer
2023-08-08 16:58:47 +02: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
Johan Aires Rastén
6e1f68109b Support shader preprocessor concatenation symbol 2023-08-08 10:56:20 +02:00
Hugo Locurcio
49b6067aba Use StringName consistently to refer to the Master audio bus name 2023-08-07 18:06:17 +02:00
smix8
8686e84b44 Add multi-threaded NavMesh baking to NavigationServer
Adds multi-threaded NavMesh baking to NavigationServer.
2023-08-07 17:14:37 +02:00
Rémi Verschelde
8a3a3aaebe
Merge pull request #80356 from darksylinc/voxelgi-dispatch-underflow
Fix integer underflow when rounding up in VoxelGI
2023-08-07 14:55:33 +02:00
Rémi Verschelde
ff70ce158c
Merge pull request #80315 from darksylinc/matias-ssil-validation-fix
Fix validation error when enabling SSIL alone
2023-08-07 14:55:10 +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
f01290fa91
Merge pull request #80257 from DarioSamo/taa_double_precision_fix
Fix motion vectors being corrupted when using `precision=double`
2023-08-07 14:51:35 +02:00
Rémi Verschelde
7eb047a5ed
Merge pull request #79643 from smix8/navgenerator_4.x
Move navigation mesh baking to NavigationServer
2023-08-07 14:48:15 +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
Bastiaan Olij
414df467cd Fix issue with four subpasses always been requested in mobile renderer 2023-08-07 20:26:48 +10: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
e783e32108 Fix integer underflow when rounding up in VoxelGI
The code wanted to divide and round up:
 - 0 / 64 = 0
 - 63 / 64 = 1
 - 64 / 64 = 1
 - 65 / 64 = 2

However when the dividend was exactly 0 it would underflow and produce
67108864 instead.

This caused TDRs on empty scenes or extremely slow performance

Fix #80286
2023-08-06 23:21:58 -03:00
Chia-Hsiang Cheng
0cf57e1927 Ensure POINT_SIZE takes effect 2023-08-06 16:44:16 +08:00
Matias N. Goldberg
666e91b9ff Fix validation error when enabling SSIL alone 2023-08-05 20:57:26 -03:00
Matias N. Goldberg
79c9edab3b Draw sky as a fullscreen triangle 2023-08-05 17:55:43 -03:00
Matias N. Goldberg
6e7d87fb25 Use fullscreen tri instead of quad 2023-08-05 17:09:06 -03:00
Dario
77776f5313 Fix motion vectors being corrupted when using precision=double and resulting in the TAA pass being completely broken.
See Issue #69528. When building with precision=double, the TAA pass would break due to the motion vectors being corrupted. It was apparent the origin of the camera itself was corrupted in the UBO for the previous frame because the camera origin was only being split correctly for the current block but not for the previous block (to effectively support the double precision float on the shader).
2023-08-04 11:42:06 -03:00
Yuri Sizov
a56e960150 Merge pull request #71233 from PrecisionRender/barycentric-coords
Add ability to get face index and barycentric coordinates from raycast
2023-08-03 22:37:30 +02:00
smix8
744fa87da2 Move navigation mesh baking to NavigationServer
Moves navigation mesh baking to NavigationServer.
2023-08-03 19:49:07 +02:00
Rémi Verschelde
f9f5041675
Merge pull request #80222 from clayjohn/Shader-rid-init
Initialize shader placeholders up front
2023-08-03 18:33:59 +02:00
clayjohn
558f4b7559 Initialize shader placeholders up front
Then use the placeholder to create the shader instead of swapping RIDs
This fixes a false positive that reported leaked shaders
2023-08-03 16:13:33 +02:00
Rémi Verschelde
4c70849b3b
Merge pull request #80168 from akien-mga/extension-compat
Fix or workaround recent extension API compatibility issues
2023-08-03 15:12:38 +02:00
Rémi Verschelde
858e8748e8
Fix or workaround recent extension API compatibility issues
- Add compatibility methods for `RenderingDevice::shader_create_from_bytecode`
  and `CodeEdit::get_text_for_symbol_loopup`.
- Silence errors which now have compatibility methods.
- Acknowledge GraphEdit/GraphNode compat breakage, intended and WIP.
2023-08-03 12:07:21 +02:00
Faolan
7d8a9d257d XR Tracker reuses XR Pose 2023-08-02 21:49:56 -04:00
PrecisionRender
af7f787c6e Add ability to get barycentric coordinates from ray 2023-08-02 15:16:44 -05:00
RedMser
84a2778e28 Simpler default values for AudioStreamRandomizer 2023-08-02 17:20:40 +02:00
Hugo Locurcio
037975f6b6
Remove debugging print from shader cache 2023-08-01 17:55:44 +02:00
Yuri Sizov
cc1ee3e599 Merge pull request #79911 from BastiaanOlij/fix_barrier_breakage
Add exceptions for breakage introduced in RD barriers
2023-08-01 17:25:40 +02:00
Yuri Sizov
13307e7efc Merge pull request #79776 from LRFLEW/mobilefog
Mobile: Uncomment code required for fog rendering on clear color
2023-08-01 17:25:29 +02:00
Yuri Sizov
1c40263665 Merge pull request #79606 from clayjohn/ShaderRD-compilation-groups
Shader rd compilation groups
2023-08-01 17:25:16 +02:00
Yuri Sizov
8b12849fef Merge pull request #79876 from LRFLEW/mobalpha
Fix transparent viewport backgrounds with custom clear color
2023-07-31 21:01:32 +02:00
Yuri Sizov
79d3468246 Merge pull request #79696 from reduz/call-on-render-thread
Add ability to call code on rendering thread
2023-07-31 21:01:21 +02:00
LRFLEW
6effd3cde7 Fix transparent viewport backgrounds with custom clear color 2023-07-30 06:19:47 -05:00
Matias N. Goldberg
472226422e Fix uninitialized variable ending up sent to Vulkan
The first time a shader is compiled Godot performs the following:

```cpp
for (uint32_t i = 0; i < SHADER_STAGE_MAX; i++) {
	if
(spirv_data.push_constant_stages_mask.has_flag((ShaderStage)(1 << i))) {
		binary_data.push_constant_vk_stages_mask |=
shader_stage_masks[i];
	}
}
```

However binary_data.push_constant_vk_stages_mask is never initialized to
0 and thus contains garbage data or'ed with the good data.

This value is used by push constants (and many other things) thus it can
be a big deal.

Fortunately because the relevant flags are always guaranteed to be set
(but not guaranteed to be unset), the damage is restricted to:

1. Performance (unnecessary flushing & over-excessive barriers)
2. Overwriting push descriptors already set (this would be serious,
doesn't seem to be an issue)
3. Driver implementations going crazy when they see bits set they don't
expect (unknown if this is an issue)

This uninitialized value is later saved into the binary cache.

Valgrind is able to detect this bug on the first run, but not on the
subsequent ones because they data comes from a file.

cache_file_version has been bumped to force rebuild of all cached
shaders. Because the ones generated so far are compromised.
2023-07-29 18:28:33 -03:00
Bastiaan Olij
10f796dae3 Add exceptions for breakage introduced in RD barriers and prevent future breakage 2023-07-28 14:21:34 +10:00
Yuri Sizov
1fe49e7271 Merge pull request #79142 from BastiaanOlij/register_render_buffers
Expose RenderSceneBuffers(RD) through ClassDB
2023-07-27 15:22:27 +02:00
Yuri Sizov
0c2399d6ec Merge pull request #63826 from deakcor/dev_clipboard
Add `clipboard_has/get_image` methods to DisplayServer
2023-07-27 15:22:16 +02:00
Yuri Sizov
d49ea2b7d8 Merge pull request #79288 from BastiaanOlij/custom_texture_api
Add custom texture create function
2023-07-26 18:40:01 +02:00
Bastiaan Olij
4874b96033 Expose RenderingSceneBuffers through ClassDB 2023-07-26 23:48:30 +10:00
Bastiaan Olij
63d6e9c557 Add custom texture create function 2023-07-26 20:46:34 +10:00
Juan Linietsky
c7fb6cea3d Add ability to call code on rendering thread
As more users use compute in Godot 4, the way they do is most likely incompatible when running
on separate threads and will start erroring soon as we improve the thread safety of the render thread.

To properly run code on the render thread, this function was added. Use like this:

```GDScript

func initialize_compute_code():
	....

func update_compute_code(custom_data):
	...

func _ready():
	RenderingServer.call_on_render_thread( initialize_compute_code )

func _process():
	RenderingServer.call_on_render_thread( update_compute_code.bind(with_data) )

```
2023-07-26 12:28:00 +02:00
smix8
69fad39cf5 Add NavigationServer API to enable regions and links
Adds NavigationServer API to enable regions and links.
2023-07-26 01:20:15 +02:00
Yuri Sizov
3f2e901633 Merge pull request #79865 from clayjohn/discard-shader
Fix use of discard in shaders
2023-07-25 21:26:27 +02:00
Yuri Sizov
08cffc128f Merge pull request #79812 from ParsleighScumble/parsleigh/init-sky-scene-state
Use defaults to initialize sky data in case of no sky
2023-07-25 21:26:23 +02:00
Yuri Sizov
0e9e373b87 Merge pull request #79603 from bitsawer/fix_instance_uniform_update
Fix instance uniform data buffer update delay
2023-07-25 21:26:02 +02:00
Yuri Sizov
4b0d1026af Merge pull request #78365 from smix8/ps_navmap_default_up_4.x
Add ProjectSettings navigation map default up
2023-07-25 21:25:50 +02:00
Clay
7c812cd7e9 Fix use of discard in shaders
discard was being included in all shaders set to depth pass opaque, which is the majority of shaders

Instead it should only be used with alpha prepass materials
2023-07-24 23:21:04 +02:00
Parsleigh Scumble
67c13fe4eb Use defaults to initialize sky data in case of no sky 2023-07-24 10:41:13 -07:00
Yuri Sizov
ee06d3e83f Merge pull request #79844 from bruvzg/btn_el_out
[Text Server] Fix ellipsis outline drawing
2023-07-24 19:33:45 +02:00
Yuri Sizov
360633089c Merge pull request #79590 from 0010200303/master
Fix bad LOD selection when Camera in Mesh AABB
2023-07-24 19:32:54 +02:00
Yuri Sizov
372e9abcfc Merge pull request #79459 from MoltenCoffee/fix-shader-arguments-error
Add error for undefined function in shader
2023-07-24 19:32:46 +02:00
LRFLEW
db17415df8 Mobile: Uncomment code required for fog rendering on clear color 2023-07-24 08:46:45 -05:00
bruvzg
55c8cdb332
[Text Server] Fix ellipsis outline drawing. 2023-07-24 08:07:29 +03:00
Yuri Sizov
1e856b61ae Merge pull request #79624 from mandryskowski/patch-1
Revert the change of the limit for interpolation of F0 for dielectrics and metals for Screen Space Reflections
2023-07-21 17:54:50 +02:00
clayjohn
e970f5249c Add Shader compile groups to RD Shader system
This allows us to specify a subset of variants to compile at load time and conditionally other variants later.

This works seamlessly with shader caching.

Needed to ensure that users only pay the cost for variants they use
2023-07-21 16:42:30 +02:00
Yuri Sizov
dd05012122
Merge pull request #79528 from univeous/video_adapter_fix
Fix crash when calling `get_video_adapter_*` in a thread
2023-07-20 16:28:47 +02:00
Jonas Schönbrodt
26c4644b38 Fix bad LOD selection when Camera in Mesh AABB
Fixed an issue where a bad LOD would be selected although the Camera being inside the Meshes AABB.
2023-07-19 18:07:37 +02:00
univeous
0a64abe891 Fix crash when calling get_video_adapter_* in a thread
co-authored-by: Clay John <claynjohn@gmail.com>
2023-07-19 23:31:27 +09:00
mandryskowski
33e46aac13
Revert the change of the limit for interpolation of R0 with respect to metallic and SSR
Commit 2c000cb72f changed the interpolation limits from (0.04, 1.0) to (0.04, 0.37). This is incorrect, as we want to have an F0 of 0.04 for dielectrics (materials with metalness of 0.0) and an F0 of 1.0 for metals.
The Schlick approximation uses an F0 of 0.04 for all dielectrics and it's good enough.
Having it lower than 1.0 leads to an incorrect application of the Fresnel effect for metals and leads to bugs like #79549
2023-07-18 19:18:19 +02:00
Yuri Sizov
d70488892c Merge pull request #79483 from smix8/nav2d_pj_props_4.x
Change 2D navigation ProjectSettings from integers to floats
2023-07-18 13:15:23 +02:00
bitsawer
7a9783737a Fix instance uniform data buffer update delay 2023-07-18 12:19:15 +03:00
MoltenCoffee
16c3f4be2d
Add error for undefined function in shader 2023-07-18 10:01:29 +02:00
Vincent D
c13e3a9fb0 add clipboard get image methods for windows and macos
Co-Authored-By: RedworkDE <10944644+RedworkDE@users.noreply.github.com>
Co-Authored-By: bruvzg <7645683+bruvzg@users.noreply.github.com>
2023-07-17 23:47:27 +02:00
Clay John
f880892c3d
Merge pull request #79402 from Haydoggo/repeat-filter-autocomplete
Add autocomplete for filter/repeat hints on uniform arrays
2023-07-17 11:32:20 +02:00
Bastiaan Olij
a22f495a3c Split raster barrier into vertex and fragment barrier 2023-07-15 12:30:32 +10:00
smix8
2852fb43f7 Change 2D navigation ProjectSettings from integers to floats
Changes 2D navigation ProjectSettings from integers to floats.
2023-07-14 22:36:06 +02:00
Hayden Leete
fc7063b2e2 Add autocomplete for filter/repeat hints on uniform arrays 2023-07-13 11:27:28 +12:00
bruvzg
4790da7900
[macOS] Implement optional native file selection dialog support for sandboxed apps. 2023-07-12 22:36:24 +03:00
Yuri Sizov
ff689003a5 Merge pull request #77993 from bruvzg/key_lbl_from_p
Implement DisplayServer.keyboard_get_label_from_physical method.
2023-07-12 21:02:37 +02: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
Yuri Sizov
bb15241e06 Merge pull request #77740 from ChibiDenDen/simplify_vulkan
Replace sampler arrays with constant sampler elements, simplify and reuse code for all shaders
2023-07-12 17:16:12 +02:00
Yuri Sizov
d676246647 Merge pull request #79137 from smix8/region_bake_depr_4.x
Mark NavigationServer3D.region_bake_navigation_mesh() as deprecated
2023-07-12 15:09:50 +02:00
Yuri Sizov
5dff3c4484 Merge pull request #78538 from Sauermann/fix-code-simplifications
Remove unnecessary value assignments throughout the codebase
2023-07-12 15:09:26 +02:00
Yuri Sizov
65cc4db0ae Merge pull request #79100 from KoBeWi/[filter,_filter,_filter,_filter,_filter,_filter]
Allow more hint types for uniform arrays
2023-07-12 14:18:34 +02:00
Rémi Verschelde
7030ac555f
Merge pull request #79270 from clayjohn/particle-trails-error
Unify error condition for particles trail lifetime
2023-07-10 10:38:34 +02:00
clayjohn
78ecdb17f9 Unify error condition for particles trail lifetime 2023-07-10 10:17:27 +02:00
Rémi Verschelde
46cd84b362
Merge pull request #78839 from lewiji/normal_roughness_mobile_fix
Fix invalid shader compilation when using `hint_normal_roughness_texture` in mobile backend
2023-07-08 18:19:49 +02:00
Rémi Verschelde
ea3aaeac05
Merge pull request #78624 from puchik/canvas-background-specular-ghosting
Clear specular buffer if sky mode is canvas and screen space effects are used
2023-07-08 18:16:05 +02:00
Rémi Verschelde
b2ada1b690
Merge pull request #78972 from bitsawer/fix_shader_float_precision
Fix shader language float literal precision truncation
2023-07-07 08:32:09 +02:00
Rémi Verschelde
25ec523596
Merge pull request #78906 from Chaosus/shader_allow_hex_uint
Fix using uint suffix at the hex number declaration in shaders
2023-07-07 08:29:17 +02:00
Rémi Verschelde
b8f28e287e
Merge pull request #78902 from nklbdev/Fix_wrong_type_casting_in_RenderingServer
Fix wrong type casting for octahedral tangents
2023-07-07 08:28:52 +02:00
smix8
f7ebce2626 Mark NavigationServer3D.region_bake_navigation_mesh() as deprecated
Marks NavigationServer3D.region_bake_navigation_mesh() as deprecated.
2023-07-07 02:30:14 +02:00