Commit graph

2382 commits

Author SHA1 Message Date
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
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Fabio Alessandrelli 2dbd227c9a Fix DummyRenderer after new lightmapper merge. 2020-05-11 18:26:06 +02:00
Rémi Verschelde 32133a11b5
Merge pull request #38386 from reduz/new-lightmapper
New GPU lightmapper
2020-05-11 13:45:48 +02:00
Juan Linietsky 1bea8e1eac New lightmapper
-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10 15:59:09 -03:00
Fabio Alessandrelli 11a81341fa Restore RasterizerDummy. 2020-05-10 18:19:23 +02:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Pedro J. Estébanez f7706659b5 Improve shader time roll over
- Resurrect it for GL ES 2
- Add it to the Vulkan rasterizer
- Expose the setting from the `RenderingServer`, since it does not belong in any specific rasterizer
2020-04-30 11:42:11 +02:00
Rémi Verschelde 0bf6a86db4
Merge pull request #37795 from Chaosus/shader_fix_const_order2
Fix shader constant sorting
2020-04-29 09:41:34 +02:00
bruvzg b5caa2e8b0
[Vulkan] Use VK_LAYER_KHRONOS_validation instead of deprecated VK_LAYER_LUNARG_standard_validation. 2020-04-26 16:47:25 +03:00
Rémi Verschelde 2074b43c6f
Merge pull request #36083 from Calinou/dummy-loader-add-extensions
Add more extensions to the dummy texture loader
2020-04-23 12:05:38 +02:00
Juan Linietsky f8ef38efed Add proper type to most public API uses of Array 2020-04-21 12:16:45 -03:00
Juan Linietsky ae09b55a19 Exposed RenderingDevice to script API
Also added an easier way to load native GLSL shaders.

Extras:

Had to fix no-cache for subresources in resource loader, it was not properly working, making shaders not properly reload.

Note:

The precommit hooks are broken because they don't seem to support enums from one class being used in another.
Feel free to fix this after merging this PR.
2020-04-20 21:21:58 -03:00
Rémi Verschelde b4855f5c83
Merge pull request #38056 from clayjohn/GLES2-depth-buffer
Use proper depth buffer format for rgba shadows
2020-04-20 23:47:24 +02:00
clayjohn 123dd390e4 Use proper depth buffer format for rgba shadows 2020-04-20 11:58:59 -07:00
Juan Linietsky 49d0c6a5c9 Ability to create local RenderingDevice instances. 2020-04-18 21:47:17 -03:00
qarmin 943ec79859 Fixes leaks in ResourceCache, Vulkan and X11 2020-04-15 10:27:57 +02:00
Rémi Verschelde 84142f6a5f
Merge pull request #37881 from qarmin/leak_vulkan
Fixes leaks with Vulkan device and instance
2020-04-14 21:45:48 +02:00
qarmin 2ab4b054e0 Fixes leaks with Vulkan device and instance 2020-04-14 20:15:48 +02:00
Juan Linietsky 5944eb6e7f Implement decals
Also implemented decal atlas, so projectors and other stuff can be added.
Sidenote: Had to make RID hashable, so some unrelated includes changed
in order to include it in hashfuncs.h
2020-04-14 11:13:34 -03:00
Juan Linietsky a57dc398db Implement MSAA 2020-04-12 15:33:57 -03:00
Juan Linietsky 9dc19f7619
Merge pull request #37808 from reduz/port-effects-to-compute
Moved most of the effect code to compute.
2020-04-11 23:38:05 -03:00
Juan Linietsky d81911490b Moved most of the effect code to compute.
Simplifies it and improves performance.
Improves image barrier handling per mipmap on RenderingDeviceVulkan
2020-04-11 19:44:07 -03:00
Yuri Roubinsky bc30f541e6 Fix shader constant sorting 2020-04-11 12:40:17 +03:00
Juan Linietsky d06f8ef75a Shows proper scene render time in editor info
Also fixed GPU profiler, which was not working on nvidia hardware.
2020-04-10 14:19:30 -03:00
PouleyKetchoupp 802bbe87ad Fix extra warnings in Android build 2020-04-10 11:06:11 +02:00
Rémi Verschelde 23d786d6fb
Merge pull request #36919 from nekomatata/android-vulkan-rendering
Vulkan rendering support on Android
2020-04-09 00:16:26 +02:00
Hugo Locurcio 3007c7e2a3 Add more extensions to the dummy texture loader
This should make headless exporting work in projects using textures
in any format.

