diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2020-02-29 19:40:24 +0100 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2020-03-04 13:15:37 +0100 |
commit | ed0655cdfb64b1259042f6f28654e768420d4f38 (patch) | |
tree | 44c2ba30ccf8c91c8c3e634a6583eefe0439426d | |
parent | 8ffa35e44f93321d618b81ec48817f5de8668a83 (diff) |
Compilation fixes on Android
-rw-r--r-- | core/rid_owner.h | 4 | ||||
-rw-r--r-- | platform/android/audio_driver_opensl.cpp | 4 | ||||
-rw-r--r-- | platform/android/detect.py | 1 | ||||
-rw-r--r-- | platform/android/java_godot_lib_jni.cpp | 26 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 36 |
5 files changed, 39 insertions, 32 deletions
diff --git a/core/rid_owner.h b/core/rid_owner.h index bd01eba17d..5c8c48a4cb 100644 --- a/core/rid_owner.h +++ b/core/rid_owner.h @@ -298,7 +298,11 @@ public: if (description) { print_error("ERROR: " + itos(alloc_count) + " RID allocations of type '" + description + "' were leaked at exit."); } else { +#ifdef NO_SAFE_CAST + print_error("ERROR: " + itos(alloc_count) + " RID allocations of type 'unknown' were leaked at exit."); +#else print_error("ERROR: " + itos(alloc_count) + " RID allocations of type '" + typeid(T).name() + "' were leaked at exit."); +#endif } for (size_t i = 0; i < max_alloc; i++) { diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index 307bc3a169..222120f81f 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -328,13 +328,13 @@ AudioDriver::SpeakerMode AudioDriverOpenSL::get_speaker_mode() const { void AudioDriverOpenSL::lock() { - if (active && mutex) + if (active) mutex.lock(); } void AudioDriverOpenSL::unlock() { - if (active && mutex) + if (active) mutex.unlock(); } diff --git a/platform/android/detect.py b/platform/android/detect.py index 8b62360888..8f74ae0ef0 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -205,7 +205,6 @@ def configure(env): env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/include"]) env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"]) - env.Append(CXXFLAGS=["-std=gnu++14"]) # Disable exceptions and rtti on non-tools (template) builds if env['tools']: diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 900a452024..9b3b84c28b 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -187,7 +187,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a Vector<int> array = *p_arg; jintArray arr = env->NewIntArray(array.size()); const int *r = array.ptr(); - env->SetIntArrayRegion(arr, 0, array.size(), r.ptr()); + env->SetIntArrayRegion(arr, 0, array.size(), r); v.val.l = arr; v.obj = arr; @@ -196,7 +196,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a Vector<uint8_t> array = *p_arg; jbyteArray arr = env->NewByteArray(array.size()); const uint8_t *r = array.ptr(); - env->SetByteArrayRegion(arr, 0, array.size(), reinterpret_cast<const signed char *>(r.ptr())); + env->SetByteArrayRegion(arr, 0, array.size(), reinterpret_cast<const signed char *>(r)); v.val.l = arr; v.obj = arr; @@ -206,7 +206,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a Vector<float> array = *p_arg; jfloatArray arr = env->NewFloatArray(array.size()); const float *r = array.ptr(); - env->SetFloatArrayRegion(arr, 0, array.size(), r.ptr()); + env->SetFloatArrayRegion(arr, 0, array.size(), r); v.val.l = arr; v.obj = arr; @@ -293,8 +293,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { sarr.resize(fCount); int *w = sarr.ptrw(); - env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); - w.release(); + env->GetIntArrayRegion(arr, 0, fCount, w); return sarr; }; @@ -306,8 +305,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { sarr.resize(fCount); uint8_t *w = sarr.ptrw(); - env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr())); - w.release(); + env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w)); return sarr; }; @@ -332,7 +330,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { double n; env->GetDoubleArrayRegion(arr, i, 1, &n); - w.ptr()[i] = n; + w[i] = n; }; return sarr; }; @@ -350,7 +348,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { float n; env->GetFloatArrayRegion(arr, i, 1, &n); - w.ptr()[i] = n; + w[i] = n; }; return sarr; }; @@ -518,8 +516,7 @@ public: sarr.resize(fCount); int *w = sarr.ptrw(); - env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); - w.release(); + env->GetIntArrayRegion(arr, 0, fCount, w); ret = sarr; env->DeleteLocalRef(arr); } break; @@ -532,8 +529,7 @@ public: sarr.resize(fCount); float *w = sarr.ptrw(); - env->GetFloatArrayRegion(arr, 0, fCount, w.ptr()); - w.release(); + env->GetFloatArrayRegion(arr, 0, fCount, w); ret = sarr; env->DeleteLocalRef(arr); } break; @@ -1354,7 +1350,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, j JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params) { - Object *obj = ObjectDB::get_instance(ID); + Object *obj = ObjectDB::get_instance(ObjectID((uint64_t)ID)); ERR_FAIL_COND(!obj); int res = env->PushLocalFrame(16); @@ -1386,7 +1382,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params) { - Object *obj = ObjectDB::get_instance(ID); + Object *obj = ObjectDB::get_instance(ObjectID((uint64_t)ID)); ERR_FAIL_COND(!obj); int res = env->PushLocalFrame(16); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 15e3ac48c7..7e2b0d948e 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -32,7 +32,9 @@ #include "core/io/file_access_buffered_fa.h" #include "core/project_settings.h" +#if defined(OPENGL_ENABLED) #include "drivers/gles2/rasterizer_gles2.h" +#endif #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" #include "file_access_android.h" @@ -120,23 +122,27 @@ int OS_Android::get_current_video_driver() const { Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - bool gl_initialization_error = false; - // FIXME: Add Vulkan support. Readd fallback code from Vulkan to GLES2? - if (RasterizerGLES2::is_viable() == OK) { - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); - } else { - gl_initialization_error = true; - } - - if (gl_initialization_error) { - OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.\n" - "Please try updating your Android version.", - "Unable to initialize video driver"); - return ERR_UNAVAILABLE; +#if defined(OPENGL_ENABLED) + if (video_driver_index == VIDEO_DRIVER_GLES2) { + bool gl_initialization_error = false; + + if (RasterizerGLES2::is_viable() == OK) { + RasterizerGLES2::register_config(); + RasterizerGLES2::make_current(); + } else { + gl_initialization_error = true; + } + + if (gl_initialization_error) { + OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.\n" + "Please try updating your Android version.", + "Unable to initialize video driver"); + return ERR_UNAVAILABLE; + } } +#endif video_driver_index = p_video_driver; @@ -753,6 +759,8 @@ OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_god //rasterizer = NULL; use_gl2 = false; + visual_server = NULL; + godot_java = p_godot_java; godot_io_java = p_godot_io_java; |