Commit graph

204 commits

Author SHA1 Message Date
reduz cf3f404d31 Implement Binary Shader Compilation
* Added an extra stage before compiling shader, which is generating a binary blob.
* On Vulkan, this allows caching the SPIRV reflection information, which is expensive to parse.
* On other (future) RenderingDevices, it allows caching converted binary data, such as DXIL or MSL.

This PR makes the shader cache include the reflection information, hence editor startup times are significantly improved.
I tested this well and it appears to work, and I added a lot of consistency checks, but because it includes writing and reading binary information, rare bugs may pop up, so be aware.
There was not much of a choice for storing the reflection information, given shaders can be a lot, take a lot of space and take time to parse.
2021-07-26 08:40:39 -03:00
Rémi Verschelde ff0b5f8fa1
Merge pull request #50809 from akien-mga/iterators-const-references 2021-07-25 12:52:58 +02:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
luz paz 3564c16cb8
Fix various typos with codespell
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-25 11:21:51 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
bruvzg 53f84e39fd Fix MoltenVK static linking on macOS (add missing include path, Vulkan SDK path option, use xcframework instead of static framework). 2021-07-22 16:29:24 +03:00
reduz 76e25438c9 Fixes to forward mobile
* use valid format for framebuffer: VK_FORMAT_A2B10G10R10_UNORM_PACK32
* Unfortunately cant be used for compute.
* Mobile will need to do refprobe, sky, mipmapblurring using raster.
2021-07-15 21:05:58 -03:00
reduz ad9f606ed8 Use specialization constants in clustered renderer
* Keep track of when projector, softshadow or directional sofshadow were enabled.
* Enable them via specializaton constant where it makes sense.
* Re-implements soft shadows.
* Re-implements light projectors.
2021-07-12 20:33:52 -03:00
reduz b2f6db7aa8
Implement Specialization Constants
* Added support to our local copy of SpirV Reflect (which does not support it).
* Pass them on render or compute pipeline creation.
* Not implemented in our shaders yet.
2021-07-11 23:16:09 +02:00
Hugo Locurcio a2d5f191d8
Merge pull request #48622 from Geometror/reimplement-disableable-vsync 2021-07-10 01:02:23 +02:00
reduz 83addd6ee5 Fix material invalidation on reimport.
* IF a texture was reimported (calling replace as an example), it would invalidate all materials using it, causing plenty of errors.
* Added the possibility to get a notification when a uniform set is erased.
* With this notification, materials can be queued for update properly.
2021-07-07 19:55:20 -03:00
reduz 24efb13f7e Fix threaded update for textures
* Previews and other stuff now works again.
* Not the best solution, will have to be improved in the future usinc async queues where supported.
2021-07-07 18:06:06 -03:00
Hendrik Brucker 043ae91560 Restructure and reimplement vsync options
-Add a v-sync mode setting which allows to choose between DISABLED, ON, ADAPTIVE and MAILBOX
-Removed the V-Sync via Compositor option
2021-07-06 16:34:26 +02:00
reduz 6c55d2aad2 Fix Render Info
* Fixed and redone the process to obtain render information from a viewport
* Some stats, such as material changes are too difficult to guess on Vulkan, were removed.
* Separated visible and shadow stats, which causes confusion.
* Texture, buffer and general video memory can be queried now.
* Fixed the performance metrics too.
2021-07-03 10:15:04 -03:00
K. S. Ernest (iFire) Lee d87526b391 Enum constant in boolean context
error: enum constant in boolean context [-Werror=int-in-bool-context]
2021-06-30 01:38:56 -07:00
reduz 4d19c052f7 Fix Context Validation Layer Errors
* Multisampling was wrongly selected, possibly fixes #49937
* Image semaphore acquisition is now per window, possibly fixes #41614

Please make sure to test the above two issues again, since I can't reproduce either anyway.
2021-06-28 17:43:10 -03:00
reduz bde6f5eed1 Implement Framebuffer Subpass support
* Required for better optimizing mobile platforms
* Will be used by the Vulkan mobile renderer.
2021-06-24 15:59:15 -03:00
Bastiaan Olij 15c1a76361 Add stereoscopic rendering through multiview 2021-06-13 22:52:20 +10:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Rémi Verschelde ba82626c2c
Merge pull request #49506 from akien-mga/vulkan_prefer_discrete_gpu
Prefer discrete GPU over integrated one
2021-06-11 13:34:38 +02:00
Blazej Floch 36130e5a05
Prefer discrete GPU over integrated one
This unblocks launching on Linux laptops that default to the integrated
GPU which can not handle Vulkan in many instances.
Ideally a manual device selection, or an option for the optimal selection
strategy should be provided via CLI or config, but for the time being
this will unblock the Linux devs.

