Commit graph

162 commits

Author SHA1 Message Date
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
Bastiaan Olij
d6caa69e11 Skip swapchain logic if there is nothing to present (Android OpenXR) 2024-01-08 21:51:04 +11:00
Pedro J. Estébanez
12a519bae2 Split RenderingDevice into API-agnostic and RenderingDeviceDriver parts
Credit and thanks to @bruzvg for multiple build fixes, update of 3rd-party items and MinGW support.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2023-12-20 19:18:08 +01:00
bruvzg
25dc729dd4
Parse OpenGL and Vulkan strings as UTF-8. 2023-10-30 17:24:31 +02:00
A Thousand Ships
f18aa00e85 Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-10-08 17:23:33 +02:00
Rémi Verschelde
68926d5919
Merge pull request #81827 from darksylinc/matias-vkfeatures-opt-in
Opt-in to Vulkan features we actually use.
2023-10-05 22:49:21 +02:00
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
Matias N. Goldberg
d5f913ce1d Opt-in to Vulkan features we actually use. 2023-09-24 21:05:48 -03: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
Pedro J. Estébanez
bcf33cfbd1 Enhance Vulkan PSO caching 2023-08-30 12:00:54 +02: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
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
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
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
Florian Kothmeier
7f7a2b2557
Fix dangling pointers in _clean_up_swap_chain 2023-07-25 14:41:57 +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
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
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
ChibiDenDen
d104d8447b
Fix use-after-free for VkAttachmentReference
In the flow where VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME does not exist
VkAttachmentReference are created inside a loop and their backing buffer is referenced in the subpass object.
the VkAttachmentReference vectors are freed once the loop exists, causing the subpass to point to freed data.

Add all the VkAttachmentReference to a vector in the scope of the entire function, to ensure they are not freed until vkCreateRenderPass is called
2023-02-20 11:54:52 +02:00
Wiktor Kocielski
b66f3846b4 Make present mode info message print only on change
Styling fix
2023-02-12 16:08:11 +03:00
clayjohn
22291d7ae2 Add more debug information to swapchain errors in Vulkan context 2023-02-07 13:52:36 -08:00
clayjohn
c9d2bc91aa Recreate swap chain when suboptimal to avoid error spam 2023-02-07 13:43:14 -08:00
Hugo Locurcio
f3e8300b50
Print name of Vulkan rendering method on startup
This helps troubleshooting as the CLI logs now distinguish between
Forward+ and Forward Mobile.
2023-02-03 13:01:48 +01:00
Rémi Verschelde
591100cbd6
Merge pull request #70429 from BastiaanOlij/check_more_vulkan_extensions
Enabling additional vulkan extension and adding further checks
2023-01-23 20:10:19 +01:00
Rémi Verschelde
5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
kobewi
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
Bastiaan Olij
318656d326 Enabling additional vulkan extension and adding further checks 2023-01-15 14:49:15 +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
Bastiaan Olij
2562c06032 Fix issue where we should be using device supported version instead of instance version for Vulkan 2022-12-05 10:12:07 +11:00
Bastiaan Olij
a479f5af22 Improve logic for detecting and tracking extensions 2022-11-24 21:48:16 +11:00
Bastiaan Olij
616ba8745f Fix VRS issues 2022-11-17 00:32:42 +11:00
Rémi Verschelde
f7c611ab71
Style: Misc docs and comment style and language fixes
- Removed empty paragraphs in XML.
- Consistently use bold style for "Example:", on a new line.
- Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`).
- Fix invalid usage of backticks for inline code in BBCode.
- Fix some American/British English spelling inconsistencies.
- Other minor fixes spotted along the way, including typo fixes with codespell.
- Don't specify `@GlobalScope` for `enum` and `constant`.
2022-11-02 19:01:18 +01:00
Rémi Verschelde
5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Rémi Verschelde
e12043ae3a
Merge pull request #67729 from Riteo/workaround-extension-feature-bug
Check for a Vulkan extension before checking its features
2022-10-31 10:48:35 +01:00
Clay John
c51a42778d
Merge pull request #67541 from RandomShaper/refactor_subgroup_ads
Let the RD driver itself expose subgroup caps
2022-10-24 12:02:06 -07:00
Riteo
3ef598c9f8 Check for a Vulkan extension before checking its features
For some reason AFAICT mesa reports a feature as enabled even when its
extension isn't supported. The Vulkan specification says nothing aboutd
this so this is technically more of a workaround, but it works.
2022-10-22 15:31:42 +02:00
Pedro J. Estébanez
ae38d7930e Let the RD driver itself expose subgroup caps 2022-10-20 19:37:35 +02:00
Riteo
dca76957b2 Use opaque composition if transparency is disabled 2022-10-19 11:01:53 +02:00
kobewi
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Bastiaan Olij
64a78c3dad Added fallback to vkCreateRenderPass if VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME isn't supported 2022-10-12 09:31:56 +11:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
bruvzg
6afb2d0225
[Windows] Fix LLVM MinGW build. 2022-10-06 09:30:25 +03:00
Rémi Verschelde
8a47cdc933 Vulkan: Initialize VK_EXT_debug_utils only for dev build or verbose mode
End users would get spammed with messages of varying verbosity due to the
mess that thirdparty layers/extensions and drivers seem to leave in their
wake, making the Windows registry a bottomless pit of broken layer JSON.

I'm all for helping end users clean up mess in their registry / system paths
for Vulkan ICDs, layers and extensions, but the way this is done by
VK_EXT_debug_utils is just horrible - and the way for them to fix it (manual
edit of system files) is also not a good thing to recommend.

Closes countless issues where users think Godot is broken because it reports
weird errors.
2022-10-04 16:09:11 +02:00
Rémi Verschelde
85fe6ecc32 Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used 2022-09-28 17:05:34 +02:00
bruvzg
57829b7cc4
Re-enable per-pixel transparency support on Linux, macOS, and Windows (for Vulkan and OpenGL rendering drivers). 2022-09-03 19:16:03 +03:00
Pedro J. Estébanez
994d2faf97 Let platforms override the sizing of Vulkan swapchain and window 2022-08-25 19:16:36 +02:00
Pedro J. Estébanez
8a3bc72954 Apply correct formatting to comments in the Vulkan driver 2022-08-09 22:11:20 +02:00
Hugo Locurcio
d2271eb300
Improve error message when the requested V-Sync mode cannot be used 2022-08-04 00:15:09 +02:00