Commit graph

2427 commits

Author SHA1 Message Date
Rémi Verschelde 0c5d3b838c
Merge pull request #44199 from bruvzg/pvs_fixes_1
PVS-Studio static analyzer fixes
2020-12-09 10:23:21 +01:00
bruvzg 644f739660
Static analyzer fixes:
Removes unused code in OS.
Fixes return types.
Fixes few typos.
2020-12-09 10:17:53 +02:00
Rémi Verschelde e5e1277ecd
Merge pull request #44161 from Faless/fix/fa_buffered_remove
Remove unused FileAccessBuffered
2020-12-09 09:14:14 +01:00
David Snopek 26f1d05400 Fix dummy rasterizer so that javascript can build again 2020-12-06 18:29:32 -06:00
Fabio Alessandrelli 781efc26e0 Remove now unused FileAccessBuffered. 2020-12-06 19:37:11 +01:00
Aaron Franke 5dddf4377a
Rename RD texture "type" to "texture_type"
"type" isn't very descriptive for exposed code, and this variable is exposed via RD_SETGET.
2020-12-04 19:34:50 -05:00
Aaron Franke 19bdd01438
Rename RD uniform "type" to "uniform_type"
"type" isn't very descriptive for exposed code, and this variable is exposed via RD_SETGET.
2020-12-04 19:34:50 -05:00
reduz 2787ad65be RenderingServer reorganization 2020-12-04 18:39:46 -03:00
reduz 70f5972905 Refactored Mesh internals and formats.
-Changed how mesh data is organized, hoping to make it more efficient on Vulkan and GLES.
-Removed compression, it now always uses the most efficient format.
-Added support for custom arrays (up to 8 custom formats)
-Added support for 8 weights in skeleton data.
-Added a simple optional versioning system for imported assets, to reimport if binary is newer
-Fixes #43979 (I needed to test)

WARNING:

-NOT backwards compatible with previous 4.x-devel, will most likely never be, but it will force reimport scenes due to version change.
-NOT backwards compatible with 3.x scenes, this will be eventually re-added.
-Skeletons not working any longer, will fix in next PR.
2020-12-02 13:07:59 -03:00
Fabio Alessandrelli e2a0c44d06 Sync RasterizerDummy changes. 2020-11-30 12:07:20 +01:00
Rémi Verschelde d1943f6a77
Merge pull request #38939 from hbina/vk_error_handling
Better error handling of vkEnumerateInstanceExtensionProperties
2020-11-29 13:03:01 +01:00
Rémi Verschelde ef2d1f6d19
Merge pull request #42761 from fire/color-grading-3d
Environment brightness, contrast, saturation restore with 3d LUT.
2020-11-28 23:07:52 +01:00
clayjohn 076908bed9 Environment brightness, contrast, saturation restore with color correction.
Allow gradients and 2d images.

Use shader versions for LUT in tonemap

Co-authored-by: alex-poe <3957610+CptPotato@users.noreply.github.com>
Co-authored-by: QbieShay <cislaghi.ilaria@gmail.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2020-11-28 07:37:49 -08:00
Hanif Bin Ariffin cc2097c79c Better error handling of vkEnumerateInstanceExtensionProperties
Refer: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkEnumerateInstanceExtensionProperties.html
According to the documentation, there are 2 success code:
1. VK_SUCCESS
2. VK_INCOMPLETE

VK_INCOMPLETE will be returned when not all avaiable properties are returned.
2020-11-28 19:28:23 +08:00
Rémi Verschelde 94341ac547
Merge pull request #42987 from clayjohn/VULKAN-sky-only
Add sky_only setting to DirectionalLight3Ds
2020-11-28 09:07:09 +01:00
Cooper Harasyn 25b2f82ccf Prevent ALSA audio corruption
When using the ALSA driver, corruption would occur if `snd_pcm_writei`
was unable to consume the entire sound buffer. This would occur
frequently on the Raspberry Pi 3 which uses the `snd_bcm2835` audio
driver.

This bug resulted from incorrect pointer math on line 187, resulting in
the sample source pointer being advanced by `total * ad->channels` bytes
instead of `total * ad->channels` samples. In my opinion, the best fix
is to change `*src` to type `int16_t`, since that is the sample type in
use.

