Commit graph

2681 commits

Author SHA1 Message Date
bruvzg f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde b78aa4fe19 Style: Apply clang-tidy to current code, add readability-redundant-member-init 2022-04-04 21:49:51 +02:00
Rémi Verschelde f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Bastiaan Olij b8be7903f3 Move storage for Mesh, MeshInstance, MultiMesh and Skeleton into MeshStorage 2022-04-02 16:29:04 +11:00
jfons e69d762dd0 Add color pass flags to Forward Clustered renderer
This commit removes a lot of enum values related to the color render pass in favor of a new flag-bases approach. This means instead of hard-coding all the possible option combinations into enums, we can write our logic by checking a bit-mask.

The changes in rendering_device_vulkan.cpp add support for unused attachments. That means RenderingDeviceVulkan::framebuffer_create() can take null RIDs in the attachments vector, which will result in VK_ATTACHMENT_UNUSED entries in the render pass.

This is used in this same PR to establish fixed locations for the color pass attachments (only color and separate specular so far, but TAA will add motion vectors as well). This way the attachment locations in the shader can stay the same regardless of which attachments are actually used.

Right now all the combinations of flags are generated, but we will need to add a way to limit the amount of combinations in the future.
2022-04-01 12:12:49 +02:00
Rémi Verschelde 155a94fabe
Merge pull request #59385 from BastiaanOlij/extract_shader_storage 2022-03-31 19:19:03 +02:00
Rémi Verschelde a647fb3e62 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-03-31 14:07:29 +02:00
Bastiaan Olij 36defd1179 Extract global variable, shader and material storage 2022-03-31 21:49:42 +11:00
Pedro J. Estébanez 171e31de68 vk_mem_alloc: Update to upstream + Replace use of deprecated items 2022-03-29 11:28:09 +02:00
Bastiaan Olij 0fe06e9467 Extract Decal and Decal atlas from Storage class 2022-03-21 12:22:43 +11:00
Yuri Roubinsky 0d9aecd967 Rename several transform built-ins in shaders 2022-03-18 12:10:55 +03:00
Hugo Locurcio c45d2c242b Replace DirectionalLight3D's use_in_sky_only with sky_mode enum
3 options are available:

- Light and Sky (default)
- Light Only (new)
- Sky Only (equivalent to `use_in_sky_only = true`)

Co-authored by: clayjohn <claynjohn@gmail.com>
2022-03-17 14:00:02 -07:00
Rémi Verschelde e142c10fc5
Merge pull request #58993 from notSanil/device-limit-exceeded-fix 2022-03-17 19:55:40 +01:00
notSanil 36fa7059ed Fix device limit exceeding for uniform buffer 2022-03-16 16:52:35 +05:30
Bastiaan Olij 57e5a33623 Split dummy renderer classes into separate files
Split canvas_texture_storage and texture_storage from render_storage class
2022-03-16 17:43:10 +11:00
kobewi 39d429e497 Change some math macros to constexpr
Changes `MAX`, `MIN`, `ABS`, `CLAMP` and `SIGN`.
2022-03-09 16:24:32 +01:00
Rémi Verschelde 9b05f29894 Remove unused GDNative code
This has been superseded by GDExtension so this code is no longer useful
nor usable.

There's still some GDNative-related stuff in platform export code which
needs to be adapted for GDExtension (e.g. to include GDExtension libraries
in exports).
2022-03-09 13:59:03 +01:00
Rémi Verschelde 1561737055
Merge pull request #49447 from Calinou/remove-shadow-color-property
Remove unused `shadow_color` property from Light3D
2022-03-08 07:48:05 +01:00
reduz b0ca03b0a2 Add a UniformSet cache
* Changed syntax usage for RD::Uniform to create faster with a single RID
* Converted render pass setup to use this in clustered renderer to test.

This is the first step into creating a proper uniform set cache system to simplify large parts of the codebase.
2022-03-06 13:03:33 +01:00
Hugo Locurcio aea104deb7
Remove unused shadow_color property from Light3D
This shadow color property was no longer effective since the shaders
were optimized to improve occupancy.
2022-03-04 23:12:18 +01:00
Rémi Verschelde 44e82f7073 GLES3: Fix -Wmaybe-uninitialized warning for MipMaps::Size 2022-03-04 17:09:53 +01:00
Rémi Verschelde 3078b92dff
Merge pull request #58512 from Calinou/light3d-add-distance-fade 2022-03-04 12:26:29 +01:00
Bastiaan Olij fe5bb06df9 Fixing retrospective code for specialisation constants 2022-03-01 00:10:33 +11:00
Hugo Locurcio b1a295b739
Implement distance fade properties in OmniLight3D and SpotLight3D
This can be used to fade lights and their shadows in the distance,
similar to Decal nodes. This can bring significant performance
improvements, especially for lights with shadows enabled and when
using higher-than-default shadow quality settings.

