Commit graph

3150 commits

Author SHA1 Message Date
Thakee Nathees 08fef074c2 error_macros.h typo fixed 2020-03-04 10:35:31 +05:30
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
Rémi Verschelde e2b66cacf7
Merge pull request #18020 from bruvzg/input_fix_non_latin_and_add_hw_scancodes
Fix non-latin layout scancodes on Linux, adds access to physical scancodes.
2020-03-01 23:00:42 +01:00
Rémi Verschelde 0e25f54755
Merge pull request #36404 from rxlecky/fix-variant-conversion
Fix Variant to Vector<Variant> conversion operator
2020-03-01 09:30:28 +01:00
Rémi Verschelde 323ef1acdb
Merge pull request #36696 from Chaosus/fix_echo
Fix InputEventKey::echo property type from INT to BOOL
2020-03-01 09:28:01 +01:00
Rémi Verschelde 1ab695bf37
Merge pull request #36695 from clayjohn/ETC-mipmaps-4
Force mipmaps off when importing RGBA4444 textures
2020-03-01 08:29:42 +01:00
Yuri Roubinsky 5e3c64828a Fix InputEventKey::echo type from INT to BOOL 2020-03-01 09:52:37 +03:00
clayjohn 0c3af32d77 Force mipmaps off when importing RGBA4444 textures 2020-02-29 19:46:06 -08:00
Rémi Verschelde 16486a9055 doc: Sync classref with current source 2020-02-29 14:22:57 +01:00
Rémi Verschelde 620030b600
Merge pull request #36640 from reduz/resource-loader-refactor
Removed ResourceInteractiveLoader, add built-in threaded loading.
2020-02-28 17:21:16 +01:00
Juan Linietsky 475e4ea67b Removed interactive loader, added proper thread loading. 2020-02-28 11:20:45 -03:00
Rémi Verschelde 32ccf306f9 ConnectionsDock: Fix error when parsing CustomCallable connections 2020-02-28 14:32:36 +01:00
Rémi Verschelde 01afc442c7 Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.

No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
2020-02-28 14:24:09 +01:00
Andrea Catania 33ae58710b Generates the rpc and rset info for exported GDScript.
Improved the send rpc log message when fail.