Error messages should no longer appear when running a project
that used image formats that were previously not present in the list.
2020-04-08 16:55:20 +02:00
PouleyKetchoupp e167af3737 Display Server support 2020-04-08 01:47:09 +02:00
clayjohn 3db61ce91c Avoid material rebinds when using skeletons 2020-04-07 10:34:35 -07:00
Rémi Verschelde 597ec5dbf8
Merge pull request #37586 from qarmin/vulkan_allocator_leak
Fix leak with Vulkan allocator
2020-04-07 09:16:02 +02:00
Rémi Verschelde befbdda7f2
Merge pull request #37635 from qarmin/leak_vertex
Fixed leak with vertex_formats
2020-04-06 21:32:25 +02:00
qarmin f4301b7259 Fixed leak with vertex_formats 2020-04-06 18:07:31 +02:00
Rémi Verschelde 61342e5831 Vulkan: Use VK_NULL_HANDLE for handles, fixes 32-bit builds
Some Vulkan types are defined as "non dispatchable handles" and use a
different typedef on 32-bit and 64-bit systems (struct pointer on
64-bit, `uint64_t` otherwise).

0e78ffd1dc/include/vulkan/vulkan_core.h (L59-L65)

Contrarily to `NULL`, `nullptr` can't be converted to `uint64_t` so
build was now failing on 32-bit after converting the codebase from
using `NULL` to `nullptr`.

Fixes #37620.
2020-04-06 10:21:32 +02:00
qarmin a0832e6f5e Fix leak with Vulkan allocator 2020-04-04 20:16:48 +02:00
PouleyKetchoupp af424b1c7c Vulkan rendering for Android 2020-04-03 11:18:59 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Pedro J. Estébanez 741f8d9bec Fix res:// trimmed to s:// on Windows 2020-04-01 10:30:22 +02:00
Rémi Verschelde e5033d3952 doc: Sync classref with DisplayServer/Window changes 2020-03-31 11:56:58 +02:00
Rémi Verschelde cd4e46ee65 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.
2020-03-30 09:05:53 +02:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Juan Linietsky 9e08742de8 Added a Window node, and made it the scene root.
Still a lot of work to do.
2020-03-26 15:49:38 +01:00
Juan Linietsky f8a79a97c7 Effective DisplayServer separation, rename X11 -> LinuxBSD 2020-03-26 15:49:34 +01:00
Rémi Verschelde cbbe0743a9
Merge pull request #37219 from RajatGoswami/missing-include-guards
Adding missing include guards to header files identified by LGTM
2020-03-23 11:17:24 +01:00
Rajat Goswami 2ecf928ae3 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143
2020-03-23 04:52:36 -04:00
Rémi Verschelde ed9a0d0484
Merge pull request #37179 from clayjohn/VULKAN-sky-shader
Implement Sky Shaders
2020-03-22 20:03:35 +01:00
clayjohn 61a74739ca Working sky shader implementation 2020-03-21 20:43:44 -07:00
Aaron Franke 7dbe8b65ae
Make file formatting comply with POSIX and Unix standards
UTF-8, LF, no BOM, and newlines at the end of files
2020-03-21 17:41:03 -04:00
Bastiaan Olij c3fee7ba6c Add shader based background mode 2020-03-19 18:30:39 -07:00
Rémi Verschelde cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Rémi Verschelde 05d9d1c0e7
Merge pull request #36905 from Faless/js/restore_and_ci
Resurrect HTML5 platform, add it to CI (no rendering yet)
2020-03-11 07:31:16 +01:00
Rémi Verschelde f70b5fa30c Revert "Enhanced physical device selection to use device type and available memory in relation to issue #35397"
This reverts commit 4f3006e5ac.
2020-03-10 08:58:34 +01:00
Haoyu Qiu 46230d253b Initializes VulkanContext::queue_props to NULL 2020-03-10 14:36:39 +08:00
Rémi Verschelde 478337c412
Merge pull request #36751 from Faless/debugger/threads_and_profilers
ScriptDebugger refactor, threading, profilers.
2020-03-09 19:08:07 +01:00
PouleyKetchoupp d99bea20dc More explicit error messages when vulkan calls return errors 2020-03-09 13:25:54 +01:00
Fabio Alessandrelli b8ddaf9c33 Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger.
It tries to be as agnostic as possible on the data that various
subsystems can expose.

