Commit graph

3080 commits

Author SHA1 Message Date
Rémi Verschelde e96f0ea1d7
Android: Remove non-functional native video OS methods
Those methods are only properly implemented for iOS.

Supersedes #43811.
2021-05-07 16:42:17 +02:00
Fabio Alessandrelli 8740e95f15
[HTML5] Add support for physical_keycode.
This uses the `event.code` value to retrieve the physical code, while
still using the extra logic to map the unicode value to our keylist,
when computing the `scancode` (supporting ASCII and Latin-1).
2021-05-06 23:19:46 +03:00
bruvzg dab4cf3ed6
Add physical_scancode (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2021-05-06 23:19:45 +03:00
Rémi Verschelde 140350d767
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
2021-05-05 15:02:01 +02:00
Rémi Verschelde a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde 7e61be3cb0
Style: Remove executable bit from non-runnable files 2021-05-04 14:45:07 +02:00
Sergey Minakov f9535554fa
[iOS] Nonnegative start index for virtual keyboard range
(cherry picked from commit 275772818d)
2021-04-30 12:15:24 +02:00
Fabio Alessandrelli b0f6dec02e [HTML5] Fix build for recent emscripten versions.
Library suffix should be `.a`, the `EXTRA_` in
`EXTRA_EXPORTED_RUNTIME_METHODS` is deprecated.
2021-04-30 08:02:21 +02:00
Rémi Verschelde 3f5c106e64
Merge pull request #48276 from thebestnom/cherrypick/allow-build-android-with-symbols 2021-04-29 21:15:42 +02:00
Rémi Verschelde e94161dada
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.

(cherry picked from commit c7b53c03ae)
2021-04-29 16:57:00 +02:00
Rémi Verschelde 70ae90e0e8
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Rémi Verschelde 1489b814aa
Android: Upgrade buildTools from 30.0.1 to 30.0.3
It seems 30.0.1 had issues with compatibility with JDK 8 and 11,
which appear to be solved in 30.0.3 as per godotengine/godot-docs#4796.

(cherry picked from commit d88e1f04df)
2021-04-29 12:28:51 +02:00
thebestnom 0477256793 [Android] fix generateDevTemplate 2021-04-28 22:00:25 +03:00
thebestnom fd7141fc03 [Android] Allow to build dev template with symbols 2021-04-28 22:00:25 +03:00
Rémi Verschelde 8ec14c917f
Merge pull request #47469 from HEAVYPOLY/ios-pen-pressure
Add iOS pen pressure
2021-04-28 17:01:05 +02:00
Fabio Alessandrelli 9446be7dad [HTML5] Export as Progressive Web App.
Adds possibility to export as a progressive web app.
Allows customizing base icons, display mode, orientation and offline
page.
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli cb65f9d64b [HTML5] HTTP server uses optional SSL.
Generates a key/cert snakeoil pair or use a custom SSL cert/key.
This is of course false security, and potentially detrimental for it.

But, so long, those are the requirements browser vendors agreed on to
use things like the Gamepad API, and more advanced topics like wasm
threads.

You don't need this if you run on localhost (at least!), but you do
need this (or a much safer nginx proxy) to try those things on your
local network (e.g. when debugging a phone, networking, etc).
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli a7f2b723d6 [HTML5] Optional icon generation, use export name for it.
We used to only generate the favicon if it was specified in the user
project settings, now it's optional, will export it to `NAME.icon.png`,
(falling back to the default project icon if none is set in project
settings), and the `<link>` tag is added using the `$HEAD_INCLUDE`
instead of being hardcoded in the template.
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli ad160c7f46 [HTML5] Debug HttpServer now runs in web cache subdir.
Serving all files in that folder and using a known list of mime types.
Makes it easy to add more exported files, while still playing safe.
2021-04-27 15:09:03 +02:00
Rémi Verschelde 3b12daa10d
Linux: Remove use_static_cpp override on x86_32
After further testing it seems to work fine now when building binaries with GCC 5
on Ubuntu 16.04 (previously we were using GCC 9 on Ubuntu 14.04).

Follow-up to #45629.

(cherry picked from commit aa15ad72ee)
2021-04-27 13:44:04 +02:00
Rémi Verschelde 5820e36705
Android: Fix get_buffer false positive on empty dest buffer
Follow-up to #46810, this was missed in #47079 when fixing the issue
for other platforms.

Fixes #48135.

(cherry picked from commit a09f3833bd)
2021-04-23 21:49:31 +02:00
Rémi Verschelde a14b51df92
Linux: Don't attempt linking embree3 on non-tools, link it for headless too
`tech_debt++`, that's what we get for not taking the time to cleanup all this
and do it right...

Follow-up to #48073 and #48102.
2021-04-23 10:40:53 +02:00
Rémi Verschelde a2c68d9da7
lightmapper: Disable build if raycast module can't build
We need to propagate the hacky checks from the raycast config to the
lightmapper config, as the failure of a `can_build()` check is not notified to
other modules (which might even be checked further depending on the processing
order in SConstruct).

A more thorough fix would be to change SConstruct to do two loops on modules:
one to check `can_build()` and disable modules which can't build, then another
one to rechecked `can_build()` with the new lineup and do further config.
But there would be more risk for regressions than with this ad hoc hack.

Similar story for the `platform/x11/detect.py` change... oh my eyes :(
2021-04-22 19:12:37 +02:00
Rémi Verschelde b266cc2315
embree: Allow building against system library on Linux 2021-04-22 17:06:28 +02:00
Gromph d964b86249
Fix EditorExportPlugin _export_begin and _export_end functions not being called when exporting UWP
in uwp's version of export.cpp create a ExportNotifier object so that EditorExportPlugin _export_begin and _export_end functions will be called as documentated.

(cherry picked from commit 564ddcde77)
2021-04-20 20:12:53 +02:00
Rémi Verschelde d91c1a60a4
Merge pull request #47954 from m4gr3d/automatically_remove_legacy_storage_attribute
Disable the `requestLegacyExternalStorage` attribute when there are no storage permissions
2021-04-16 17:11:22 +02:00
Fredia Huya-Kouadio bc68872e2d Disable the requestLegacyExternalStorage attribute when there are no storage permissions. 2021-04-16 07:26:24 -07:00
Fredia Huya-Kouadio d7e5c8fad5 Fix issue causing export to fail with "Could not unzip temporary unaligned APK" error and improve command output logging. 2021-04-15 13:26:05 -07:00
Sergey Minakov cdd921e908
[iOS] Fix for plugin modified time check
(cherry picked from commit 15630a4931)
2021-04-14 13:29:55 +02:00
Fredia Huya-Kouadio 158c848ac5 Fix custom boot splash image scaling. 2021-04-12 16:39:32 -07:00
Fredia Huya-Kouadio dedeada310 Fix issue causing the response callback to be invoked with the invalid requestCode. 2021-04-09 13:38:36 -07:00
Bastiaan Olij abaa032fae
Fixes on android:
- checking for validity of ENV in wrapper classes
- fix for access to JavaVM from threads

(cherry picked from commit b3a43430aa)
2021-04-06 22:02:10 +02:00
Fabio Alessandrelli 00f3807a24 [HTML5] Implement WebGL fallback.
According to project settings and when WebGL2 is not available.
2021-04-06 12:56:45 +02:00
Fabio Alessandrelli f90b24a805
[HTML5] Disable body_size in fetch.
We were using `Content-Length` from the server when `Content-Encoding`
was not set (i.e. response was not compressed).

Sadly, in CORS requests accessing headers is restricted, and while
`Content-Length` is enabled by default, `Content-Encoding` is not.

This results in the impossibility of knowing if the content was
compressed, unless the server explicitly enabled the encoding header
via `Access-Control-Expose-Headers`.

To keep maximum compatibility we must disable `body_size` completely.

(cherry picked from commit 737ed0f66e)
2021-04-05 11:59:38 +02:00
Vaughan Ling f60b90d92e Add iOS Apple Pencil pressure 2021-04-03 10:30:57 -07:00
Fabio Alessandrelli 74fd9409d5
[HTML5] Fix WM notifications not being called.
Regression from the library refactoring, binding and not calling is
pretty useless 'o_o.

(cherry picked from commit 01658adb30)
2021-03-29 21:09:19 +02:00
Rémi Verschelde 10fb798883
Merge pull request #47456 from akien-mga/3.x-windows-mingw-aslr
Windows: Disable ASLR protection w/ MinGW, it breaks Mono
2021-03-29 19:06:44 +02:00
Fabio Alessandrelli b402c1cb17
[HTML5] Fix Mono builds (old emcc?)
Promise chaining the emscripten module `then` function breaks it badly,
causing an infinite loop.
I'm unsure about the source of the issue, but most likely at this point
is due to the old emscripten version (I remember very old html5 builds
having issue with promise chaining too).

With this commit, we no longer use the module as a promise, and
instantiate it using `Promise` objects directly for compatibility.

(cherry picked from commit ae3c9345cc)
2021-03-29 19:04:29 +02:00
Rémi Verschelde f7a999c814
Windows: Disable ASLR protection w/ MinGW, it breaks Mono
We might be able to make it work by building Mono itself with
ASLR protection too, but there might still be issues when loading
e.g. GDNative DLLs built without ASLR protection.

In the short term this is not a goal, but we can reconsider later
what is actually needed for ASLR protection to work and keep things
user-friendly.
2021-03-29 14:39:20 +02:00
bruvzg 7447c3b76c
[macOS] Enable code signing by default, use ad-hoc signature if no identity specified.
(cherry picked from commit 09c8e69232)
2021-03-29 14:29:54 +02:00
Hein-Pieter van Braam-Stewart ff3099abcf Fix thread_local, tls, ASLR, and DEP with MingW
This commit changes the way Thread::caller_id works. By moving caller_id
to the .cpp file we make sure that the TLS variable doesn't get
relocated twice causing a crash. Since we build with LTO for release
builds (and everyone should be doing that anyway) there is no extra
overhead from the non-static method. We do do an extra bool check now
there but I don't think this will add much in the way of overhead.

This check cannot be avoided if we still want to be able to cache the
thread ID hash, as we had to move the setter because of limitations of
the WinRT platform. The original workaround for this was in #46813 but
this has some unintended consequences. Specifically; threads that never
create a Thread object will always return 0 in Thread::get_caller_id()
which caused a regression. For instance the editor now freezes when
importing large textures. This PR also addresses that.

Additionally we now enable ASLR support when building with MingW, this
includes a workaround for MingW. MingW refuses to create an appropriate
relocation table if no symbols are exported. So we just export the
various main() functions in godot_windows.cpp.

While ASLR support isn't criticial for Godot, previous versions of Godot
just happened to work with a dynamic base 'by accident' and some users
run Godot this way. After the thread change the .tls section now needs
relocations to make this work. By enabling ASLR at build-time we create
these relocations and people who forced ALSR on previously will now get
a working Godot again.

This fixes #47256 and fixes #47219

This is the 3.x version of this PR. For master a different approach is
possible which I will make in the coming days.
2021-03-25 23:20:12 +01:00
Fabio Alessandrelli 6181452a54
[HTML5] Fix loading when mime-type is missing.
`WebAssembly.instantiateStreaming` requires the mime-type to be
`application/wasm`, but some servers (including most debug servers) do
not provide the content-type header.

This commit forces it via JavaScript, by creating a `Response` object
with the `wasm` content, and explicitly defined `content-type` header.

(cherry picked from commit 778ef4e217)
2021-03-20 23:10:00 +01:00
Fabio Alessandrelli be9b0e0b73
[HTML5] Fix editor version numbering.
Should not write patch version when it's `0`.

(cherry picked from commit 60f2166c27)
2021-03-20 23:08:28 +01:00
Rafał Mikrut 6b6324441f
Allow to not optimize release build
(cherry picked from commit 0b298d201e)
2021-03-20 23:05:13 +01:00
bruvzg 15ff752737
Add "Replace existing signature" to the macOS export (enabled by default).
(cherry picked from commit 9e18fce943)
2021-03-18 22:31:09 +01:00
Fredia Huya-Kouadio 14e7f6fa7c Fix onMainRequestPermissionsResult callback for Android plugins. 2021-03-17 09:30:19 -07:00
Fredia Huya-Kouadio 864f4201b9
Enable doNotStrip when doing development/debugging within Android Studio
(cherry picked from commit 4380004176)
2021-03-17 15:17:02 +01:00
Fredia Huya-Kouadio 94df08aae1 Leverage java annotations to simplify the logic used to register the Godot plugin methods. 2021-03-16 01:20:43 -07:00
Alex Hirsch 5a882a659a
Add parameter checkes to FileAccess get_buffer functions
fix #46540

(cherry picked from commit cdf3099c68)
2021-03-14 12:03:22 +01:00
Andrii Doroshenko (Xrayez) 7c7f4602e7
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`.

(cherry picked from commit 53901d870b)
2021-03-13 22:10:15 +01:00
Ev1lbl0w a586f9daae
Replace malloc's with Godot's memalloc macro
(cherry picked from commit 838e7d0a8d)
2021-03-13 22:01:27 +01:00
Fabio Alessandrelli 64feaed39b [HTML5] Drag and drop zip in project manager.
With a very nice hack, a new hidden configuration option that delays
dropped files removal at exit.

This still leaks while the project manager is running, but will clear
memory as soon as it exits or load something.
(reminder, dropped files are reguarly removed after the signal is
emitted specifically to avoid leaks, but I prefer hacking the HTML5
config then the project manager).

(cherry picked from commit f1e810adcb)
2021-03-12 10:43:52 +01:00
Fabio Alessandrelli 82b900bdda [HTML5] Properly set canvas size during setup.
It used to be updated before the first iteration, causing the
window/viewport size values to be incorrect during the initialization
phase (e.g. during the first `_ready` notification).

(cherry picked from commit 3f059b90d6)
2021-03-12 10:13:08 +01:00
Fabio Alessandrelli 4b38aefd33 [HTML5] Opt-in virtual keyboard support.
Added as an export option "Experimental Virtual Keyboard".
There is no zoom, so text/line edit must be in the top part of the
screen, or it will get hidden by the virtual keyboard.
UTF8/Latin-1 only (I think regular UTF-8 should work out of the box in
4.0 but I can't test it).
It uses an hidden textarea or input, based on the multiline variable,
and only gets activated if the device has a touchscreen.
This could cause problems on devices with both touchscreen and a real
keyboard (although input should still work in general with some minor
focus issues). I'm thinking of a system to detect the first physical
keystroke and disable it in case, but it might do more harm then good,
so it must be well thought.
2021-03-11 20:58:09 +01:00
Fabio Alessandrelli 758daab3ad [HTML5] Respect allow_hidpi option during setup
The option was forced to `true` before, unlike on other platforms.
2021-03-08 23:35:10 +01:00
Rémi Verschelde fd5966af64
Merge pull request #46797 from Faless/js/3.x_pwa_simple
[3.2][HTML5] Add PWA support to the editor page.
2021-03-08 17:29:57 +01:00
Fabio Alessandrelli d942d553ef [HTML5] Add PWA support to the editor page.
This allows to install it as an app, and provide offline support (after
the first run).
Practically, this boils down to adding a JSON file as a manifest, an
offline page to be displayed when the cached files are not avaialble,
and a JS file to cache resources and return them.

The reason for the "first run requirements" is that some browsers, will
emit an "install" by just visiting the page (to see if the JS code is
compatibile), and we do not want to force casual visitors to just
download the 10 MiB+ compressed editor WebAssembly file without pressing
the start button.

Special thanks to Hugo Locurcio (Calinou) for the initial work.
2021-03-08 17:06:41 +01:00
Fabio Alessandrelli 9028b7a095 [HTML5] Catch audio worklet errors on disconnect.
Which could happen if the worklet was not fully loaded, or the audio
context had already aborted.
2021-03-08 17:06:41 +01:00
Rémi Verschelde 03dda90ddd Linux: Fix PRIME detection on Steam
To avoid trying to do PRIME detection on fake `libGL.so` as used by e.g.
Renderdoc or Primus, we skip detection if there's a `libGL.so` in
`LD_LIBRARY_PATH`... and our luck is that Steam defines it and includes
system paths too, thus the actual system `libGL`... 🤦

So if we detect Steam, we skip this check.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>

(cherry picked from commit 562b1cd2cda2098e62c7501dae87393def99c23a)
2021-03-08 16:03:24 +01:00
Fabio Alessandrelli c01f35de12 [HTML5] Replace XMLHttpRequest with Fetch.
This has some advantages:
- Streaming/chunked response support.
- Broader headers support.
2021-03-06 11:44:43 +01:00
Fabio Alessandrelli 751a6f9a63 [HTML5] Rename heapCopy to heapSlice.
New heapCopy function copies a TypedArray to the heap.
2021-03-05 17:32:17 +01:00
Fabio Alessandrelli 41c64533b0 [HTML5] Export process writes sizes in template.
This allow the loading bar to be much more reliable, even in cases where
realible stream loading status is not detectable (server-side
compression, chunked encoding).
2021-03-05 17:32:17 +01:00
Fabio Alessandrelli f64ec5f1ad [HTML5] Preloader fetch, streaming instantiation. 2021-03-05 17:32:17 +01:00
Shane Liesegang 4d06a5c2b0 Mono/macOS: Separate data dir into frameworks and resources for codesigning
Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
(cherry picked from commit 42eb09ddcc)
2021-03-04 12:21:17 +01:00
Jordan Schidlowsky ced5f5398a add msan sanitizer option for linus/bsd, lsan option for osx
(cherry picked from commit da35cd2f00)
2021-03-04 11:33:35 +01:00
bruvzg 1c27d4a73d
[macOS] Add entitlements config and export template dylib signing to the export. 2021-03-03 12:40:44 +02:00
Ev1lbl0w be4e34b495
Prevent invalid values when resizing window (X11) 2021-03-01 12:22:16 +00:00
Pedro Rodrigues 66da113237 Fix out of bounds array access on OS_X11 code
The problem happened on methods `get_screen_position`, `get_screen_size`
and `set_current_screen` when they were passed a negative screen value.

Fixes:
- #46184
- #46185
- #46186
2021-02-28 17:20:04 +00:00
Rémi Verschelde 8385a0d8ad
Merge pull request #46458 from m4gr3d/fix_invalid_missing_templates_error
[3.2] Fix invalid missing template error when the Android build template is not installed
2021-02-27 16:52:41 +01:00
Fredia Huya-Kouadio 92d3287648 Fix invalid missing template error when the Android build template is not installed. 2021-02-26 12:28:19 -08:00
Fredia Huya-Kouadio c5fb32d594 Update the logic to load Godot Android plugins packaged into the binary.
The previous logic had the side effect of imposing a limit of one plugin per `aar` binary. The update lifts that restriction.
2021-02-26 09:09:40 -08:00
Fabio Alessandrelli 43e429fa93 [HTML5] Add jsdoc2rst tool.
A template for `jsdoc` that generat the HTML5 public classref.

The script can be run via `npm run docs` to print to stdout.

You can dry run via `npm run docs -- --d dry-run` or write to file via
`npm run docs -- -d /path/to/file.rst`

Also update Makefile in `doc/` and add dry run test to CI.

(cherry picked from commit 472482013e)
2021-02-26 15:35:45 +01:00
Fabio Alessandrelli 681c10af45 [HTML5] Document Engine and EngineConfig (jsdoc).
This commit also removes the utils.js engine file, moving some of it's
content to config.js and some to engine.js .

(cherry picked from commit 018ee5a4dc)
2021-02-26 15:35:38 +01:00
Fabio Alessandrelli e3664e971b [HTML5] Make editor HTML build tag scons4-proof.
We used to have it like `$GODOT_VERSION` which caused inconsistencies
between different scons versions when substituting it.
It's now `@GODOT_VERSION@`, which is safe on both scons3 and scons4.

(cherry picked from commit 4404eb57e4)
2021-02-26 15:22:51 +01:00
PouleyKetchoupp ea1d4256a4 Added LocalVector to Visual Studio debugger visualization
(cherry picked from commit 27d5e1fff0)
2021-02-25 15:14:32 +01:00
Fredia Huya-Kouadio 65eb5fdf1e Update the initialization timeline for the Godot fragment to be more consistent with the previous activity based timeline.
(cherry picked from commit 3ce7678374)
2021-02-25 15:14:32 +01:00
Fredia Huya-Kouadio 9fb5215db5 Add logic to record the version of the Godot engine for the Android platform.
(cherry picked from commit bc5120eb97)
2021-02-25 15:14:32 +01:00
Rémi Verschelde 693a27e9dd
Merge pull request #46336 from m4gr3d/fix_android_resources_inclusion
[3.2] Update the filtering logic to properly handle directories with `.gdignore` files
2021-02-25 14:15:19 +01:00
Hein-Pieter van Braam-Stewart 5f71fad6b6 Allow static linking with libatomic using clang
When using use_static_cpp we want to statically link with atomic as well
to make sure we don't incur any new runtime dependencies.

Scons doesn't quite support this so we do this little trick.
2021-02-23 14:48:51 +01:00
Fredia Huya-Kouadio 48108444f1 Update the filtering logic to properly handle directories with .gdignore files. 2021-02-22 20:18:56 -08:00
Hein-Pieter van Braam-Stewart 5ff172e34d Use -latomic when using clang (server platform)
version of c9b3a00a63 for the server
platform

(cherry picked from commit 6a146d405c)
2021-02-22 21:39:22 +01:00
Pedro J. Estébanez c75b3fedc4 Fix build error in UWP 2021-02-22 17:57:27 +01:00
Rémi Verschelde d1f023c35b SCons: Fix UWP build after #45618 2021-02-22 15:30:48 +01:00
Hein-Pieter van Braam f15f5b4578
Merge pull request #46242 from hpvb/dri-prime-amd
[3.2] Add 'AMD' GPU vendor name to PRIME detector
2021-02-20 17:19:04 +01:00
Hein-Pieter van Braam-Stewart 0cce213f14 Use -latomic when linking whe using clang on Linux
According to the LLVM documentation when using GNU's libstdc++ clang
will not automatically link with -latomic. This is necessary since we
merged c++11 atomics support.

This fixes linking using Clang on Linux
2021-02-20 16:37:00 +01:00
Hein-Pieter van Braam-Stewart 92687b4544 Add 'AMD' GPU vendor name to PRIME detector
Apparently some recent Mesa version also changed AMD's vendor string. In
addition I found a small uninitialized variable that's corrected now.
2021-02-20 02:03:05 +01:00
Rémi Verschelde 0d94bf707f
Merge pull request #46201 from Faless/js/3.x_canvas_size_pr
[3.2] [HTML5] Easier HTML templates, better canvas size handling.
2021-02-19 15:16:59 +01:00
Fabio Alessandrelli 45a67fab35 [HTML5] Better fullscreen, canvas resizing.
Three canvas resize policies:
- `None`: Godot window settings are ignored.
- `Project`: Godot handles the canvas like a native app (resizing it
  when setting the window size).
- `Adaptive`: Canvas size will always adapt to browser window size.

Use `None` if you want to control the canvas size with custom JavaScript
code.
2021-02-19 05:13:44 +01:00
Fabio Alessandrelli 1eef8a318b [HTML5] Easier HTML templates, better deinit/cleanup. 2021-02-19 05:13:44 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Fredia Huya-Kouadio ca6e1c1c45
Override ANDROID_NDK_ROOT based on the project ndk version.
This helps resolve issues where the project ndk version differs from the one pointed by the `ANDROID_NDK_ROOT` environment variable (if it exists).

(cherry picked from commit edeca16fb6)
2021-02-18 14:59:10 +01:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Fredia Huya-Kouadio ef9d945e16 Disable engine splash logic on Android; this is now handled by the Android theme api.
In addition, add support for scaling and applying filter to the splash screen on Android.
One limitation of the api being used is that the splash screen aspect ratio is not maintained when it's scaled up.
2021-02-18 03:17:58 -08:00
Pedro J. Estébanez 6d89f675b1 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-02-18 11:58:08 +01:00
Pedro J. Estébanez 8f6a636ae7 Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable`
- 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-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `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`
- `BinaryMutex` added for special cases as the non-recursive version
- `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`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00