This work has been kindly sponsored by IMVU.
2020-02-28 12:39:18 +01:00
Pedro J. Estébanez 0115d88072 Fix shadowed variable build error 2020-02-28 11:02:20 +01: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 ed0f1940cb
Merge pull request #36579 from dreamsComeTrue/remove-refbase-reference
Remove friend reference to non-existing class RefBase
2020-02-27 14:48:01 +01:00
Andrea Catania 1afd60d8f5 Optimized rpc packet size when only the PackedByteArray is sent.
This work has been kindly sponsored by IMVU.
2020-02-27 08:19:59 +01:00
Dominik 'dreamsComeTrue' Jasiński 64cf691d32 Remove friend reference to non-existing class RefBase
Commit
7ad14e7a3e
removed RefBase class - but still there is hanging reference in....Reference :) class (no pun intended)
2020-02-26 22:36:40 +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
Rémi Verschelde 6c8f2ae53a Update docs and bindings for new integer vector types 2020-02-25 15:27:29 +01:00
Rémi Verschelde 2f237d181b
Merge pull request #36515 from reduz/packed-array-64-bits
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
2020-02-25 15:27:09 +01:00
Rémi Verschelde b8f0da7bed
Merge pull request #36529 from akien-mga/expression-int64
Expression: Fix parsing integers as 32-bit
2020-02-25 14:35:52 +01:00
Rémi Verschelde fe1dfb5fb7
Merge pull request #36481 from nekomatata/fix-crash-connect-callable
Fixed crash when connecting a signal in GDScript
2020-02-25 13:26:08 +01:00
Rémi Verschelde ceba2b6761 Expression: Fix parsing integers as 32-bit 2020-02-25 13:20:04 +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
bruvzg 1af06d3d46
Rename scancode to keycode.
Add `physical_keycode` (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2020-02-25 12:30:33 +02:00
nathanwfranke 1569c47c1a Fix project.godot for projects with class_name
Fixes #36438
2020-02-24 21:28:14 -06:00
Mateo Dev .59 9e8e5ebdc7 Core: Change _Marshall class inherit from Reference to Object 2020-02-24 10:45:19 -03:00
Rémi Verschelde 220c8e8344 callable_mp: Fix non-debug branch
Was missed in #36393 because no `callable_mp()` calls were actually
compiled with `tools=no` in that PR.

Also work around GCC warning that also affects the
`call_with_variant_args_ret_helper` variant.
2020-02-23 23:48:44 +01:00
Juan Linietsky 88f84c78ca Store arrays inside of Variant as shared.
Arrays inside of Variant are unique and use reference counting.
When you assign a variant containing a packed array to another, or
when you call non const functions to arrays, this will work even
if the array is inside a dictionary, so they will from now pass
as reference.

The difference with regular variant arrays is that, once passed
to a function in the C++ API, they are no longer shared. This is
required for security and thread safety, as those arrays are
mainly used to pass data back and forth even between threads.
2020-02-23 22:42:26 +01:00
PouleyKetchoupp a5505ce643 Fixed crash when connecting a signal in GDScript 2020-02-23 10:06:13 +01:00
Rémi Verschelde bd10c70458
Merge pull request #36461 from akien-mga/c++17-fallthrough-attribute
Replace FALLTHROUGH macro by C++17 [[fallthrough]]
2020-02-23 08:43:18 +01:00
Rémi Verschelde 2cf6ac6c50 Replace FALLTHROUGH macro by C++17 [[fallthrough]]
This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.

Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.

Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-23 00:52:50 +01:00
Juan Linietsky 6da0eef9e6 Add support for Vector2i, Rect2i and Vector3i to Variant
WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous
operator problems in Variant.

This was added for this commit (and future C++17 uses) in #36457.
2020-02-22 23:16:44 +01:00
SeleckyErik 4a8cb4a818 Fix Variant to Vector<Variant> conversion operator 2020-02-21 19:10:44 +00:00
Rémi Verschelde a77c862b18
Merge pull request #36400 from reduz/variant-string-name
Added StringName as a variant type.
2020-02-21 16:48:29 +01:00
Juan Linietsky 3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
Juan Linietsky 04bb6a708a Created the callable_mp macro, for signals to call method pointers directly. 2020-02-21 13:46:45 +01:00
Fabio Alessandrelli cbc450c0e5 Huge Debugger/EditorDebugger refactor. 2020-02-21 11:12:03 +01:00
Juan Linietsky 69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
nathanwfranke a31bc1b0ba Fix two signal errors
Update
2020-02-19 15:22:34 -06:00
Rémi Verschelde 4581a9373c
Merge pull request #36359 from vnen/variant-reference-fix
Fix Ref(Variant) constructor to properly check the object type
2020-02-19 16:51:32 +01:00
George Marques cb0b5eae8c
Fix Ref(Variant) constructor to properly check the object type
Otherwise it was saving any reference as valid, regardless of type.
2020-02-19 10:58:00 -03:00
George Marques d490648168
Revert "ClassDB: Workaround double-free for GDScript"
This reverts commit 8312ead0d9.
2020-02-19 09:14:39 -03: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
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 6fc50d785e New PacketPeerDTLS and DTLSServer classes.
Custom instance implementation via the mbedtls module.
2020-02-17 12:03:47 +01:00
Rémi Verschelde 8312ead0d9 ClassDB: Workaround double-free for GDScript
This is a temporary hack until vnen and reduz can work on a proper fix.
The changes in 867d073b98 exposed a
GDScript issue, which apparently triggers an automatic unreferencing.

This hack only makes it possible to use the editor again, but GDScript
is still broken.
2020-02-17 11:55:39 +01:00
Fabio Alessandrelli c4f6ab85b0 UDPServer and PacketPeerUDP connect_to_host.
UDP sockets can be "connected" to filter packets from a specific source.
In case of a bound socket (e.g. server), a new socket can be created on
the same address/port that will receive all packets that are not
filtered by a more specific socket (e.g. the previously connect socket).

This way, a UDPServer can listen to new packets, and return a new
PacketPeerUDP when receiving one, knowing that is a "new client".
2020-02-16 01:11:30 +01:00
Fabio Alessandrelli 2811f07084 Add peek option to NetSocket recv_from. 2020-02-16 01:11:30 +01:00
Juan Linietsky 867d073b98 Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr. 2020-02-15 08:36:04 -03:00
Rémi Verschelde 3dea5fd631 Remove incomplete battery status/power API
It was initially implemented in #5871 for Godot 3.0, but never really
completed or thoroughly tested for most platforms. It then stayed in
limbo and nobody seems really keen to finish it, so it's better to
remove it in 4.0, and re-add eventually (possibly with a different API)
if there's demand and an implementation confirmed working on all
platforms.

Closes #8770.
2020-02-14 13:43:32 +01:00
Rémi Verschelde 54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +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 2f6ca917f7
Merge pull request #36174 from akien-mga/byebye-openghell-3
Remove obsolete GLES3 backend
2020-02-13 11:24:15 +01:00
Rémi Verschelde f505aae1d8
Merge pull request #36144 from akien-mga/remove-deprecated-allow-decoding
Remove deprecated PacketPeer allow_object_decoding
2020-02-13 10:48:38 +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
Rémi Verschelde 8d00a3a536 Remove deprecated PacketPeer allow_object_decoding
It was added for 3.2 in #27485 to preserve backwards compatibility,
but we can now remove it.

It is still needed in MultiplayerAPI as it's the only way to control
it for the internal put_var calls.
2020-02-13 09:02:41 +01:00
Rémi Verschelde 1f39a2d3e6 Remove deprecated sync and slave networking keywords
Those keywords were deprecated for 3.1 in #22087.

Also fix token name for `TK_REMOTE`, should be "remote" like the keyword.
2020-02-13 08:59:36 +01:00
Haoyu Qiu a23a52db3f Fixes some memory leaks 2020-02-13 09:46:13 +08:00
Rémi Verschelde 506df14595
Merge pull request #36142 from akien-mga/remove-deprecated-decimals
Remove deprecated decimals builtin
2020-02-12 21:48:33 +01:00
Juan Linietsky cf8c679a23 ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits. 2020-02-12 14:24:54 -03:00
Rémi Verschelde bd78b9f445 Remove deprecated decimals builtin
Replaced by 'step_decimals' in 3.2 via #21425.
2020-02-12 13:39:39 +01:00
Andrea Catania eb07e87981 Optmized data sent during RPC and RSet calls.
- Now is sent the method ID rather the full function name.
- The passed IDs (Node and Method) are compressed so to use less possible space.
- The variant (INT and BOOL) is now encoded and compressed so to use much less data.
- Optimized RPCMode retrieval for GDScript functions.
- Added checksum to assert the methods are the same across peers.

This work has been kindly sponsored by IMVU.
2020-02-12 13:36:47 +01:00
Hanif Bin Ariffin 7bc1dc828f Remove deprecated Color::gray
It was marked to be removed in Godot 3.1.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-02-12 11:22:33 +01:00
Rémi Verschelde 948d95897c
Merge pull request #36095 from timothyqiu/corrupted-resource
Fixes crash when resource file is corrupted
2020-02-11 21:35:03 +01: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 2049dec79e Added normalmap guided roughness mipmap generator, and a global roughness limiter. 2020-02-11 12:16:01 +01:00
Juan Linietsky ee1e89f8c0 Modified rendering to use cluster instead of foward 2020-02-11 12:15: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
Pedro J. Estébanez e38ae8d7e4 Fix bugs in RID_Alloc
- Replace unintended `%` with `&`
- `get_owned_list()`: make thread-safe and fix logic
- Apply same logic fix to the destructor

Previously, the determination of owned RIDs was wrong. For instance, it could skip owned items or include duplicates in the list.

Avoids the engine crashing at exit.
2020-02-11 12:04:41 +01:00
Juan Linietsky 6ee2f5e6b6 More GIProbe work and fixes 2020-02-11 12:03:49 +01:00
bruvzg 26318f3bd1 Fix Vector3 ambiguities and out of bounds init. 2020-02-11 12:03:39 +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 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 9d7b7f931b Reflection probes working 2020-02-11 12:01:21 +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 8cee7703a6 Yay very basic 3D (only white) finally shows. 2020-02-11 11:59:27 +01:00
Rémi Verschelde 61cf68fb48 RID_Alloc: Fix locking in getornull and free early returns
Those missing unlocks were preventing the editor from starting.
2020-02-11 11:59:16 +01:00
Juan Linietsky dc3b47f3ab Vulkan/RD rasterizer now does clean exit. 2020-02-11 11:58:16 +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 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 0586e18449 Custom material support seems complete. 2020-02-11 11:53:29 +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 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 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 fd188ddd51 Initial work on Vulkan:
-Added VulkanContext
-Added an X11 implementation
-Added a rendering device abstraction
-added a Vulkan rendering device abstraction
-Engine does not work, only shows Godot logo (run it from bin/)
2020-02-11 11:53:26 +01:00
Rémi Verschelde 3e3f8a4761
Merge pull request #36097 from madmiraal/fix-c4715-warning
Prevent Visual Studio compiler throwing C4715: not all control paths return a value.
2020-02-11 11:43:58 +01:00
Haoyu Qiu 832a5c860b Fixes crash when resource file is corrupted 2020-02-11 17:29:25 +08:00