Commit Graph

499 Commits

Author SHA1 Message Date
Dario
4ad424234f Improve synchronization of rendering commands after changes from transfer queues.
Fix an error where barriers are expected to be inserted for the swap chain textures.
Add the relevant synchronization stages and accesses to resources between frames.
Fix an error where debug labels weren't finished correctly between frames.
Breadcrumbs are now behind an optional macro as they currently lead to synchronization errors which are harmless.
2024-10-21 11:27:56 -03:00
Dario
8c3e46b13b Move transitions of textures initialized by transfer workers to the main graphics queue.
Also adds a new possible texture layout and API trait to support a particular behavior in D3D12 where only the COMMON layout is supported in copy queues. Fixes #98158.
2024-10-18 09:15:25 -03:00
Dario
e2c6daf7ef Implement asynchronous transfer queues, thread guards on RenderingDevice. Add ubershaders and rework pipeline caches for Forward+ and Mobile.
- Implements asynchronous transfer queues from PR #87590.
- Adds ubershaders that can run with specialization constants specified as push constants.
- Pipelines with specialization constants can compile in the background.
- Added monitoring for pipeline compilations.
- Materials and shaders can now be created asynchronously on background threads.
- Meshes that are loaded on background threads can also compile pipelines as part of the loading process.
2024-10-02 15:11:58 -03:00
Gergely Kis
146ba4106f Move Vulkan includes to a central godot_vulkan.h header
Also fixes Vulkan build problem with recent Clang.
2024-09-29 17:53:18 +02:00
Rémi Verschelde
a4c1804cab
Merge pull request #97483 from akien-mga/clang-format-19.1.0
CI: Update `clang-format` pre-commit hook to 19.1.0
2024-09-26 12:46:04 +02:00
Rémi Verschelde
c92a6c7e27
CI: Update clang-format pre-commit hook to 19.1.0 2024-09-26 11:46:12 +02:00
Thaddeus Crews
9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
Sander
41fdc55b05 Vulkan: account for externally backed textures (i.e., created via texture_create_from_extension()), as such textures lack ownership information.
More info: #96832
2024-09-12 18:15:23 +03:00
Rémi Verschelde
61be39aed2
Merge pull request #96045 from darksylinc/matias-TheForge-pr02
Add `VK_EXT_astc_decode_mode` support
2024-09-02 12:13:04 +02:00
Matias N. Goldberg
59d0422dcd Disable extra memory tracking by default
PR #90993 added several debugging utilities.

Among them, advanced memory tracking through the use of custom
allocators and VK_EXT_device_memory_report.

However as issue #95967 reveals, it is dangerous to leave it on by
default because drivers (or even the Vulkan loader) can too easily
accidentally break custom allocators by allocating memory through std
malloc but then request us to deallocate it (or viceversa).

This PR fixes the following problems:
 - Adds --extra-gpu-memory-tracking cmd line argument
 - Adds missing enum entries to
RenderingContextDriverVulkan::VkTrackedObjectType
 - Adds RenderingDevice::get_driver_and_device_memory_report
    - GDScript users can easily check via print(
RenderingServer.get_rendering_device().get_driver_and_device_memory_report()
)
- Uses get_driver_and_device_memory_report on device lost for appending
further info.

Fixes #95967
2024-08-24 20:52:39 -03:00
Matias N. Goldberg
d26c2f86cc Add VK_EXT_astc_decode_mode support
The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.
2024-08-24 17:58:12 -03:00
Matias N. Goldberg
38ae58bda2 Fix build error in arm32
Fixes #95973
2024-08-23 12:52:47 -03:00
Matias N. Goldberg
364f916f3f
Add debug utilities for Vulkan
Features:
- Debug-only tracking of objects by type. See
get_driver_allocs_by_object_type et al.
 - Debug-only Breadcrumb info for debugging GPU crashes and device lost
 - Performance report per frame from get_perf_report
- Some VMA calls had to be modified in order to insert the necessary
memory callbacks

Functionality marked as "debug-only" is only available in debug or dev
builds.

Misc fixes:
 - Early break optimization in RenderingDevice::uniform_set_create

============================

