Commit Graph

443 Commits

Author SHA1 Message Date
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +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
Shawn Wallace b12ed82c04 Expose texture_create_from_extension to GDExtension 2023-09-23 16:57:12 -04:00
Pedro J. Estébanez bda6fc5d2f Polish a few things in Vulkan RD 2023-09-19 18:10:46 +02:00
Matias N. Goldberg cfeccc2146 Fix validation error when using pipeline cache control
PR #80296 introduced a regression because it checks if the
VK_EXT_pipeline_creation_cache_control extension has been enabled before
using it, but turns out the process is a bit more convoluted than that
(a Vulkan driver may support the extension but then say the feature is
not supported)
2023-09-16 18:59:04 -03:00
A Thousand Ships 3565d1bf7e [Drivers,Platform] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-12 20:13:32 +02:00
Pedro J. Estébanez bcf33cfbd1 Enhance Vulkan PSO caching 2023-08-30 12:00:54 +02:00
Matias N. Goldberg 677d2d6fb0 Fix missing EARLY_FRAGMENT_TESTS_BIT barrier flags 2023-08-27 19:38:34 -03:00
bitsawer 3daa19dd95 Fix Vulkan texture update 2023-08-19 12:18:54 +03:00
Hugo Locurcio ce57c2379c
Abort on startup with a visible alert if required Vulkan features are missing 2023-08-17 14:48:36 +02:00
Rémi Verschelde c1dbc3dd04
Merge pull request #80288 from pkpro/memcpy_into_nullptr
Vulkan: Fix sanitizers error with empty shader name
2023-08-17 12:29:29 +02:00
Rémi Verschelde d1b8e9abd6
Merge pull request #80571 from darksylinc/matias-resize-window-fix
Fix validation error when resizing window
2023-08-16 09:13:53 +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
Matias N. Goldberg 0b09fdd96c Fix validation error when resizing window
Sometimes when resizing the window we may get the following validation
error:

ERROR: VALIDATION - Message Id Number: -370888023 | Message Id Name:
VUID-vkAcquireNextImageKHR-semaphore-01286
	Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ]