It allows 2 types of interactions:

- Profilers:
  A subsystem can register a profiler, assigning it a unique name.
  That name can be used to activate the profiler or add data to it.
  The registered profiler can be composed of up to 3 functions:
    - Toggle: called when the profiler is activated/deactivated.
    - Add: called whenever data is added to the debugger
      (via `EngineDebugger::profiler_add_frame_data`)
    - Tick: called every frame (during idle), receives frame times.

- Captures: (Only relevant in remote debugger for now)
  A subsystem can register a capture, assigning it a unique name.
  When receiving a message, the remote debugger will check if it starts
  with `[prefix]:` and call the associated capture with name `prefix`.

Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new
profiler system.

Port SceneDebugger and RemoteDebugger to the new capture system.
The LocalDebugger also uses the new profiler system for scripts
profiling.
2020-03-08 12:36:39 +01:00
Fabio Alessandrelli aa8c825855 OS_Javascript temporarly uses dummy rasterizer. 2020-03-08 03:35:13 +01:00
Fabio Alessandrelli 7b22ca339f Restore dummy rasterizer
Not all functionalities are back, but it compiles and runs minimal
project.
2020-03-08 01:55:27 +01:00
Rémi Verschelde 42595085a5
Merge pull request #36752 from RandomShaper/rework_semaphore
Drop old semaphore implementation
2020-03-05 16:33:45 +01:00
Rémi Verschelde 398f714dfc
Merge pull request #36792 from akien-mga/vulkan-better-debug-prints
Vulkan: Use Godot print macros matching MessageSeverity flag
2020-03-04 20:31:02 +01:00
Rémi Verschelde 3625b057af Vulkan: Use Godot print macros matching MessageSeverity flag
Otherwise any verbose/info/warning debug message from Vulkan would
raise an error, confusing users about the severity of the message.

Cf. #36185, #36790.
2020-03-04 15:02:49 +01:00
Rémi Verschelde a0e33e17fb
Merge pull request #36733 from qarmin/static_analyzer_fixes
Fixes bugs found by Sonarcloud and Coverity
2020-03-04 13:41:38 +01:00
Rémi Verschelde f83f1d7c9b
Merge pull request #36069 from RandomShaper/imvu/improve_drives_ux
Improve UX of drive letters
2020-03-04 13:19:55 +01:00
Rémi Verschelde 2856740e6b
Merge pull request #36385 from kuruk-mm/some_static_asserts
Change when we can ERR_FAIL_COND and ERR_FAIL_CONV_V to static_assert
2020-03-04 13:18:48 +01:00
Rémi Verschelde 98f88a4102
Merge pull request #36585 from disks86/master
Enhanced physical device selection
2020-03-04 13:00:52 +01:00
Mateo Dev .59 c933eb7acc Change when we can ERR_FAIL_COND and ERR_FAIL_CONV_V to static_assert 2020-03-04 04:44:47 -03:00
Mateo Dev .59 8a88637705 os: execute parse the command output from utf8 2020-03-03 21:58:50 -03:00
Pedro J. Estébanez 9a3a2b03b8 Drop old semaphore implementation
- Removed platform-specific implementations.
- Now all semaphores are in-object, unless they need to be conditionally created.
- Similarly to `Mutex`, provided a dummy implementation for when `NO_THREADS` is defined.
- Similarly to `Mutex`, methods are made `const` for easy use in such contexts.
- Language bindings updated: `wait()` and `post()` are now `void`.
- Language bindings updated: `try_wait()` added.

Bonus:
- Rewritten the `#ifdef` in `mutex.h` to meet the code style.
2020-03-03 13:20:42 +01:00
Pedro J. Estébanez aee586553a Improve UX of drive letters
Namely, move the drive dropdown to just the left of the path text box and don't include the former
in the latter.

This improves the UX on Windows.