While lights can be smoothly faded out over distance, shadows are
currently "all or nothing" since per-light shadow color is no longer
customizable in the Vulkan renderer. This may result in noticeable
pop-in when leaving the shadow cutoff distance, but depending on the
scene, it may not always be that noticeable.
2022-02-25 15:17:35 +01:00
bruvzg 6325ed6705
Fix build for macOS / iOS with the statically linked MoltenVK after VMA update. 2022-02-25 11:52:54 +02:00
Pedro J. Estébanez 801741e787 vk_mem_alloc: Update to upstream + Adapt approach to small objects pooling
This updates VMA and instead of using the custom small pool approach from 4e6c9d3ae9, lazily creates pools for the relevant memory type indices, which doesn't require patching VMA.

Also, patches already merged upstream or not needed any longer are removed.
2022-02-24 14:30:55 +01:00
Bastiaan Olij a78a9fee71 Implementing OpenXR driver 2022-02-23 12:02:24 +01:00
clayjohn fe49244611 Use Filament specular models and parametrization 2022-02-22 19:39:41 -08:00
Bastiaan Olij 1034459d61 vkQueueSubmit needs pWaitDstStageMask sized to waitSemaphoreCount 2022-02-19 13:43:46 +11:00
Rémi Verschelde 488116e4d8
Merge pull request #58236 from bruvzg/win_min_fix 2022-02-18 09:07:10 +01:00
Rémi Verschelde 3a008fc1a2
Merge pull request #58186 from BastiaanOlij/fix_shader_features_init
Enable features we require when creating a Vulkan Device
2022-02-18 00:22:17 +01:00
bruvzg 0c27667124 [Windows] Fix Vulkan driver crash on sub-window minimization. 2022-02-17 13:34:08 +02:00
Bastiaan Olij d7465d7c6a We were only getting our available shader features, now we also enabling them 2022-02-17 00:50:38 +11:00
Rémi Verschelde b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
reduz 4f73d3beb4 Add Particle Shader Userdata
* Adds optional vec4 USERDATA1 .. USERDATA6 to particles, allowing to store custom data.
* This data is allocated on demand, so shaders that do not use it do not cost more.
2022-02-15 19:20:31 +01:00
Fabio Alessandrelli 6b5634b96a [OS/Crypto] Add get_entropy to OS.
Implemented via `BCryptGenRandom` on Windows.
Implemented via `getentropy` syscall when available.
Implemented via `/dev/urandom` device as a fallback.

The `/dev/urandom` fallback can be disabled via the `NO_URANDOM` build
flag.

Note: The HTML5 version relies on emscripten file system urandom
device which itself uses the Crypto API when available or the plain
old not crypto-safe `Math.random()` otherwise.

Restore get_entropy.
2022-02-14 10:45:50 +01:00
Pedro J. Estébanez 4e6c9d3ae9 Add a separate pool for small allocations in Vulkan RD 2022-02-12 12:47:08 +01:00
Rémi Verschelde 67c6442844
Merge pull request #57628 from Calinou/shadow-atlas-default-enable-16-bits 2022-02-10 17:19:37 +01:00
Rémi Verschelde 1bdb82c64e
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.
2022-02-10 12:30:19 +01:00
Bastiaan Olij eb9d8ad44a Nitpicking, VK_VERSION_* have been deprecated, replaced by VK_API_VERSION_*. 2022-02-09 15:04:47 +11:00
Hugo Locurcio e4eafb254a
Enable 16-bit shadow atlas by default in the RenderingServer methods
16-bit shadow atlases are already the default in the project settings,
but low-level methods used 24-bit shadows by default.

This makes low-level methods more consistent with the default project
settings to avoid accidental performance issues when users change
the shadow size at run-time.
2022-02-04 16:41:08 +01:00
Nathan Franke 8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06:00
Fabio Alessandrelli 49297d937c [Net] Simplify IP resolution code, fix caching.
First, we should not insert into cache if the hostname resolution has
failed (as it might be a temporary internet issue), second, the async
resolver should also properly insert into cache.

Took the chance to remove some duplicate code with critical section in
it at the cost of little performance when calling the blocking
resolve_hostname function.
2022-01-29 01:56:36 +01:00
Rémi Verschelde 9686d680b7
Merge pull request #57116 from bruvzg/win_net_share 2022-01-28 11:03:23 +01:00
Rémi Verschelde 58324f4df8
Merge pull request #54574 from Ansraer/glow_map 2022-01-26 13:39:51 +01:00
bruvzg cba8280515 [Windows] Add support for handling network share paths. 2022-01-24 16:22:59 +02:00
Rémi Verschelde 9b9440165b
Merge pull request #54890 from briansemrau/threadsafe-drawpute-lists
Make draw/compute lists threadsafe
2022-01-22 20:20:07 +01:00
Ansraer 90652b1755 add support for glow maps 2022-01-20 16:47:25 +01:00
Rémi Verschelde cba2fd2e80
Revert "Add new scaling modes for splash screen"
This reverts commit fcc9f5ce39.

The feature is good but the implementation still needs more work.
A new PR will be made with a rework of this commit.
2022-01-19 16:09:52 +01:00
Rémi Verschelde 8b8e858778
Merge pull request #54489 from briansemrau/texture-delete-update 2022-01-19 10:10:54 +01:00