Fixes #43927.
2020-11-27 16:05:59 -05:00
Rafał Mikrut 7bd03b7188 Initialize class/struct variables with default values in core/ and drivers/ 2020-11-23 17:38:46 +01:00
Rémi Verschelde a655de89e3
doc: Warn about using Node internal processing
See #43689.

Also 'fixed' some spelling for behavior in publicly visible strings.
(Sorry en_GB, en_CA, en_AU, and more... Silicon Valley won the tech spelling
war.)
2020-11-20 09:52:37 +01:00
Jordan Schidlowsky e9527d0353 allow vulkan validation layers in release builds if explicity asked for 2020-11-18 14:07:28 -06:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
bruvzg f09a37a8d5
Fixes crash if Vulkan presentation surface is not available. 2020-11-14 13:41:13 +02:00
Fabio Alessandrelli 25d56e9666 RasterizerDummy fixes. 2020-11-10 11:42:51 +01:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
John Zulauf 784f8fbbe5 Synchronization - Clean subpass dependency init
Fix incorrect subpass dependency initialization
2020-10-29 15:53:47 -06:00
Rémi Verschelde 6a951267ae
vulkan: Backport build fix for MinGW-w64 8.0.0
Taken from https://github.com/KhronosGroup/Vulkan-Loader/pull/475.

Supersedes and reverts #43119 since the upstream change removes the need for
that custom define.
2020-10-29 12:47:35 +01:00
reduz 8ab9b39707 Implement CanvasGroup and CanvasItem clipping
-Allows merging several 2D objects into a single draw operation
-Use current node to clip children nodes
-Further fixes to Vulkan barriers
-Changed font texture generation to white, fixes dark eges when blurred
-Other small misc fixes to backbuffer code.
2020-10-28 18:53:32 -03:00
Rémi Verschelde 54e6338c9b
Vulkan: Make validation layers optional
They're now disabled by default, and can be enabled with the command line
argument `--vk-layers`.

When enabled, the errors about them being missing are now warnings, as
users were confused and thought this meant Vulkan is broken for them.

Fix crash in `~VulkanContext` when validation layers are disabled (exposed by
this PR since before they could not be disabled without source modification).

Also moved VulkanContext member initializations to header.

Fixes #37102.
2020-10-27 16:19:15 +01:00
K. S. Ernest (iFire) Lee b2d5b619fd Changes for 43094 mingw llvm build error. 2020-10-26 19:58:44 -07:00
Rémi Verschelde 825ab3b784
Merge pull request #42817 from akien-mga/vulkan-sdk-1.2.154.0
vulkan: Sync loader, headers and glslang to sdk-1.2.154.0
2020-10-26 15:15:19 +01:00
Rémi Verschelde d77deda7b6
Merge pull request #43056 from Ev1lbl0w/bugfix-wrong-exitcode
Fix wrong exit code being returned
2020-10-26 08:58:13 +01:00
rsjtdrjgfuzkfg b1f95e150e Fix crash in RenderingDeviceVulkan::shader_create
This commit moves the declaration of a local variable to ensure its
scope survives long enough; at least in some versions of GCC and LLVM
the associated memory was freed too early and thus caused issues ranging
from black screens to crashes.
2020-10-25 22:32:10 +01:00
reduz 84d734da0e Refactored 2D shader and lighting system
-Removed normal/specular properties from nodes
-Create CanvasTexture, which can contain normal/specular channels
-Refactored, optimized and simplified 2D shaders
-Use atlas for light textures.
-Use a shadow atlas for shadow textures.
-Use both items aboves to make light rendering stateless (faster).
-Reorganized uniform sets for more efficiency.
2020-10-24 15:57:25 -03:00
Ev1lbl0w 0d3a168a53
Fix wrong exit code being returned 2020-10-24 19:16:49 +01:00
clayjohn 6299575250 Add sky_only setting to DirectionalLight3Ds 2020-10-21 23:28:08 -07:00
reduz dd0b097e44 Fix invalid buffer updates in SDFGI 2020-10-19 17:39:09 -03:00
Juan Linietsky c71e941ee8
Revert "Revert "Synchronization validation fix patch set 3 (inclusive of all previous patches)"" 2020-10-19 17:32:19 -03:00
Juan Linietsky f11f28936d
Revert "Synchronization validation fix patch set 3 (inclusive of all previous patches)" 2020-10-19 17:04:24 -03:00
Juan Linietsky 791b259a63
Revert "Cause buffer_update to emit error if called during compute/draw list" 2020-10-19 17:00:13 -03:00
Juan Linietsky 5f65eba5c4
Merge pull request #40849 from jzulauf-lunarg/zulauf_buffer_update_err_msg
Cause buffer_update to emit error if called during compute/draw list
2020-10-19 14:10:41 -03:00
Juan Linietsky f9918cbc0e
Merge pull request #42866 from jzulauf-lunarg/zulauf_sync_fixes_3
Synchronization validation fix patch set 3 (inclusive of all previous patches)
2020-10-19 14:10:06 -03:00
Juan Linietsky 53d5a252bb
Revert "Replace SAO implementation with MSSAO" 2020-10-18 19:27:51 -03:00
Juan Linietsky d98261ab8f
Merge pull request #42077 from clayjohn/MSSAO
Replace SAO implementation with MSSAO
2020-10-18 18:34:43 -03:00
clayjohn 366ee46774 Replace SAO implementation with MSSAO 2020-10-18 13:15:51 -07:00
clayjohn 63a34b93aa Optimize Glow with local memory 2020-10-18 11:37:12 -07:00
John Zulauf d2083282c0 Add pre-copy barrier to buffer update
Add a barrier to "safe" the buffer update write from previous accesses
to buffer range being updated.  Remove duplicate unneed barrier.
2020-10-16 19:18:33 -06:00
John Zulauf 459fa078e0 Add subpass sync support for layout transitions
Add additional source and dest mask bits for "from external" and "to
external" subpass dependencies (respectively) when intial and final
layouts cause implicit layout transitions.

