Commit graph

3391 commits

Author SHA1 Message Date
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
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
d894a2ff57 Merge pull request #79883 from clayjohn/GLES3-shader-cache-dir
Check if shader cache directory is available before using cache
2023-07-26 18:40:35 +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
Yuri Sizov
202e4b2c1e Merge pull request #79884 from Dragoncraft89/master
Vulkan: Fix dangling pointers in `_clean_up_swap_chain`
2023-07-25 21:51:38 +02:00
Yuri Sizov
7bb732cc38 Merge pull request #79866 from adamscott/fix-file-permissions-web
Fix file permissions for the web platform (affects every Unix-like platform)
2023-07-25 21:26:30 +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
Florian Kothmeier
7f7a2b2557
Fix dangling pointers in _clean_up_swap_chain 2023-07-25 14:41:57 +02:00
clayjohn
52fb5bf986 Check if shader cache directory is available before using cache 2023-07-25 14:33:37 +02:00
Adam Scott
b6faccccd5
Fix file permissions for the web platform 2023-07-25 08:29:24 -04: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
21524e26e0 Merge pull request #79849 from bitsawer/fix_particles_and_compute_threading
Fix Vulkan multithreaded compute list and GPU particle processing
2023-07-24 19:33:52 +02:00
Yuri Sizov
b1f4e58bbf Merge pull request #79772 from Malcolmnixon/gles-skeletons
Unbind the framebuffer when updating meshes
2023-07-24 19:33:27 +02:00
Yuri Sizov
4ba24f6492 Merge pull request #79685 from LRFLEW/glinval
GLES3: Don't call `glTexParameter*` for invalid filter and repeat modes
2023-07-24 19:33:12 +02:00
Yuri Sizov
3e9fadc1dd Merge pull request #79660 from bitsawer/fix_opengl_multimesh
Fix GLES3 multimesh rendering when using colors or custom data
2023-07-24 19:33:05 +02:00
bitsawer
5d18e2ee00 Fix Vulkan multithreaded compute list and GPU particle processing 2023-07-24 12:56:55 +03:00
LRFLEW
3e9173f11a GLES3: Don't call glTexParameter* for invalid filter and repeat modes 2023-07-21 19:26:57 -05:00
Malcolm Nixon
679f5bf410 Unbind the framebuffer when updating meshes.
While the vertex shaders used to update the meshes aren't actually rendering to the framebuffer, they may still refuse to run with some framebuffers bound - such as XR with multiple views.
2023-07-21 19:34:12 -04:00
Yuri Sizov
f932c1aba1 Merge pull request #79526 from Zylann/fix_rd_thread_safe
Fix missing `_THREAD_SAFE_METHOD_` missing from `RenderingDeviceVulkan` `submit` and `sync`
2023-07-21 17:54:39 +02:00
Yuri Sizov
4acb8c66a1 Merge pull request #79568 from LRFLEW/glaniso
GLES3: Reset anisotropic filtering when changing texture filtering mode
2023-07-21 17:15:39 +02:00
bitsawer
9897f1cfb9 Fix GLES3 multimesh rendering when using colors or custom data 2023-07-20 11:54:34 +03:00
Fabio Alessandrelli
28001b9ef6 [Net] Explicitly handle buffer errors in send/recv 2023-07-19 10:08:25 +02:00
Marc Gilleron
8722cbc0a0 Add missing thread-safe method macros to RD Vulkan submit and sync 2023-07-18 20:04:51 +01:00
LRFLEW
90f0e97eb9 GLES3: reset anisotropic filtering when changing texture filtering mode 2023-07-17 00:18:39 -05:00
Bastiaan Olij
a22f495a3c Split raster barrier into vertex and fragment barrier 2023-07-15 12:30:32 +10:00
Hendrik Brucker
7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +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
a33b548092 Merge pull request #78168 from clayjohn/GLES3-gaussian-rt
Use Gaussian approximation for backbuffer mipmaps in GL Compatibility renderer
2023-07-12 15:08:57 +02:00
Kamil Brzoskowski
3cd865dbe8
Fix formatting of dlopen error message on Windows
And harmonize the format for all platforms.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-07-09 23:39:45 +02:00
Rémi Verschelde
1453dc9d5d
Merge pull request #79143 from clayjohn/wayland-menu
Avoid freeze when interacting with menus on Wayland by re-aquiring next swapchain image after updating swapchain
2023-07-09 12:24:07 +02:00
Rémi Verschelde
43c0fa7f4b
Merge pull request #78797 from Calinou/remove-redundant-vformat
Remove uses of `vformat()` with no placeholders
2023-07-08 18:18:35 +02:00
Rémi Verschelde
98358b2822
Merge pull request #78794 from joemarshall/patch-1
Fix threading bug in Vulkan rendering device
2023-07-08 18:17:46 +02:00
clayjohn
df021b5063 Avoid freeze when interacting with menus on Wayland by re-aquiring next swapchain image after updating swapchain 2023-07-07 10:19:28 +02:00
Rémi Verschelde
c566b03f26
Merge pull request #78852 from clayjohn/Particles-glitch
Initialize particles instance buffer in case it is used before being updated
2023-07-07 08:28:28 +02:00
clayjohn
35ed7c770b Initialize particles instance buffer in case it is used before being updated 2023-06-29 13:24:40 -07:00
Hugo Locurcio
dcc92c174e
Remove uses of vformat() with no placeholders
This is identical to passing the string directly.
2023-06-28 16:27:55 +02:00
Joe Marshall
c52fadbe75
fix threading bug in vulkan rendering device 2023-06-28 13:50:25 +01:00
clayjohn
7c37a32897 Use a filter with mipmaps when initializing textures with mipmaps in GL Compatibility renderer
This works around a driver bug in some older devices and should be harmless on any spec-compliant device
2023-06-26 10:45:24 -07:00
clayjohn
cc89321c9c Reset filter/repeat state of textures in GL Compatibility renderer when render target is cleared 2023-06-23 10:57:56 -07:00
Brecht Kuppens
55fc56bfd4 Moved variables closer to usage to fix unused variable warning 2023-06-22 23:01:09 +02:00
Rémi Verschelde
cb73a6e9f9
Merge pull request #78490 from clayjohn/GLES3-particles-subemit
Add warnings and fallbacks for particles sub emitters when using the GL Compatibility rendering backend
2023-06-22 21:02:38 +02:00
Qiqi Wu
df740f6865 free color and depth texture after check framebuffer complete failed 2023-06-22 09:13:24 +08:00
ChibiDenDen
35715e510f replace sampler arrays with constant sampler elements 2023-06-22 01:11:57 +03:00
clayjohn
8a5af8183a Add warnings and fallbacks for particles sub emitters when using the GL Compatibility rendering backend
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-06-21 12:56:52 -07:00
bitsawer
dab0871d41 Fix invalid RID errors when freeing a mesh with blend shapes 2023-06-19 11:07:15 +03:00
bruvzg
131e49bf13
[Unix] Fix temporary file permissions. 2023-06-16 23:34:27 +03:00
Qiqi Wu
c8e3f00e5d GLES3: Remove unimplemented texture_create() declaration 2023-06-16 18:58:23 +08:00