In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its
dropdown is kept at the original location.
2020-03-03 10:38:34 +01:00
qarmin 1f209bfc41 Fixes bugs found by Sonarcloud and Coverity 2020-03-02 19:17:20 +01:00
Haoyu Qiu 771e66b080 Adds null check of pMessageIdName 2020-02-29 18:26:38 +08:00
Christopher Joseph Dean Schaefer 4f3006e5ac Enhanced physical device selection to use device type and available memory in relation to issue #35397 2020-02-28 21:02:29 -05:00
Juan Linietsky 475e4ea67b Removed interactive loader, added proper thread loading. 2020-02-28 11:20:45 -03:00
Rémi Verschelde b7b3978684
Merge pull request #36556 from RandomShaper/rework_mutex
Reimplement `Mutex` with C++'s `<mutex>` (plus more)
2020-02-28 00:26:01 +01:00
Rémi Verschelde 3a7f1300ee
Merge pull request #36186 from Calinou/remove-vulkan-debugging-prints
Remove Vulkan debugging prints
2020-02-27 21:11:24 +01:00
Pedro J. Estébanez 18fbdbb456 Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
Juan Linietsky 33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Rémi Verschelde da3a504216
Merge pull request #36454 from akien-mga/vulkan-workaround-32-bit-lib-error
Vulkan: Work around false positive on 64-bit Linux w/ 32-bit ICDs
2020-02-22 16:28:48 +01:00
Juan Linietsky 54dfdd1cdb Correct condition wrongly converted to ERR_FAIL_COND_MSG
Fixes debugging of giprobes not working, likely other stuff
2020-02-22 11:36:26 -03:00
Rémi Verschelde e596439497 Vulkan: Work around false positive on 64-bit Linux w/ 32-bit ICDs
In the vast majority of cases, this will be a false positive error
thrown by Vulkan-Loader when a Linux system has Vulkan ICDs for both
32-bit and 64-bit. The error is of the form:
```
ERROR: [Loader Message] Code 0 : /usr/lib/libvulkan_intel.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /usr/lib/libvulkan_radeon.so: wrong ELF class: ELFCLASS32
```

The loader dlopen's the 32-bit ICDs first, raises this error, and then
happily goes on to try and use the 64-bit ICDs.

Upstream report: https://github.com/KhronosGroup/Vulkan-Loader/issues/262

Fixes #36185.
2020-02-22 15:32:20 +01:00
Sam Green 06d7316419 Add iphone to vulkan drivers SCsub 2020-02-21 22:00:48 -08:00
Rémi Verschelde 5ace0beeaa
Merge pull request #36367 from IronicallySerious/rem-audio-driver-dummy
Remove unused driver/dummy/audio_driver_dummy.h
2020-02-19 21:49:17 +01:00
Twarit 04882a481b Remove unused driver/dummy/audio_driver_dummy.h 2020-02-20 00:59:31 +05:30
Rémi Verschelde 05e610b78c
Merge pull request #36357 from MateoMiccino/rendering_vulkan_vertexdescriptionkey_fix
rendering_vulkan: VertexDescriptionKey equal comparator was checking …
2020-02-19 15:54:33 +01:00
Mateo Dev .59 ab88d291b2 rendering_vulkan: VertexDescriptionKey equal comparator was checking only the first element of his vector of VertexDescription 2020-02-19 10:01:19 -03:00
Fabio Alessandrelli 19ef28a614 Fix set_reuse_address on non-Windows platforms.
Broken after cae0d8853d .
2020-02-19 10:15:36 +01:00
Rémi Verschelde 6e64036693
Merge pull request #36321 from Faless/net/win_tcp_noreuse
Disable NetSocket reuse address on Windows.
2020-02-18 16:03:29 +01:00
Rémi Verschelde 27326f8238
Merge pull request #36296 from Faless/dtls/enet_vulkan
DTLS support + optional ENet encryption
2020-02-18 15:01:53 +01:00
Rémi Verschelde c3f4c1baed
Merge pull request #36320 from madmiraal/fix-c4996-warning-vulkan_context
Fix VisualStudio throwing multiple C4996 warnings in vulkan_context.cpp.
2020-02-18 13:57:57 +01:00
Fabio Alessandrelli cae0d8853d Disable NetSocket reuse address on Windows.
It actually means reuse port -.- ...
2020-02-18 13:00:10 +01:00
Marcel Admiraal 529f924aaa Fix VisualStudio throwing multiple C4996 warnings in vulkan_context.cpp.
Use Godot's String to concatenate C-strings instead of strcat and sprintf,
which are unsafe, because they don't check for buffer overflows.
2020-02-18 12:35:59 +01:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Fabio Alessandrelli 2811f07084 Add peek option to NetSocket recv_from. 2020-02-16 01:11:30 +01:00
Rémi Verschelde 79a7be6e7d Vulkan-Loader: Mark secure_getenv as available on Linux
It's a GNU extension part of glibc since 2.17, and it was also added
recently to musl libc. It doesn't seem to be available on *BSD (but
also not used there by Vulkan-Loader).