The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.
2024-08-21 23:48:08 +02:00
David Snopek
e018eabe1e Fix building with use_volk=yes on MacOS 2024-06-19 08:06:44 -05:00
Rémi Verschelde
940d629070
vulkan: Update all components to Vulkan SDK 1.3.183.0
Pass `VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE5_BIT` to VMA when using Vulkan 1.3
features.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2024-06-03 10:25:46 +02:00
Rémi Verschelde
f2796fa06d
Merge pull request #91769 from DarioSamo/d3d12_enhanced_barriers
Add support for enhanced barriers in D3D12.
2024-05-31 14:15:49 +02:00
bruvzg
628c81d2d9
[DisplayServer] Add method to check if window transparency is supported and enabled. 2024-05-23 15:23:18 +03:00
Dario
adabd14d08 Add support for enhanced barriers in D3D12.
Enables support for enhanced barriers if available.

Gets rid of the implementation of [CROSS_FAMILY_FALLBACK] in the D3D12 driver. The logic has been reimplemented at a higher level in RenderingDevice itself.

This fallback is only used if the RenderingDeviceDriver reports the API traits and the capability of sharing texture formats correctly. Aliases created in this way can only be used for sampling: never for writing. In most cases, the formats that do not support sharing do not support unordered access/storage writes in the first place.
2024-05-20 13:04:44 -03:00
Rémi Verschelde
68ac4ee358
Merge pull request #80232 from Calinou/vulkan-pipeline-cache-improve-messages
Improve warning messages related to Vulkan pipeline cache
2024-05-20 17:06:25 +02:00
Dario
d5789e09eb Add optional driver workaround to RenderingDevice for Adreno 6XX.
Co-authored-by: Clay John <claynjohn@gmail.com>
2024-05-13 10:20:31 -03:00
A Thousand Ships
86de59d60a
[Core] Add LocalVector::has for convenience 2024-05-06 18:03:37 +02:00
Bastiaan Olij
9042ddf19f Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +10:00
Dario
b95e18f557 Fix crash on compatibility fallback when vkCreateRenderPass2KHR is unavailable. 2024-04-25 14:03:02 -03:00
Hugo Locurcio
4a615924f8 Improve warning messages related to Vulkan pipeline cache
This gives better explanations on why the cache may have been invalidated,
along with usual consequences.

These messages have also been moved to verbose prints, as users
cannot do anything to resolve them specifically (so they are mostly
relevant to developers).
2024-03-26 22:42:27 +01:00
A Thousand Ships
79ba22a73f
Use Vector* component-wise min/max/clamp functions where applicable 2024-03-20 13:47:42 +01:00
Rémi Verschelde
ec55028f26
Merge pull request #89209 from RandomShaper/padding_for_dummies
Make shader binary alignment handling simpler and more robust
2024-03-06 13:17:09 +01:00
Pedro J. Estébanez
f77b4d155b Make shader binary alignment handling simpler and more robust
Bonus:
Also simplified the rounding to block size in image size calculations.
2024-03-06 11:48:23 +01:00
Rémi Verschelde
e74f4ea115
Vulkan: Don't warn about pipelines cache if missing
It used to warn when opening a new project because no cache pre-exists,
which isn't particularly helpful.