This is a big hammer -- any transition in a given direction will create
a full barrier.  Attachment specific stage and access flags could be
used instead with additional logic to deduce the prior and intended
subsequent usages.
2020-10-16 19:17:07 -06:00
John Zulauf 5191a8e9db Sync fix for clear texture
Make pre and post barriers non-conditional on format, as there are cases
where pending operations in the GENERAL layout hazarding with clear.
2020-10-16 15:50:48 -06:00
John Zulauf 9a9f667818 Sync fix texture_get_data bad barrier param
Changed srcStageMask to the valid stage for post transfer barrier.
2020-10-16 15:43:51 -06:00
John Zulauf 3a1f14461a Additional synchronization fixes w/o FORCE_FULL_BARRIER
Additional synchronization fixes from hazards arising from disabling
FORCE_FULL_BARRIER.
2020-10-16 11:33:02 -06:00
John Zulauf 474fc19601 Correct stage masks for storage texture barriers
Change the srcStageMasks and dstStageMasks for the storage texture end
draw barriers to refer to the correct stages for the use.
2020-10-16 11:33:02 -06:00
John Zulauf d92f2e4a2d Add barrier for buffer getting
Add barrier for source buffer when getting.  Refactor common "owner and
stage/access" code to utility function.
2020-10-16 11:33:02 -06:00
John Zulauf 5a77eb5a83 Add fragment stage to texture copy/resolve barriers
Added the fragment stage to the texture copy and resolve final barriers
for source and dest.  As the textures could subsequently be used by the
fragment stage, this was triggering a validation error from the
pre-alpha synchronization validation.
2020-10-16 11:33:02 -06:00
Rémi Verschelde 148ad49c93
vulkan: Sync loader, headers and glslang to sdk-1.2.154.0
Actually sdk-1.2.154.1 for Vulkan-Loader.

glslang is updated to bacaef3237c515e40d1a24722be48c0a0b30f75f which is the
known-good version for Vulkan-ValidationLayers 1.2.154.0.

COPYRIGHT.txt was synced with the current version of the glslang LICENSE.txt,
and `glslang/register_types.cpp` now uses the upstream definition for its
default builtin resource instead of hardcoding it.
2020-10-15 12:29:42 +02:00
Fabio Alessandrelli 4294b1f4bb Fix dummy rasterizer with new interface. 2020-10-13 12:58:05 +02:00
Lorenz Junglas 1107c7f327 Fix nanosleep usage
nanosleep returns 0 or -1 not the error code.
The error code "EINTR" (if encountered) is placed in errno, in which case nanosleep can be safely recalled with the remaining time.