Could be made more thorough by doing a test compilation of a file to
check for the existence of the function on the host system, but unless
we run into actual issues, that's likely overkill.
2020-02-14 15:32:04 +01:00
Rémi Verschelde d2537407ef Fix various GCC compilation warnings after Vulkan merge
Part of #36132.
2020-02-14 10:02:31 +01:00
Hugo Locurcio 71b74195de
Remove Vulkan debugging prints 2020-02-13 18:50:07 +01:00
Rémi Verschelde f1ac292084
Merge pull request #36169 from timothyqiu/memleak
Fixes some memory leaks
2020-02-13 11:28:35 +01:00
Rémi Verschelde 386968ea97 Remove obsolete GLES3 backend
Due to the port to Vulkan and complete redesign of the rendering backend,
the `drivers/gles3` code is no longer usable in this state and is not
planned to be ported to the new architecture.

The GLES2 backend is kept (while still disabled and non-working) as it
will eventually be ported to serve as the low-end renderer for Godot 4.0.

Some GLES3 features might be selectively ported to the updated GLES2
backend if there's a need for them, and extensions we can use for that.

So long, OpenGL driver bugs!
2020-02-13 10:36:44 +01:00
Haoyu Qiu a23a52db3f Fixes some memory leaks 2020-02-13 09:46:13 +08:00
Yuri Roubinsky 4aa31a2851
Merge pull request #36141 from Chaosus/shader_struct_member_arrays
Added support for arrays as shader struct members
2020-02-12 20:12:05 +03:00
Yuri Roubinsky 6b99bda1e8 Added support for arrays as shader struct members 2020-02-12 17:10:20 +03:00
Rémi Verschelde 0e3d625737 doc: Sync classref with current source
Lots of internal API changes and some docstrings were lost in the conversion.
I manually salvaged many of them but for all the rendering-related ones, an
additional pass is needed.

Added missing enum bindings in BaseMaterial3D and VisualServer.
2020-02-12 12:37:13 +01:00
Yuri Roubinsky 6f162395ff Implementation of 'struct' for shaders 2020-02-11 20:00:42 +03:00
Rémi Verschelde db81928e08 Vulkan: Move thirdparty code out of drivers, style fixes
- `vk_enum_string_helper.h` is a generated file taken from the SDK
  (Vulkan-ValidationLayers).
- `vk_mem_alloc.h` is a library from GPUOpen:
  https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
2020-02-11 14:08:44 +01:00
Juan Linietsky bd364d1447 Auto exposure re-implemented in Vulkan 2020-02-11 12:14:23 +01:00
bruvzg 7bf72ed14e Update Vulkan loader to 1.1.127 2020-02-11 12:05:27 +01:00
Rémi Verschelde fff4240bb4 Fix code formatting issues and VS compilation
Also temporarily disable multicheck build so that we get a full build
even when there are style issues on Vulkan.

Fixes #33356.
2020-02-11 12:05:19 +01:00
Juan Linietsky da0457fa29 Several fixes to GIProbes 2020-02-11 12:04:56 +01:00
Juan Linietsky 2af701fa03 Use a different strategy to get textures from GPU (via buffers), for more compatibility. 2020-02-11 12:04:54 +01:00
bruvzg d5df1b651c Improve HiDPI handling, fix incorrect window viewport clipping. 2020-02-11 12:04:04 +01:00
Juan Linietsky 561b431d85 Dynamic object support for GI Probes (a bit buggy still) 2020-02-11 12:03:52 +01:00
Juan Linietsky 6ee2f5e6b6 More GIProbe work and fixes 2020-02-11 12:03:49 +01:00
Juan Linietsky 965185c765 Better GIProbe quality settings. 2020-02-11 12:03:23 +01:00
Juan Linietsky acf0f6c8a7 GIProbes working. 2020-02-11 12:03:20 +01:00
Juan Linietsky 4aea9f74e6 Rewritten StreamTexture for better code reuse, added basis universal support 2020-02-11 12:02:36 +01:00
Juan Linietsky 263bebe023 Untested support for compute shaders 2020-02-11 12:02:34 +01:00
Juan Linietsky 123ee5995c Visual GPU profiler and related profiling support in Vulkan. 2020-02-11 12:01:26 +01:00
Juan Linietsky 6deffa62fb Several fixes to 3D rendering, and multimesh implementation. 2020-02-11 12:01:22 +01:00
Juan Linietsky 920db604d2 Rewrote large part of rendering, omni and spot shadows now work. 2020-02-11 12:01:18 +01:00
Juan Linietsky 2d6a916835 Environment sky more or less working. 2020-02-11 12:01:05 +01:00
Juan Linietsky 8cee7703a6 Yay very basic 3D (only white) finally shows. 2020-02-11 11:59:27 +01:00
Juan Linietsky 449df8f688 Base 3D engine done, still untested, though. 2020-02-11 11:59:25 +01:00
Rémi Verschelde 511f65214f SCons: Streamline Vulkan buildsystem + fixups
- Renamed option to `builtin_vulkan`, since that's the name of the
  library and if we were to add new components, we'd likely use that
  same option.
