summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export.cpp14
-rw-r--r--platform/android/java_glue.cpp4
-rw-r--r--platform/android/thread_jandroid.cpp15
-rw-r--r--platform/android/thread_jandroid.h3
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/os_windows.cpp3
-rw-r--r--platform/windows/os_windows.h4
-rw-r--r--platform/x11/detect.py4
8 files changed, 38 insertions, 13 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index eff3a7178d..8b3a64bbe6 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1073,11 +1073,7 @@ public:
//export_temp
ep.step("Exporting APK", 0);
- bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb", true));
-
- if (use_adb_over_usb) {
- p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
- }
+ p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk";
Error err = export_project(p_preset, true, export_to, p_debug_flags);
@@ -1123,7 +1119,7 @@ public:
return ERR_CANT_CREATE;
}
- if (use_adb_over_usb) {
+ if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
args.clear();
args.push_back("-s");
@@ -1142,6 +1138,9 @@ public:
OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
print_line("Reverse result: " + itos(rv));
+ }
+
+ if (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT) {
int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
@@ -1294,7 +1293,7 @@ public:
bool export_arm = p_preset->get("architecture/arm");
bool export_arm64 = p_preset->get("architecture/arm64");
- bool use_32_fb = p_preset->get("screen/use_32_bits_view");
+ bool use_32_fb = p_preset->get("graphics/32_bits_framebuffer");
bool immersive = p_preset->get("screen/immersive_mode");
bool _signed = p_preset->get("package/signed");
@@ -1724,7 +1723,6 @@ void register_android_exporter() {
EDITOR_DEF("export/android/force_system_user", false);
EDITOR_DEF("export/android/timestamping_authority_url", "");
- EDITOR_DEF("export/android/use_remote_debug_over_adb", false);
EDITOR_DEF("export/android/shutdown_adb_on_exit", true);
Ref<EditorExportAndroid> exporter = Ref<EditorExportAndroid>(memnew(EditorExportAndroid));
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 9abaae0a75..06abe9d751 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -1002,7 +1002,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaClassWrapper", java_class_wrapper));
_initialize_java_modules();
- Main::setup2();
+ // Since Godot is initialized on the UI thread, _main_thread_id was set to that thread's id,
+ // but for Godot purposes, the main thread is the one running the game loop
+ Main::setup2(Thread::get_caller_id());
++step;
suspend_mutex->unlock();
input_mutex->unlock();
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index 9e2e5452ca..79488197ea 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -29,9 +29,19 @@
/*************************************************************************/
#include "thread_jandroid.h"
+#include "core/safe_refcount.h"
#include "os/memory.h"
#include "script_language.h"
+static pthread_key_t _create_thread_id_key() {
+ pthread_key_t key;
+ pthread_key_create(&key, NULL);
+ return key;
+}
+
+pthread_key_t ThreadAndroid::thread_id_key = _create_thread_id_key();
+Thread::ID ThreadAndroid::next_thread_id = 0;
+
Thread::ID ThreadAndroid::get_id() const {
return id;
@@ -47,7 +57,8 @@ void *ThreadAndroid::thread_callback(void *userdata) {
ThreadAndroid *t = reinterpret_cast<ThreadAndroid *>(userdata);
setup_thread();
ScriptServer::thread_enter(); //scripts may need to attach a stack
- t->id = (ID)pthread_self();
+ t->id = atomic_increment(&next_thread_id);
+ pthread_setspecific(thread_id_key, (void *)t->id);
t->callback(t->user);
ScriptServer::thread_exit();
return NULL;
@@ -68,7 +79,7 @@ Thread *ThreadAndroid::create_func_jandroid(ThreadCreateCallback p_callback, voi
Thread::ID ThreadAndroid::get_thread_id_func_jandroid() {
- return (ID)pthread_self();
+ return (ID)pthread_getspecific(thread_id_key);
}
void ThreadAndroid::wait_to_finish_func_jandroid(Thread *p_thread) {
diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h
index bacc1ce435..b854a83e23 100644
--- a/platform/android/thread_jandroid.h
+++ b/platform/android/thread_jandroid.h
@@ -41,6 +41,9 @@
class ThreadAndroid : public Thread {
+ static pthread_key_t thread_id_key;
+ static ID next_thread_id;
+
pthread_t pthread;
pthread_attr_t pthread_attr;
ThreadCreateCallback callback;
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 882e1a808e..d239ccf7d2 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -171,6 +171,7 @@ def configure(env):
env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['/DWASAPI_ENABLED'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
env.Append(CCFLAGS=['/DWIN32'])
env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
@@ -252,8 +253,9 @@ def configure(env):
env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver])
- env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+ env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser'])
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 7b12482383..deb9c25576 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -2359,6 +2359,9 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
#endif
user_proc = NULL;
+#ifdef WASAPI_ENABLED
+ AudioDriverManager::add_driver(&driver_wasapi);
+#endif
#ifdef RTAUDIO_ENABLED
AudioDriverManager::add_driver(&driver_rtaudio);
#endif
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 01d904a4cc..0c5965bf51 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -32,6 +32,7 @@
#include "context_gl_win.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
+#include "drivers/wasapi/audio_driver_wasapi.h"
#include "os/input.h"
#include "os/os.h"
#include "power_windows.h"
@@ -123,6 +124,9 @@ class OS_Windows : public OS {
PowerWindows *power_manager;
+#ifdef WASAPI_ENABLED
+ AudioDriverWASAPI driver_wasapi;
+#endif
#ifdef RTAUDIO_ENABLED
AudioDriverRtAudio driver_rtaudio;
#endif
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 79778136ad..f355de0eb3 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -74,7 +74,9 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- env.Prepend(CCFLAGS=['-Ofast'])
+ # -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
+ # -ffast-math in code for which it generates wrong results.
+ env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
if (env["debug_release"] == "yes"):
env.Prepend(CCFLAGS=['-g2'])