Partially addresses #42348 and #43714
2021-06-11 13:02:30 +02:00
Rémi Verschelde c1c76850cb
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.
2021-06-07 11:03:08 +02:00
Rémi Verschelde 4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Hugo Locurcio 064ca9adae
Remove debugging prints in the Linux DisplayServer
Some Vulkan debugging prints were also changed to be printed only
in verbose mode.
2021-05-08 19:07:50 +02:00
Bastiaan Olij 90ef5d73c4 Cleanup vulkan capabilities check and add multiview check 2021-05-06 12:06:07 +10:00
Hugo Locurcio bf7c4da804
Tweak warning messages related to leaked RIDs
- Use hardcoded pluralization for messages.
  - Since these messages are English-only, it's fine to hardcode it.
- Use double quotes for consistency with other messages.
2021-05-03 16:05:38 +02:00
Rémi Verschelde 5b16020846
Replace remaining uses of NULL with nullptr
Follow-up to #38736 (these uses were likely added after this PR was merged).
2021-04-29 11:53:27 +02:00
Rémi Verschelde 8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Szymon Majewski 0a29322991 Validation layers on Android 2021-04-12 10:09:06 -07:00
Rémi Verschelde 9e8acb3897
Merge pull request #47640 from BastiaanOlij/fix_vulkan_format
Chose format from supported ones that we support
2021-04-05 14:55:32 +02:00
Bastiaan Olij ceebe4b565 Chose format from supported ones that we support 2021-04-05 22:39:17 +10:00
Rémi Verschelde 9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
Szymon Majewski 1328208063 Removed debug code 2021-04-01 20:09:48 -07:00
Rémi Verschelde 8621c86f4d
Merge pull request #47283 from Panquesito7/fix_lgtm_alerts
fix: 3 LGTM alerts/warnings
2021-03-31 18:52:04 +02:00
David Leal a31626ae0b
fix: 3 LGTM alerts/warnings 2021-03-31 10:34:40 -06:00
Rémi Verschelde 9cd1e50969
Merge pull request #47250 from BastiaanOlij/check_vulkan_version
Obtain supported Vulkan API
2021-03-31 13:45:43 +02:00
Szymon Majewski c3de4aeb75 WIP: Add support for VK_EXT_debug_report in Vulkan 2021-03-30 10:18:16 -07:00
Bastiaan Olij a6c989bc1b Obtain supported Vulkan API 2021-03-26 12:06:57 +11:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Rafał Mikrut f9d0ea9f6b Fix memory leak in VulkanContext 2021-03-07 15:28:47 +01:00
reduz 33278b0721 Fixes to get Godot running again on Intel IGP
-Fixed strange bug with shadowed instance_param (this should not have worked anywhere, odd..)
-Cleaned up barrier usage further.
2021-02-05 00:02:06 -03:00
reduz f20999f6fe Rewrote how barriers work for faster rendering
-Added more finegrained control in RenderingDevice API
-Optimized barriers (use less ones for thee same)
-General optimizations
-Shadows render all together unbarriered
-GI can render together with shadows.
-SDFGI can render together with depth-preoass.
-General fixes
-Added GPU detection
2021-02-04 09:42:28 -03:00
bruvzg 7be7e87ff3
Always init DEBUG_UTILS_MESSENGER_CREATE_INFO structure if DEBUG_UTILS functions are used. Add temporary variables to fix potential use-after-free. 2021-02-02 11:27:47 +02:00
Rémi Verschelde 96bcaadbf2
Merge pull request #45476 from qarmin/add_temp_variable
Add temporary variable to not use freed memory
2021-01-26 17:14:46 +01:00
reduz 280f334f81 Reorganize RenderingDevice barriers
-Removed sync to draw, now everything syncs to draw by default.
-Fixed many validation layer errors.
-Added support for VkImageViewUsageCreateInfo to fix validation layer warnings.
-Texture, buffer, raster and compute functions now all allow spcifying which barriers will be used.
2021-01-26 10:24:12 -03:00
Rafał Mikrut b80c502c2c Add temporary variable to not use freed memory 2021-01-26 13:41:42 +01:00
clayjohn 7323cbab4b Add named resources and debug labels in RenderDoc 2021-01-25 20:04:13 -08:00
reduz a9beb7aa8c Shadow map rendering optimization
-All shadow rendering is done with raster now (no compute)
-All shadow rendering is done by rendering directly to the shadow atlas
-Improved how buffer clearing is done to optimize the above.
-Ability to set shadows as 16 bits.
2021-01-24 20:17:28 -03:00
reduz 099dee35f4 Added GPU based cluster builder
Clustering is now GPU based, uses an implementation based on the Activision algorithm.
2021-01-19 23:31:06 +01:00
Rémi Verschelde 07e89131c6
spirv-reflect: Update to upstream commit c0ce03a (Jan 6, 2021) 2021-01-08 14:30:44 +01:00