This is required, so that nanosleep continues if the calling thread is interrupted by a signal.

See manpage nanosleep(2) for additional details.
2020-10-12 16:27:31 +02:00
Haoyu Qiu 1998f78679 Hides special folders in FileDialog for macOS 2020-09-28 14:36:21 +08:00
Bartłomiej T. Listwon 317c2b194d Add all headers to VS Project 2020-09-27 18:03:51 +02:00
Fabio Alessandrelli 179e6fabb4 Fix RasterizerDummy, override, cleanup.
Add override keyword to RasterizerDummy methods.
Plus cleanup unused methods, remove virtual keyword.
2020-09-18 18:43:15 +02:00
Rémi Verschelde 01185acecb
NetBSD: Implement OS_Unix::get_executable_path()
Same implementation as OpenBSD seems to work fine.
2020-09-18 11:54:18 +02:00
Rémi Verschelde 5f4d64f4f3
Linux/BSD: Fix support for NetBSD
Add __NetBSD__ to `platform_config.h` so that it can find `alloca`
and use the proper `pthread_setname_np` format.

Rename RANDOM_MAX to avoid conflict with NetBSD stdlib.

Fixes #42145.
2020-09-18 10:27:55 +02:00
Marcel Admiraal 4b3aec50c0 Replace calls to gmtime with gmtime_r and localtime with localtime_r. 2020-09-04 12:22:43 +01:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Marcel Admiraal f6ad1954f7 Ensure header guards enclose entire header. 2020-09-03 11:29:42 +01:00
clayjohn 8da3c739bf Add high quality glow mode 2020-08-31 23:16:41 -07:00
Rémi Verschelde 33b2070d2e Remove obsolete GLES2 backend code
This code currently isn't compiled (and cannot compile).

