Commit graph

889 commits

Author SHA1 Message Date
Rémi Verschelde fcddd8c53a
Merge pull request #46966 from qarmin/faster_release
Allow to not optimize release build
2021-03-20 22:44:47 +01:00
Rafał Mikrut 0b298d201e Allow to not optimize release build 2021-03-14 15:51:05 +01:00
Rémi Verschelde 0fd723d3ec
Merge pull request #46941 from goostengine/asan-msvc
Add `use_asan` option for MSVC to enable AddressSanitizer
2021-03-13 22:10:01 +01:00
Rémi Verschelde 7015027cbf
Merge pull request #46900 from Ev1lbl0w/bugfix-malloc_calls
Replace malloc's with Godot's memalloc macro
2021-03-13 21:55:52 +01:00
Ev1lbl0w 838e7d0a8d
Replace malloc's with Godot's memalloc macro 2021-03-13 11:51:45 +00:00
Andrii Doroshenko (Xrayez) 53901d870b Add use_asan option for MSVC to enable AddressSanitizer
Exposes AddressSanitizer support in MSVC compiler. Can be installed via individual
components in the Visual Studio 2019 Installer.

Disabled by default. Compile the engine with `scons use_asan=yes`.
2021-03-12 18:44:06 +02:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
PouleyKetchoupp 27d5e1fff0 Added LocalVector to Visual Studio debugger visualization 2021-02-24 18:35:39 -07:00
bruvzg 3e0262509f
Move tablet driver API from OS to DisplayServer. 2021-02-18 17:12:24 +02:00
reduz 8b19ffd810 Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread).
-RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault.
-Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory).
-3D physics server changed to be made multithread friendly.
-Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads.
-Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-10 13:21:46 -03:00
Bastiaan Olij 4946ae16fc Use /Zi and /FS for including debugger symbols on Windows with MSVC 2021-02-09 00:20:42 +11:00
Rémi Verschelde 849c090343
SCons: Fix debug_symbols tests after switch to BoolVariable
Bug introduced in #45679.

Fixes part of #45816.
2021-02-08 08:53:16 +01:00
kobewi b6e2ad0e7e Cancel event dispatch on error 2021-02-07 21:50:12 +01:00
Rémi Verschelde db26871210 SCons: Add production=yes option to use production defaults
This is meant for users making custom builds to match the options used on
optimized, official builds.

This enables, on the platforms which support them:
- `use_static_cpp=yes` (portable binaries for Linux and Windows)
- `use_lto=yes` (link time optimizations - note: requires a lot of RAM!)
- `debug_symbols=no` (no debug symbols, smaller binaries)

Also abort when using MSVC with `production=yes`, as:
- It cannot optimize the GDScript VM like GCC or Clang do, leading to
  significant performance drops.
- Its LTO support is unreliable, at least used to trigger crashes last
  we tried it extensively.

All options can still be overridden if specified, and the `dev=yes` option
was changed to also support overrides.
2021-02-03 11:48:17 +01:00
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Rémi Verschelde d39f6386ce
Merge pull request #45314 from RandomShaper/modernize_rwlock
Modernize RWLock
2021-01-22 14:51:05 +01:00
Pedro J. Estébanez 8ed259b792 Modernize RWLock
- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-01-19 11:53:10 +01:00
Marios Staikopoulos 2a2de2f684 BUGFIX: Fix unintialized cursor_shape on windows display server 2021-01-18 15:52:47 -08:00
Marcel Admiraal 2a74b388d0 Split OS::execute into two methods
1. execute(): Executes a command and returns the results.
2. create_process(): Creates a new process and returns the new process' id.
2021-01-09 10:03:23 +00:00
Yuri Roubinsky 785f84f1d1 Removes semicolon typo in display_server_windows 2021-01-06 15:08:51 +03:00
Yuri Roubinsky d4939aa05f Fix PopupMenu's which are not closed after a recent commit 2021-01-06 14:42:15 +03:00
Rémi Verschelde 9d6df31b84
Merge pull request #44299 from Chaosus/fix_win32_warning
Fixed warning at window closing (WIN32)
2021-01-05 09:00:47 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Yuri Roubinsky 41efbf8cae Fixed warning at project startup (WIN32) 2021-01-01 18:09:34 +03:00
Yuri Roubinsky 8a2bc6bf58 Fix window restoring after fullscreen again 2020-12-31 16:07:05 +03:00
Rémi Verschelde 8886a6a45c
Merge pull request #44757 from andrew-softdev/my-bug-fix
Incorrect format specifiers used to display some type data in the Visual Studio debugger
2020-12-28 20:44:15 +01:00
andrew-softdev 679aabea26 Incorrect format specifiers used to display some String/StringName data 2020-12-28 18:46:32 +00:00
Rémi Verschelde e4c0572385
Merge pull request #44593 from madmiraal/rename-mainloop-methods
Rename MainLoop methods to match Node methods
2020-12-28 14:44:28 +01:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Marcel Admiraal d9e9eb8d04 Rename MainLoop methods to match Node methods 2020-12-22 12:34:57 +00:00
Marcel Admiraal 2df9a8ccad Rename Rect2 and Rect2i clip() to intersection() 2020-12-19 12:59:08 +00:00
Marcel Admiraal b56a2f34ce Add missing override keywords in os_windows.h 2020-12-18 09:38:09 +00:00
Marcel Admiraal fa435a550a Add override keywords to core/os.h derived classes. 2020-12-17 18:02:31 +00:00
Rémi Verschelde 0f84d8dc49
SCons: Add only selected platform's opts to env
Otherwise we can get situations where platform-specific opts with the same name
can override each other depending on the order at which platforms are parsed,
as was the case with `use_static_cpp` in Linux/Windows.