Object 0: handle = 0xdcc8fd0000000012, type = VK_OBJECT_TYPE_SEMAPHORE;
| MessageID = 0xe9e4b2a9 | vkAcquireNextImageKHR: Semaphore must not be
currently signaled or in a wait state. The Vulkan spec states: If
semaphore is not VK_NULL_HANDLE it must be unsignaled
(https://vulkan.lunarg.com/doc/view/1.2.198.1/linux/1.2-extensions/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01286)

In VulkanContext::prepare_buffers the problem was that
vkAcquireNextImageKHR returned VK_SUBOPTIMAL_KHR but it already signaled
the semaphore (because it is possible to continue normally with a
VK_SUBOPTIMAL_KHR result).

Then we recreate the swapchain and reuse the
w->image_acquired_semaphores[frame_index] which is in an inconsistent
state.

Fixed by recreating the semamphores along the swapchain.

Fix #80570
2023-08-15 20:57:49 -03:00
sakrel 80a36ff985 Add support for GLSL source-level debugging with RenderDoc (`--generate-spirv-debug-info`) 2023-08-12 14:56:49 +02: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
Pavel Kraynyukhov 77b02359c9
Vulkan: Fix sanitizers error with empty shader name
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-08-09 12:12:56 +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
Yuri Sizov eda04c5658 Merge pull request #80071 from darksylinc/matias-fixes2
Fix validation layer warnings
2023-08-01 17:26:04 +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
Matias N. Goldberg 4ce41495b1 Fix validation layer warnings
1. Validation layers on Windows were complaining w/
VUID-VkSwapchainCreateInfoKHR-surface-01270 that we were not calling
vkGetPhysicalDeviceSurfaceSupportKHR before vkCreateSwapchainKHR.

2. Godot was only calling vkGetPhysicalDeviceSurfaceSupportKHR at
startup, but it should be doing this for every window w/ a new surface
it wants to create, not just the first one.
- In practice this will likely not make a difference. If
vkGetPhysicalDeviceSurfaceSupportKHR returns false after initialization,
there's nothing we can do about it and it is likely because something
else went terribly wrong, which is why the error message is worded like
that.
- This is mostly to shut up validation layers. Though technically,
the layers are right.

3. Do not call vkGetPhysicalDeviceSurfaceSupportKHR on queues we don't
even plan on ever using. We don't know how drivers will react to that
(e.g. they may preemptetively allocate resources to support presentation
on exotic queues, instead of just saying no). Just behave like every
other Vulkan app out there.
2023-07-30 17:07:27 -03: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 63d6e9c557 Add custom texture create function 2023-07-26 20:46:34 +10:00
Florian Kothmeier 7f7a2b2557
Fix dangling pointers in _clean_up_swap_chain 2023-07-25 14:41:57 +02:00
bitsawer 5d18e2ee00 Fix Vulkan multithreaded compute list and GPU particle processing 2023-07-24 12:56:55 +03: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
Marc Gilleron 8722cbc0a0 Add missing thread-safe method macros to RD Vulkan submit and sync 2023-07-18 20:04:51 +01:00
Bastiaan Olij a22f495a3c Split raster barrier into vertex and fragment barrier 2023-07-15 12:30:32 +10: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
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
Joe Marshall c52fadbe75
fix threading bug in vulkan rendering device 2023-06-28 13:50:25 +01:00
jpcerrone bd786ce0d9 Fix for Win+M crashing the editor
Fixes #77790
Adds missing 'break' statement to 'VulkanContext::prepare_buffers' function.
It was mistakenly removed in #72859
2023-06-14 14:34:09 -03:00
Bastiaan Olij 6dd47e232b Expose RD::texture_native_handle 2023-06-14 09:58:08 +10:00
Rémi Verschelde 3dd0307f3f
Merge pull request #76348 from warriormaster12/pipeline-cache
Implement Vulkan pipeline caching
2023-06-01 00:40:33 +02:00
warriormaster12 dded713dc0 Implement Vulkan pipeline caching 2023-05-31 22:24:18 +03:00
Rémi Verschelde 8b0530be64
Merge pull request #77022 from sakrel/fix_buffer_get_data
RenderingDeviceVulkan::buffer_get_data: Use draw command buffer instead of setup command buffer
2023-05-24 08:47:19 +02:00
Rémi Verschelde b917f748b5
Merge pull request #75945 from Calinou/renderingdevice-finalaction-fix-typo
Fix typo in FinalAction `switch` statement in RenderingDevice
2023-05-24 08:46:01 +02:00
sakrel f52c151fcf RenderingDeviceVulkan::buffer_get_data: Use draw command buffer instead of setup command buffer 2023-05-12 23:25:20 +02:00
warriormaster12 10797d58dd fixed a query pool validation error 2023-05-11 17:17:23 +03:00
Rémi Verschelde 564d1b34e0
Merge pull request #74711 from BastiaanOlij/add_texture_native_handle
Provide access to internal graphics handles for textures
2023-05-09 19:28:26 +02:00
Bastiaan Olij c328676d96 For GDExternal use, provides access to internal graphics handles for textures 2023-05-09 13:47:22 +10:00
Pedro J. Estébanez 6465432570 Save cluster render shader from being optimized out entirely 2023-05-08 18:39:49 +02:00
Rémi Verschelde 392fdd106d
Merge pull request #75937 from RandomShaper/threaded_render_load
Allow creation of rendering buffers at any time
2023-05-08 13:52:33 +02:00
Hugo Locurcio 5056c427d3
Improve RenderingServer, RenderingDevice, ShaderGlobalsOverride documentation
This brings the overall class reference completion percentage from 87% to 92%.
2023-05-06 22:40:32 +02:00
Pedro J. Estébanez 09aa1bbdb3 Fix unsupported sampler filter used for voxel GI 2023-04-26 20:54:06 +02:00
Pedro J. Estébanez 882b869220 Fix issues with Vulkan layout transitions 2023-04-24 12:24:24 +02:00
Hugo Locurcio dd53037f74
Fix typo in FinalAction `switch` statement in RenderingDevice 2023-04-11 18:44:12 +02:00
Pedro J. Estébanez d4c46f15ae Allow creation of rendering buffers at any time 2023-04-11 16:33:47 +02:00
Rémi Verschelde 253b4875f3
Merge pull request #72859 from clayjohn/VK-suboptimal
Recreate swap chain when suboptimal to avoid error spam
2023-04-03 15:57:43 +02:00
bruvzg 09465f3fe6
Remove (or make verbose only) various debug prints. 2023-03-20 08:14:18 +02:00