Commit graph

1833 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Hayden Leete
fc7063b2e2 Add autocomplete for filter/repeat hints on uniform arrays 2023-07-13 11:27:28 +12: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
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
kobewi
8ae2e6681e Allow more hint types for uniform arrays 2023-07-06 15:05:26 +02:00
bitsawer
356297f909 Fix shader language float literal precision truncation 2023-07-03 12:48:33 +03:00
Yuri Roubinski
1994c25701 Fix using uint suffix at the hex number declaration in shaders 2023-07-01 14:33:48 +03:00
clayjohn
35ed7c770b Initialize particles instance buffer in case it is used before being updated 2023-06-29 13:24:40 -07:00
lewiji
2a93681334 Return shader parse error when using 'hint_normal_roughness_texture' and not using the Forward+ backend 2023-06-29 16:18:31 +01:00
K. S. Ernest (iFire) Lee
39dfa8436e Varying mismatch causing shaders to fail. 2023-06-23 21:36:38 -07:00
Arman Elgudzhyan
af9d1743f3 Clear specular buffer if bg mode is canvas and ss effects are used
Explicitly clear the separate specular buffer when the background mode is canvas and screen space effects (and thus a separate specular buffer) are used.
2023-06-23 12:16:52 -07:00
bitsawer
ef00de99b4 Fix error spam when a mesh with bone weights has an invalid skeleton 2023-06-22 15:58:52 +03:00
ChibiDenDen
35715e510f replace sampler arrays with constant sampler elements 2023-06-22 01:11:57 +03:00