Fixes #44304.

This also has the added benefit that the `scons --help` output will now only
include the options which are relevant for the selected (or detected) platform.
2020-12-16 16:31:19 +01:00
Marcel Admiraal 8ef5e3201c Don't handle BaseException in build scripts 2020-12-12 10:05:42 +00:00
Rémi Verschelde 37d0d757d6
Merge pull request #40708 from bruvzg/improve_os_locale
Improve `OS::get_locale()` and documentation.
2020-12-10 11:49:00 +01: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
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Fabio Alessandrelli 781efc26e0 Remove now unused FileAccessBuffered. 2020-12-06 19:37:11 +01:00
reduz 2787ad65be RenderingServer reorganization 2020-12-04 18:39:46 -03:00
Bastiaan Olij cf5737acbe Added driving joystick type to windows joystick handling 2020-12-04 23:31:19 +11:00
Rémi Verschelde 328af1db75
Merge pull request #44074 from reduz/reorganize-3d
Reorganize rendering server.
2020-12-04 08:36:31 +01:00
Rémi Verschelde 586a20875d
Merge pull request #44018 from lyubomirv/mingw_use_static_cpp_option
Add 'use_static_cpp' option for MinGW builds
2020-12-03 23:58:57 +01:00
reduz e93b2242c2 Reorganize rendering server.
-Made RenderingServerScene abstract, allowing reimplementation
-RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
2020-12-03 19:01:01 -03:00
Lyubomir Vasilev e52c9c26fc Add 'use_static_cpp' option for MinGW and MSVC builds 2020-12-03 23:46:16 +02:00
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
Rémi Verschelde 2e4bff1cfe
SCons: Remove unnecessary $LINK overrides
As of SCons 4.0.1, the default value for $LINK is $SMARTLINK, which itself
is a function that will use $CXX as linker for C++:

https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L327-L328
https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L54-L76

So we don't need to manually specify the same value as $CXX for $LINK.
2020-11-19 16:48:03 +01:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Marcus Brummer f0f4220b05 Fixed exit code retrieval of spawned processes on Windows
Use GetExitCodeProcess() on Windows to retrieve the exit code of a process in
OS:excute()
2020-11-16 18:30:33 +01:00
Rémi Verschelde 827e5b8bf3
Merge pull request #43412 from akien-mga/variant-rename-_RID-to-RID
Variant: Rename Type::_RID to Type::RID
2020-11-09 17:46:34 +01:00
Rémi Verschelde 9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
Hugo Locurcio ff1f0d2cb5
Remove debug_symbols=full in favor of debug_symbols=yes
`debug_symbols=yes` will now behave like `debug_symbols=full` did
before. The difference in compressed file sizes is not that large,
which means there isn't much point in having two different values.