We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan
(probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite
different so it's not relevant to keep this old Godot 3.2 code.

The `drivers/gles2` code from the `3.2` branch can be used as a reference for
a potential new implementation.
2020-08-13 10:04:53 +02:00
bruvzg d6e3a8a137
[macOS] Fix crash on failed fork. 2020-08-11 17:45:09 +03:00
John Zulauf 98d677ef26 Cause buffer_update to emit error if called during compute/draw list
Add error message to buffer update if a compute or draw list is active.
2020-07-29 14:13:37 -06:00
Rémi Verschelde 3b340985cc SCons: Support linking system Vulkan loader while using vendored VMA 2020-07-26 13:20:08 +02:00
Sergey Minakov fe60815d66 iOS SCons: static Vulkan binary usage
Add VMA to iphone platform Use linkflag for iphone building to enforce static linking. Works fine with dynamic '.framework' library
Updated xcode project to use '.a' static library
2020-07-25 21:55:25 +02:00
Rémi Verschelde dfdfee04df Vulkan: Fix struct init for VkClearAttachment
The changes from #38835 were not sufficient to fix #38829, as VkClearAttachment
still had uninitialized member structs in its VkClearColor member struct.

The struct rabbit hole goes deep and trying to do validation as done in #38829
doesn't appear realistic.
2020-07-22 16:31:22 +02:00
Rémi Verschelde f54fd5ac10
Merge pull request #38835 from madmiraal/fix-38829
Fix may be used unitialized warnings in _render_pass_create() and  _draw_list_insert_clear_region().
2020-07-22 16:12:54 +02:00
Rémi Verschelde a5fb445121
Merge pull request #40450 from asmaloney/spelling
Fix spelling & grammar in comments, docs, and messages
2020-07-21 22:14:04 +02:00
Andy Maloney 4dda62f591 Fix spelling & grammar in comments, docs, and messages 2020-07-21 15:17:23 -04:00
Andy Maloney 8b949918b1 Fix spelling of a var, a struct, and message output 2020-07-17 12:02:06 -04:00
bruvzg 996910b627
Add error messages if Vulkan init failed, prevent Vulkan context freeing uninitialized device and instance. 2020-07-13 19:24:21 +03:00
Rémi Verschelde dcd11faad3
Merge pull request #40253 from madmiraal/add-override-keywords
Add override keywords.
2020-07-10 21:04:23 +02:00
Yuri Roubinsky ecb5f7ea23 Added 'fma' function to shader language 2020-07-10 19:58:03 +03:00
Marcel Admiraal 26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
Johan Rastén e7e632cbed Handle 16 bit PNG files in sRGB format 2020-07-09 21:01:06 +02:00
PouleyKetchoupp e19a3df98f Fixed mesh data access errors in GLES2
1. Removed errors in mesh_surface_get_array as it's supported now
2. More accurate errors in mesh_surface_get_blend_shapes
2020-07-09 13:41:57 +02:00
Nathan Franke 09aeb7706b
Fix Directory Open Check 2020-07-06 11:32:05 -05:00
Rémi Verschelde 9000e59650
Merge pull request #40016 from akien-mga/environment-code-cleanup
Environment: Refactor code for readability + more
2020-07-01 16:28:48 +02:00
Rémi Verschelde a8a2769bb6
Merge pull request #38713 from aaronfranke/string-64bit
Make all String integer conversion methods be 64-bit
2020-07-01 16:01:05 +02:00
Rémi Verschelde 372136fe75 Environment: Refactor code for readability + more
- Makes all boolean setters/getters consistent.
- Fixes bug where `glow_hdr_bleed_scale` was not used.
- Split CameraEffects to their own source file.
- Reorder all Environment method and properties declarations,
  definitions and bindings to be consistent with each other
  and with the order of property bindings.
- Bind missing enum values added with SDFGI.
- Remove unused SDFGI enhance_ssr boolean.
- Sync doc changes after SDFGI merge and other misc changes.
2020-07-01 14:44:45 +02:00
Yuri Roubinsky c554d9e556 Added const qualifier support for function arguments in shaders 2020-07-01 12:55:00 +03:00
Fabio Alessandrelli eb2121d513 Fix RasterizerDummy after SDF GI changes.
Re-enable JavaScript CI.
2020-06-30 21:05:49 +02:00
Juan Linietsky 201d606b3d Addition of SDFGI for open world global illumination
Move GI to a deferred pass
2020-06-26 11:06:48 -03:00
Rémi Verschelde 4b5b60de85
Merge pull request #39189 from touilleMan/issue-38925
Unify OS.get_system_time_* and OS.get_unix_time
2020-06-15 23:57:16 +02:00
Yuri Roubinsky 1a7e101324 Fix shader's length() function parsing in expressions 2020-06-03 19:39:48 +03:00
Rémi Verschelde 5e62a2ee75 Vulkan: Initialize struct members on declaration
Supersedes and closes #38945.
2020-06-03 13:18:22 +02:00
Aaron Franke bb8aa107fd
Remove 32-bit String to_int method 2020-06-03 00:03:34 -04:00
Emmanuel Leblond c6de3872f9
Remove OS.get_system_time_secs/get_system_time_msecs and change OS.get_unix_time return type to double 2020-05-31 14:19:31 +02:00
Nathan Franke e48fb01d59
fix(Directory): remove erasing print
Fixes #39106
2020-05-28 05:46:01 -05:00
CJ DiMaggio 66a294d459 Delete DummyMesh when RasterizerStorageDummy is freed 2020-05-20 21:23:37 -04:00
Marcel Admiraal 19d3e17f01 Fix may be used unitialized warnings in _render_pass_create()
and  _draw_list_insert_clear_region()
2020-05-19 04:14:57 +01:00
Fabio Alessandrelli 90c7102b51 Move mix_rate, ouput_latency to AudioDriverManager
Each driver used to define the (same) project settings values
`audio/mix_rate` and `audio/output_latency`, but the setting names are
not driver specific.
Overriding is still possible via platform tags.
2020-05-18 13:02:06 +02:00
Rémi Verschelde 4f23215395
Merge pull request #38750 from madmiraal/fix-vulkan-uninitialized-warning
Silence mulitple may be used uninitialized warnings in RenderingDeviceVulkan::uniform_set_create()
2020-05-15 18:02:56 +02:00
Marcel Admiraal 8f0b3392c3 Silence mulitple may be used uninitialized warnings in
RenderingDeviceVulkan::uniform_set_create()
2020-05-15 11:48:06 +01:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00