- Merge `vulkan_loader/SCsub` in `vulkan/SCsub`.
- Accordingly, don't use built-in Vulkan headers when not building
  against the built-in loader library.
- Drop Vulkan registry which we don't appear to need currently.
- Style and permission fixes.
2020-02-11 11:59:04 +01:00
Rémi Verschelde 6289e7d147 Merge pull request #29993 from bruvzg/vulkan
Initial Vulkan support for macOS (MoltenVK) and Windows
2020-02-11 11:57:40 +01:00
bruvzg b456bfad5c Add runtime GLES2 / Vulkan context selection. 2020-02-11 11:57:34 +01:00
bruvzg eb48be51db Add static Vulkan loader.
Initial Vulkan support for Windows.
Initial Vulkan support for macOS.
2020-02-11 11:57:11 +01:00
Juan Linietsky 4fe3ee1730 Moved the shader source compilation code outside RenderingDevice and Vulkan 2020-02-11 11:53:29 +01:00
Juan Linietsky c613ead5fa Added a spinlock template as well as a thread work pool class.
Also, optimized shader compilation to happen on threads.
2020-02-11 11:53:29 +01:00
Juan Linietsky 60c7498cee Replaced GLSLang reflection by SPIRV-Reflect, eventually allowing to move GLSLang out. 2020-02-11 11:53:29 +01:00
Juan Linietsky 0586e18449 Custom material support seems complete. 2020-02-11 11:53:29 +01:00
Juan Linietsky 8bbbb97336 Completed material/2D shader support (missing SCREEN_TEXTURE) 2020-02-11 11:53:29 +01:00
Juan Linietsky ef083a583b Modified light rendering to make it more compatible.
Modified polygon management to make it more compatible with MoltenVK
2020-02-11 11:53:28 +01:00
Juan Linietsky a7b2ac7bb1 Normalmapping and Specularmapping working in 2D engine
Added support for Sprite, AnimatedSprite and Polygon2D (should add for tileset eventually).
2020-02-11 11:53:28 +01:00
Juan Linietsky e3905f9af3 Added ability to retrieve back textures stored on GPU 2020-02-11 11:53:28 +01:00
Juan Linietsky e1b3444415 Bugfixes and ability to better specify filter and repeat modes everywhere.
Removes antialiased flag for draw_* methods.
2020-02-11 11:53:28 +01:00
Juan Linietsky 1b4281b895 basic 2D engine is more or less working with Vulkan, including editor.
Still a lot to do
2020-02-11 11:53:27 +01:00
Juan Linietsky 42b44f43ee Basic 2D engine is more or less working, needs more work for editor to be usable. 2020-02-11 11:53:27 +01:00
Juan Linietsky 9b0dd4f571 A lot of progress with canvas rendering, still far from working. 2020-02-11 11:53:27 +01:00
Juan Linietsky 836c2109a0 Changed my mind on Vulkan image API, images should now include mipmaps
This should make it easier to obtain the data directly from an Image
2020-02-11 11:53:27 +01:00
Juan Linietsky 3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
Juan Linietsky 9ffe57a10e Modify RenderingDevice to use RIDs, now that they are O(1) 2020-02-11 11:53:26 +01:00
Juan Linietsky 4f163972bb Refactored RID/RID_Owner to always use O(1) allocation.
* Implements a growing chunked allocator
* Removed redudant methods get and getptr, only getornull is supported now.
2020-02-11 11:53:26 +01:00
Juan Linietsky 1522d8c3ee Added support for push constants 2020-02-11 11:53:26 +01:00