This helps make the buildsystem easier to understand.
2020-11-09 15:48:30 +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
Rémi Verschelde df2abc55be
Merge pull request #43353 from madmiraal/fix-43352
Use LONG instead of DWORD (unsigned int) when interacting with DIJOFS constants
2020-11-06 12:46:36 +01:00
unknown 4a6e53b3c9 Use LONG instead of DWORD (unsigned int) when interacting with DIJOFS constants. 2020-11-06 10:17:28 +00:00
Ev1lbl0w 525a5be01d
Changed path behaviour for Windows 2020-10-24 14:14:53 +01:00
bruvzg 56f3aba7b2
[Windows, MSVC] Correctly set source file encoding. 2020-10-09 13:56:20 +03:00
Rémi Verschelde 97f116d36b
SCons: Refactor and cleanup warnings definition 2020-10-08 10:58:05 +02:00
Rémi Verschelde 182d6d6f42
SCons: Add windows_subsystem=default, restores original behavior
We want debug builds to have a console and easy stdout redirection by default.
Windows makes reading the stdout/stderr stream from gui applications too cumbersome
(and most users don't know about it, and just wonder why they don't see a thing).
2020-10-06 09:30:46 +02:00
Bartłomiej T. Listwon 317c2b194d Add all headers to VS Project 2020-09-27 18:03:51 +02:00
Rémi Verschelde 3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
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
```
2020-09-18 13:44:25 +02:00
bruvzg 6a14c72b12
Add window click-through support. 2020-09-17 12:36:18 +03:00
Hugo Locurcio 4df86f8b04
Only display the Windows toggle console option if it can actually be used 2020-09-14 21:52:04 +02:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Rémi Verschelde a77106bf7e
Merge pull request #41332 from bruvzg/win_subsys_option
Revert #41164, add subsystem build option.
2020-09-03 11:52:29 +02:00
PouleyKetchoupp bb306750ce Fix WINDOW_EVENT_FOCUS_IN for popups on Windows
On Windows, WINDOW_EVENT_FOCUS_IN was never sent by the display server
for popups, because WM_ACTIVATE events are received during the call to
_update_window_style, which happened before the callbacks were set.

This was causing some issues with the way Popup is now handling closing on
parent focus.

Now _update_window_style is only called during show_window, after Window
initialized callbacks.
2020-08-26 18:14:36 +02:00
PouleyKetchoupp 2b49cb0b73 Re-apply "Fixes for windows in X11 tiling WMs"
From PR #38727 which was reverted in #41373 because of regressions in Ubuntu
with Gnome.

Co-authored-by: Lorenzo Cerqua <lorenzocerqua@tutanota.com>
2020-08-22 18:42:42 +02:00
Juan Linietsky 9c5c1635b2
Revert "Fixes for windows in X11 tiling WMs" 2020-08-19 12:37:59 -03:00
bruvzg c76fe59204
Add Windows Subsystem build option. 2020-08-17 19:07:12 +03:00
bruvzg 03ffd6451a
Revert "[Windows] Attach to parent console instead of creating new one."
This reverts commit 4f7a49db53.
2020-08-17 19:05:48 +03:00
bruvzg ee76775792
[Windows] Fix modifier keys when using tablet input. 2020-08-17 14:43:16 +03: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 f797e1c078
Improve OS::get_locale() on macOS and Windows, replace "-" with "_" and use system macros instead of bitwise AND. Add locale format info to the documentation. 2020-08-11 13:19:19 +03:00
bruvzg 4f7a49db53
[Windows] Attach to parent console instead of creating new one. 2020-08-11 13:02:50 +03:00
Andreas Haas 802a0316c5
DirectInput: use correct joypad id
Previously `joypad_count` was used as the index into the d_joypads array when initializing a new gamepad.
This caused the accidental override of an already connected device when a gamepad with a lower id was disconnected and connected again.

fixes #17566
2020-07-31 20:16:51 +02:00
Rémi Verschelde bd9fc75768
Merge pull request #40706 from akien-mga/style-fix-file_format-macos
Fix code format scripts compat with non-GNU Unices
2020-07-27 13:27:56 +02:00
Rémi Verschelde c71e189efd Style: Fix code format scripts compat with non-GNU Unices
It's too hard to get compatibility between GNU and BSD sed,
so let's just use perl oneliners.

And improve it to also remove trailing tabs, not just spaces.
2020-07-27 13:11:44 +02:00
Rémi Verschelde f940e5e000 CI: Install master version of psf/black
Until https://github.com/psf/black/pull/1328 makes it in a stable release,
we have to use the latest from Git.

Apply new style fixes done by latest black.
2020-07-26 19:48:25 +02:00
Rémi Verschelde 3842e8c465
Merge pull request #38727 from Riteo/tiling-wm-issues-tests
Fixes for windows in X11 tiling WMs
2020-07-26 17:41:28 +02:00
RevoluPowered 579342810f t Add unit testing to Godot using DocTest and added to GitHub Actions CI
Implements exit codes into the engine so tests can return their statuses.
Ideally we don't do this, and we use FIXUP logic to 'begin' and 'end' the engine execution for tests specifically.

Since realistically we're initialising the engine here we don't want to do that, since String should not require an engine startup to test a single header.

This lowers the complexity of running the unit tests and even for
physics should be possible to implement such a fix.
2020-07-24 13:05:33 +01:00
Rémi Verschelde dcf902df85 SCons: Remove unused DEBUG_MEMORY_ENABLED define
Its last use was removed in Godot 3.0, so it no longer makes sense to define.

Also removed `D3D_DEBUG_INFO` for Windows as it's likely a left over from a
long time ago pre-opensourcing when Godot had some form of Direct3D 9 support?
2020-07-23 09:39:10 +02:00
Lorenzo Cerqua d670a49612 DisplayServer: separate window showing into another function
When creating a window, Godot would first register it to the WM(show it) and then set its flags.
This works fine on a floating WM, but on tiling WMs as soon as a window gets registered
the WM immediately acts on the window by scaling it up and treating it as a generic window,
being registered without any special flags.

This commit separates the showing of the window into another function and calls it after the most important flags are set,
making windows with special flags(eg. all popups) work again on tiling WMs.

Fixes #37930
2020-07-23 07:58:10 +02:00
Zae 0107550cf1 fix crlf for clipboard 2020-07-20 23:07:20 +08:00
Rémi Verschelde c8523038cc
Merge pull request #40268 from DanielZTing/master
Fix cancel/OK button order on macOS
2020-07-15 09:21:04 +02: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
Daniel Ting 9605fc54c7 Fix cancel/OK button order on macOS
The macOS platform convention regarding button order is cancel on left,
OK on right.
2020-07-10 15:10:11 -05:00
Rémi Verschelde 73fddc623b
Merge pull request #39888 from nekomatata/windows-create-window-error
Fix errors when creating windows on Windows
2020-07-04 01:41:43 +02:00
Juan Linietsky b14be5f271 Fix fullscreen flag on Windows, closes #37588 2020-07-02 22:09:17 -03:00
Juan Linietsky 438c380458 Add a separate application focus/in notification out from Window focus notification. 2020-06-30 10:40:06 -03:00
PouleyKetchoupp 1043576ff3 Fix errors when creating windows on Windows
Detecting the case where WM_SIZE is received during the window creation.
There's no need to call window_resize on the Vulkan context.

Also creating a WindowData entry early enough to avoid storing a
separate WindowData wrongly associated to INVALID_WINDOW_ID.

Fixes #39199
2020-06-27 18:26:34 +02:00
Rémi Verschelde d808697760
Merge pull request #39751 from bruvzg/mingw_build_fix
Fix MinGW build (use uninitialized `ofs` variable introduced in 39701).
2020-06-22 13:07:14 +02:00
bruvzg 439c97e0ff
Fix use uninitialized ofs variable introduced in 39701. 2020-06-22 13:13:22 +03:00
bruvzg fc1d1c3557
[Windows] Prevent overwriting old cursor handle on multiple mouse_mode changes, ensure mouse_mode is set before cursor_set_shape is called to restore cursor. 2020-06-22 13:05:18 +03:00
Bastiaan Olij aa01b327d6 Fix missing slider joystick handling on Windows 2020-06-20 19:03:15 +10:00
Rémi Verschelde 3e07080942
Merge pull request #39427 from hcmlax/shortcut_issue_39351
fixed issue where shortcut doesn't work if alt is pressed before shift
2020-06-19 23:47:49 +02:00
unknown d191a8b9f8 adding check for syskeydown on control and alt 2020-06-18 14:36:22 -07:00
Rémi Verschelde fa01e666d2
Merge pull request #39542 from Ev1lbl0w/feature/kill-pid
Allow Godot to kill its own PID
2020-06-16 20:49:00 +02: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
bruvzg 92352b1c23
Add keyboard layout enumeration / set / get functions (macOS, Windows, Linux/X11), remove latin variant function. 2020-06-13 11:02:00 +03:00