Also include the rendering method in the cache filename, as it differs
between Forward+ and Mobile for a same GPU.
2024-03-05 16:39:14 +01:00
Dario
ee2d8f68ba Merge execute and present commands for RenderingDeviceDriver. 2024-02-19 13:09:03 -03:00
Dario
24fcee6d67 Handle VK_SUBOPTIMAL_KHR as a valid error code to fix Android performance. 2024-02-15 10:59:36 -03:00
Dario
73eff10c76 Finish splitting functionality of the Vulkan and D3D12 backends into RenderingDeviceDriver. 2024-02-12 10:02:18 -03:00
Riteo
7e0f7d3abd Add Wayland support
Not everything is yet implemented, either for Godot or personal
limitations (I don't have all hardware in the world). A brief list of
the most important issues follows:

- Single-window only: the `DisplayServer` API doesn't expose enough
information for properly creating XDG shell windows.

- Very dumb rendering loop: this is very complicated, just know that
the low consumption mode is forced to 2000 Hz and some clever hacks are
in place to overcome a specific Wayland limitation. This will be
improved to the extent possible both downstream and upstream.

- Features to implement yet: IME, touch input, native file dialog,
drawing tablet (commented out due to a refactor), screen recording.

- Mouse passthrough can't be implement through a poly API, we need a
rect-based one.

- The cursor doesn't yet support fractional scaling.

- Auto scale is rounded up when using fractional scaling as we don't
have a per-window scale query API (basically we need
`DisplayServer::window_get_scale`).

- Building with `x11=no wayland=yes opengl=yes openxr=yes` fails.

This also adds a new project property and editor setting for selecting the
default DisplayServer to start, to allow this backend to start first in
exported projects (X11 is still the default for now). The editor setting
always overrides the project setting.

Special thanks to Drew Devault, toger5, Sebastian Krzyszkowiak, Leandro
Benedet Garcia, Subhransu, Yury Zhuravlev and Mara Huldra.
2024-01-30 16:44:47 +01:00
Dario
39f279710c Improve stage and slice tracking behavior of RenderingDeviceGraph to fix various synchronization issues. 2024-01-26 10:12:54 -03:00
Rémi Verschelde
1248fb9c18
Merge pull request #86855 from RandomShaper/fix_vk_get_image
Fix determination of copyable layout for compressed textures in Vulkan
2024-01-15 13:25:24 +01:00
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
e1c7c18ead Fix determination of copyable layout for compressed textures in Vulkan 2024-01-06 00:06:28 +01:00
Rémi Verschelde
f3df5f7d37
Merge pull request #86435 from jsjtxietian/fix-fp-unsupport
Add `RD_ENABLED` when `VULKAN_ENABLED` or `D3D12_ENABLED` is added
2024-01-02 15:09:05 +01:00
jsjtxietian
078bfae6a4 Add RD_ENABLED when VULKAN_ENABLED or D3D12_ENABLED is added 2023-12-25 11:13:01 +08:00
warriormaster12
e729d511df Fix wrong error message when graphics pipeline creation fails 2023-12-21 22:32:58 +02: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
Yuri Sizov
b0339b68ff Merge pull request #85532 from RandomShaper/kill_redund_clear
Apply some low-hanging fruit optimizations to Vulkan RD
2023-12-08 15:23:36 +01:00
Rémi Verschelde
a9ba8695d4
Merge pull request #84852 from Alex2782/fix_vulkan_buffer_android
Vulkan: Fix incorrect access to the buffers on Android
2023-12-04 23:06:04 +01:00
Rémi Verschelde
6f4da7a976
Merge pull request #83736 from darksylinc/matias-broken_buffer_update
Fix buffer updates going to the wrong cmd buffer if barriers were 0
2023-12-04 22:58:24 +01:00
Pedro J. Estébanez
72bf8dfecf Remove superfluous locking in RID owners in Vulkan RD 2023-12-01 16:12:21 +01:00
Pedro J. Estébanez
4964d9a083 Remove redundant explicit clears in the Vulkan RD 2023-12-01 16:11:59 +01:00
Alexander Hartmann
04a142cf71 Vulkan: Fix incorrect access to the buffers on Android 2023-11-15 14:46:25 +01:00
Rémi Verschelde
ba713c80df
Fix various typos with codespell
Using 2.2.7.dev51+geb4a58fe.
2023-11-11 23:01:24 +01:00
bruvzg
25dc729dd4
Parse OpenGL and Vulkan strings as UTF-8. 2023-10-30 17:24:31 +02:00
Matias N. Goldberg
c9ec1f7727 Fix buffer updates going to the wrong cmd buffer if barriers were 0
From what I could see only SSAO & SSIL were affected when they both
call:

int zero[1] = { 0 };
RD::get_singleton()->buffer_update(ssao.importance_map_load_counter, 0,
sizeof(uint32_t), &zero, 0);

int zero[1] = { 0 };
RD::get_singleton()->buffer_update(ssil.importance_map_load_counter, 0,
sizeof(uint32_t), &zero, 0);

Also documented what setup_command_buffer & draw_command_buffer are for.
2023-10-21 13:14:38 -03:00