summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/api/api.cpp4
-rw-r--r--platform/android/api/java_class_wrapper.h26
-rw-r--r--platform/android/export/export.cpp10
-rw-r--r--platform/android/java_class_wrapper.cpp22
-rw-r--r--platform/android/java_godot_lib_jni.cpp93
-rw-r--r--platform/iphone/SCsub1
-rw-r--r--platform/iphone/app_delegate.h7
-rw-r--r--platform/iphone/app_delegate.mm16
-rw-r--r--platform/iphone/detect.py14
-rw-r--r--platform/iphone/export/export.cpp6
-rw-r--r--platform/iphone/game_center.mm14
-rw-r--r--platform/iphone/icloud.mm16
-rw-r--r--platform/iphone/in_app_store.mm16
-rw-r--r--platform/iphone/os_iphone.cpp24
-rw-r--r--platform/iphone/os_iphone.h9
-rw-r--r--platform/iphone/vulkan_context_iphone.h48
-rw-r--r--platform/iphone/vulkan_context_iphone.mm56
-rw-r--r--platform/javascript/http_client_javascript.cpp32
-rw-r--r--platform/javascript/javascript_eval.cpp18
-rw-r--r--platform/javascript/os_javascript.cpp22
-rw-r--r--platform/osx/detect.py4
-rw-r--r--platform/osx/export/export.cpp16
-rw-r--r--platform/osx/os_osx.mm13
-rw-r--r--platform/server/detect.py4
-rw-r--r--platform/server/os_server.cpp1
-rw-r--r--platform/windows/export/export.cpp4
-rw-r--r--[-rwxr-xr-x]platform/windows/os_windows.cpp9
-rw-r--r--platform/x11/detect.py21
-rw-r--r--platform/x11/os_x11.cpp8
29 files changed, 341 insertions, 193 deletions
diff --git a/platform/android/api/api.cpp b/platform/android/api/api.cpp
index 2146c5409b..7efb545524 100644
--- a/platform/android/api/api.cpp
+++ b/platform/android/api/api.cpp
@@ -62,14 +62,14 @@ void JavaClassWrapper::_bind_methods() {
#if !defined(ANDROID_ENABLED)
-Variant JavaClass::call(const StringName &, const Variant **, int, Variant::CallError &) {
+Variant JavaClass::call(const StringName &, const Variant **, int, Callable::CallError &) {
return Variant();
}
JavaClass::JavaClass() {
}
-Variant JavaObject::call(const StringName &, const Variant **, int, Variant::CallError &) {
+Variant JavaObject::call(const StringName &, const Variant **, int, Callable::CallError &) {
return Variant();
}
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index 6c06d57ac1..48b581958b 100644
--- a/platform/android/api/java_class_wrapper.h
+++ b/platform/android/api/java_class_wrapper.h
@@ -113,12 +113,12 @@ class JavaClass : public Reference {
break;
case ARG_TYPE_FLOAT | ARG_NUMBER_CLASS_BIT:
case ARG_TYPE_FLOAT:
- r_type = Variant::REAL;
+ r_type = Variant::FLOAT;
likelihood = 1.0;
break;
case ARG_TYPE_DOUBLE | ARG_NUMBER_CLASS_BIT:
case ARG_TYPE_DOUBLE:
- r_type = Variant::REAL;
+ r_type = Variant::FLOAT;
likelihood = 0.5;
break;
case ARG_TYPE_STRING: r_type = Variant::STRING; break;
@@ -126,41 +126,41 @@ class JavaClass : public Reference {
case ARG_ARRAY_BIT | ARG_TYPE_VOID: r_type = Variant::NIL; break;
case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: r_type = Variant::ARRAY; break;
case ARG_ARRAY_BIT | ARG_TYPE_BYTE:
- r_type = Variant::POOL_BYTE_ARRAY;
+ r_type = Variant::PACKED_BYTE_ARRAY;
likelihood = 1.0;
break;
case ARG_ARRAY_BIT | ARG_TYPE_CHAR:
- r_type = Variant::POOL_BYTE_ARRAY;
+ r_type = Variant::PACKED_BYTE_ARRAY;
likelihood = 0.5;
break;
case ARG_ARRAY_BIT | ARG_TYPE_SHORT:
- r_type = Variant::POOL_INT_ARRAY;
+ r_type = Variant::PACKED_INT32_ARRAY;
likelihood = 0.3;
break;
case ARG_ARRAY_BIT | ARG_TYPE_INT:
- r_type = Variant::POOL_INT_ARRAY;
+ r_type = Variant::PACKED_INT32_ARRAY;
likelihood = 1.0;
break;
case ARG_ARRAY_BIT | ARG_TYPE_LONG:
- r_type = Variant::POOL_INT_ARRAY;
+ r_type = Variant::PACKED_INT32_ARRAY;
likelihood = 0.5;
break;
case ARG_ARRAY_BIT | ARG_TYPE_FLOAT:
- r_type = Variant::POOL_REAL_ARRAY;
+ r_type = Variant::PACKED_FLOAT32_ARRAY;
likelihood = 1.0;
break;
case ARG_ARRAY_BIT | ARG_TYPE_DOUBLE:
- r_type = Variant::POOL_REAL_ARRAY;
+ r_type = Variant::PACKED_FLOAT32_ARRAY;
likelihood = 0.5;
break;
- case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::POOL_STRING_ARRAY; break;
+ case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::PACKED_STRING_ARRAY; break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS: r_type = Variant::ARRAY; break;
}
}
_FORCE_INLINE_ static bool _convert_object_to_variant(JNIEnv *env, jobject obj, Variant &var, uint32_t p_sig);
- bool _call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error, Variant &ret);
+ bool _call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret);
friend class JavaClassWrapper;
Map<StringName, List<MethodInfo> > methods;
@@ -168,7 +168,7 @@ class JavaClass : public Reference {
#endif
public:
- virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
JavaClass();
};
@@ -185,7 +185,7 @@ class JavaObject : public Reference {
#endif
public:
- virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
#ifdef ANDROID_ENABLED
JavaObject(const Ref<JavaClass> &p_base, jobject *p_instance);
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 952bc3d28f..50bf671a84 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -337,7 +337,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
Vector<String> props = dp.split("\n");
String vendor;
String device;
- d.description + "Device ID: " + d.id + "\n";
+ d.description = "Device ID: " + d.id + "\n";
d.api_level = 0;
for (int j = 0; j < props.size(); j++) {
@@ -701,7 +701,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
aperms++;
}
- PoolStringArray user_perms = p_preset->get("permissions/custom_permissions");
+ PackedStringArray user_perms = p_preset->get("permissions/custom_permissions");
for (int i = 0; i < user_perms.size(); i++) {
String user_perm = user_perms[i].strip_edges();
@@ -1310,11 +1310,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
working_image->resize(p_icon.dimensions, p_icon.dimensions, Image::Interpolation::INTERPOLATE_LANCZOS);
}
- PoolVector<uint8_t> png_buffer;
+ Vector<uint8_t> png_buffer;
Error err = PNGDriverCommon::image_to_png(working_image, png_buffer);
if (err == OK) {
p_data.resize(png_buffer.size());
- memcpy(p_data.ptrw(), png_buffer.read().ptr(), p_data.size());
+ memcpy(p_data.ptrw(), png_buffer.ptr(), p_data.size());
} else {
String err_str = String("Failed to convert resized icon (") + p_processing_file_name + ") to png.";
WARN_PRINT(err_str.utf8().get_data());
@@ -1398,7 +1398,7 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "architectures/" + abi), is_default));
}
- r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "permissions/custom_permissions"), PoolStringArray()));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "permissions/custom_permissions"), PackedStringArray()));
const char **perms = android_perms;
while (*perms) {
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index fe2fd89710..9e9b17fb99 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -32,7 +32,7 @@
#include "string_android.h"
#include "thread_jandroid.h"
-bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error, Variant &ret) {
+bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret) {
Map<StringName, List<MethodInfo> >::Element *M = methods.find(p_method);
if (!M)
@@ -44,20 +44,20 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
for (List<MethodInfo>::Element *E = M->get().front(); E; E = E->next()) {
if (!p_instance && !E->get()._static) {
- r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
+ r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
continue;
}
int pc = E->get().param_types.size();
if (pc > p_argcount) {
- r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = pc;
continue;
}
if (pc < p_argcount) {
- r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
+ r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument = pc;
continue;
}
@@ -97,7 +97,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
case ARG_TYPE_DOUBLE: {
if (!p_args[i]->is_num())
- arg_expected = Variant::REAL;
+ arg_expected = Variant::FLOAT;
} break;
case ARG_TYPE_STRING: {
@@ -141,7 +141,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
}
if (arg_expected != Variant::NIL) {
- r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = i;
r_error.expected = arg_expected;
valid = false;
@@ -158,7 +158,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
if (!method)
return true; //no version convinces
- r_error.error = Variant::CallError::CALL_OK;
+ r_error.error = Callable::CallError::CALL_OK;
jvalue *argv = NULL;
@@ -405,7 +405,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
}
}
- r_error.error = Variant::CallError::CALL_OK;
+ r_error.error = Callable::CallError::CALL_OK;
bool success = true;
switch (method->return_type) {
@@ -501,7 +501,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
if (!_convert_object_to_variant(env, obj, ret, method->return_type)) {
ret = Variant();
- r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
success = false;
}
env->DeleteLocalRef(obj);
@@ -517,7 +517,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
return success;
}
-Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
Variant ret;
bool found = _call_method(NULL, p_method, p_args, p_argcount, r_error, ret);
@@ -533,7 +533,7 @@ JavaClass::JavaClass() {
/////////////////////
-Variant JavaObject::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+Variant JavaObject::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
return Variant();
}
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index dedb2ee114..900a452024 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -99,7 +99,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
v.val.i = *p_arg;
};
} break;
- case Variant::REAL: {
+ case Variant::FLOAT: {
if (force_jobject) {
@@ -123,9 +123,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
v.val.l = jStr;
v.obj = jStr;
} break;
- case Variant::POOL_STRING_ARRAY: {
+ case Variant::PACKED_STRING_ARRAY: {
- PoolVector<String> sarray = *p_arg;
+ Vector<String> sarray = *p_arg;
jobjectArray arr = env->NewObjectArray(sarray.size(), env->FindClass("java/lang/String"), env->NewStringUTF(""));
for (int j = 0; j < sarray.size(); j++) {
@@ -182,35 +182,39 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
v.obj = jdict;
} break;
- case Variant::POOL_INT_ARRAY: {
+ case Variant::PACKED_INT32_ARRAY: {
- PoolVector<int> array = *p_arg;
+ Vector<int> array = *p_arg;
jintArray arr = env->NewIntArray(array.size());
- PoolVector<int>::Read r = array.read();
+ const int *r = array.ptr();
env->SetIntArrayRegion(arr, 0, array.size(), r.ptr());
v.val.l = arr;
v.obj = arr;
} break;
- case Variant::POOL_BYTE_ARRAY: {
- PoolVector<uint8_t> array = *p_arg;
+ case Variant::PACKED_BYTE_ARRAY: {
+ Vector<uint8_t> array = *p_arg;
jbyteArray arr = env->NewByteArray(array.size());
- PoolVector<uint8_t>::Read r = array.read();
+ const uint8_t *r = array.ptr();
env->SetByteArrayRegion(arr, 0, array.size(), reinterpret_cast<const signed char *>(r.ptr()));
v.val.l = arr;
v.obj = arr;
} break;
- case Variant::POOL_REAL_ARRAY: {
+ case Variant::PACKED_FLOAT32_ARRAY: {
- PoolVector<float> array = *p_arg;
+ Vector<float> array = *p_arg;
jfloatArray arr = env->NewFloatArray(array.size());
- PoolVector<float>::Read r = array.read();
+ const float *r = array.ptr();
env->SetFloatArrayRegion(arr, 0, array.size(), r.ptr());
v.val.l = arr;
v.obj = arr;
} break;
+#ifndef _MSC_VER
+#warning This is missing 64 bits arrays, I have no idea how to do it in JNI
+#endif
+
default: {
v.val.i = 0;
@@ -255,7 +259,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jobjectArray arr = (jobjectArray)obj;
int stringCount = env->GetArrayLength(arr);
- PoolVector<String> sarr;
+ Vector<String> sarr;
for (int i = 0; i < stringCount; i++) {
jstring string = (jstring)env->GetObjectArrayElement(arr, i);
@@ -285,10 +289,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jintArray arr = (jintArray)obj;
int fCount = env->GetArrayLength(arr);
- PoolVector<int> sarr;
+ Vector<int> sarr;
sarr.resize(fCount);
- PoolVector<int>::Write w = sarr.write();
+ int *w = sarr.ptrw();
env->GetIntArrayRegion(arr, 0, fCount, w.ptr());
w.release();
return sarr;
@@ -298,10 +302,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jbyteArray arr = (jbyteArray)obj;
int fCount = env->GetArrayLength(arr);
- PoolVector<uint8_t> sarr;
+ Vector<uint8_t> sarr;
sarr.resize(fCount);
- PoolVector<uint8_t>::Write w = sarr.write();
+ uint8_t *w = sarr.ptrw();
env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr()));
w.release();
return sarr;
@@ -319,10 +323,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jdoubleArray arr = (jdoubleArray)obj;
int fCount = env->GetArrayLength(arr);
- PoolRealArray sarr;
+ PackedFloat32Array sarr;
sarr.resize(fCount);
- PoolRealArray::Write w = sarr.write();
+ real_t *w = sarr.ptrw();
for (int i = 0; i < fCount; i++) {
@@ -337,10 +341,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jfloatArray arr = (jfloatArray)obj;
int fCount = env->GetArrayLength(arr);
- PoolRealArray sarr;
+ PackedFloat32Array sarr;
sarr.resize(fCount);
- PoolRealArray::Write w = sarr.write();
+ real_t *w = sarr.ptrw();
for (int i = 0; i < fCount; i++) {
@@ -374,7 +378,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;");
jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys);
- PoolStringArray keys = _jobject_to_variant(env, arr);
+ PackedStringArray keys = _jobject_to_variant(env, arr);
env->DeleteLocalRef(arr);
jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;");
@@ -411,30 +415,30 @@ class JNISingleton : public Object {
Map<StringName, MethodData> method_map;
public:
- virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
ERR_FAIL_COND_V(!instance, Variant());
- r_error.error = Variant::CallError::CALL_OK;
+ r_error.error = Callable::CallError::CALL_OK;
Map<StringName, MethodData>::Element *E = method_map.find(p_method);
if (!E) {
- r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
return Variant();
}
int ac = E->get().argtypes.size();
if (ac < p_argcount) {
- r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = ac;
return Variant();
}
if (ac > p_argcount) {
- r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
+ r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument = ac;
return Variant();
}
@@ -443,7 +447,7 @@ public:
if (!Variant::can_convert(p_args[i]->get_type(), E->get().argtypes[i])) {
- r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = i;
r_error.expected = E->get().argtypes[i];
}
@@ -487,7 +491,7 @@ public:
ret = env->CallIntMethodA(instance, E->get().method, v);
} break;
- case Variant::REAL: {
+ case Variant::FLOAT: {
ret = env->CallFloatMethodA(instance, E->get().method, v);
} break;
@@ -497,7 +501,7 @@ public:
ret = jstring_to_string((jstring)o, env);
env->DeleteLocalRef(o);
} break;
- case Variant::POOL_STRING_ARRAY: {
+ case Variant::PACKED_STRING_ARRAY: {
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance, E->get().method, v);
@@ -505,35 +509,38 @@ public:
env->DeleteLocalRef(arr);
} break;
- case Variant::POOL_INT_ARRAY: {
+ case Variant::PACKED_INT32_ARRAY: {
jintArray arr = (jintArray)env->CallObjectMethodA(instance, E->get().method, v);
int fCount = env->GetArrayLength(arr);
- PoolVector<int> sarr;
+ Vector<int> sarr;
sarr.resize(fCount);
- PoolVector<int>::Write w = sarr.write();
+ int *w = sarr.ptrw();
env->GetIntArrayRegion(arr, 0, fCount, w.ptr());
w.release();
ret = sarr;
env->DeleteLocalRef(arr);
} break;
- case Variant::POOL_REAL_ARRAY: {
+ case Variant::PACKED_FLOAT32_ARRAY: {
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance, E->get().method, v);
int fCount = env->GetArrayLength(arr);
- PoolVector<float> sarr;
+ Vector<float> sarr;
sarr.resize(fCount);
- PoolVector<float>::Write w = sarr.write();
+ float *w = sarr.ptrw();
env->GetFloatArrayRegion(arr, 0, fCount, w.ptr());
w.release();
ret = sarr;
env->DeleteLocalRef(arr);
} break;
+#ifndef _MSC_VER
+#warning This is missing 64 bits arrays, I have no idea how to do it in JNI
+#endif
case Variant::DICTIONARY: {
jobject obj = env->CallObjectMethodA(instance, E->get().method, v);
@@ -1246,13 +1253,13 @@ static Variant::Type get_jni_type(const String &p_type) {
{ "void", Variant::NIL },
{ "boolean", Variant::BOOL },
{ "int", Variant::INT },
- { "float", Variant::REAL },
- { "double", Variant::REAL },
+ { "float", Variant::FLOAT },
+ { "double", Variant::FLOAT },
{ "java.lang.String", Variant::STRING },
- { "[I", Variant::POOL_INT_ARRAY },
- { "[B", Variant::POOL_BYTE_ARRAY },
- { "[F", Variant::POOL_REAL_ARRAY },
- { "[Ljava.lang.String;", Variant::POOL_STRING_ARRAY },
+ { "[I", Variant::PACKED_INT32_ARRAY },
+ { "[B", Variant::PACKED_BYTE_ARRAY },
+ { "[F", Variant::PACKED_FLOAT32_ARRAY },
+ { "[Ljava.lang.String;", Variant::PACKED_STRING_ARRAY },
{ "org.godotengine.godot.Dictionary", Variant::DICTIONARY },
{ NULL, Variant::NIL }
};
@@ -1370,7 +1377,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en
env->DeleteLocalRef(obj);
};
- Variant::CallError err;
+ Callable::CallError err;
obj->call(str_method, (const Variant **)vptr, count, err);
// something
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index fa1b124561..1f82f51888 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -14,6 +14,7 @@ iphone_lib = [
'in_app_store.mm',
'icloud.mm',
'ios.mm',
+ 'vulkan_context_iphone.mm',
]
env_ios = env.Clone()
diff --git a/platform/iphone/app_delegate.h b/platform/iphone/app_delegate.h
index b4454aab11..6b3b7ad5bc 100644
--- a/platform/iphone/app_delegate.h
+++ b/platform/iphone/app_delegate.h
@@ -28,13 +28,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#if defined(OPENGL_ENABLED)
#import "gl_view.h"
+#endif
#import "view_controller.h"
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
+#if defined(OPENGL_ENABLED)
@interface AppDelegate : NSObject <UIApplicationDelegate, GLViewDelegate> {
+#endif
+#if defined(VULKAN_ENABLED)
+@interface AppDelegate : NSObject <UIApplicationDelegate> {
+#endif
//@property (strong, nonatomic) UIWindow *window;
ViewController *view_controller;
bool is_focus_out;
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 4de321fa04..acc3e5d4e0 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -32,7 +32,9 @@
#include "core/project_settings.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
+#if defined(OPENGL_ENABLED)
#import "gl_view.h"
+#endif
#include "main/main.h"
#include "os_iphone.h"
@@ -412,10 +414,12 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
OS::VideoMode _get_video_mode() {
int backingWidth;
int backingHeight;
+#if defined(OPENGL_ENABLED)
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+#endif
OS::VideoMode vm;
vm.fullscreen = true;
@@ -426,7 +430,7 @@ OS::VideoMode _get_video_mode() {
};
static int frame_count = 0;
-- (void)drawView:(GLView *)view;
+- (void)drawView:(UIView *)view;
{
switch (frame_count) {
@@ -634,6 +638,7 @@ static int frame_count = 0;
return FALSE;
};
+#if defined(OPENGL_ENABLED)
// WARNING: We must *always* create the GLView after we have constructed the
// OS with iphone_main. This allows the GLView to access project settings so
// it can properly initialize the OpenGL context
@@ -642,7 +647,7 @@ static int frame_count = 0;
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
- window.rootViewController = view_controller;
+
_set_keep_screen_on(bool(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true)) ? YES : NO);
glView.useCADisplayLink =
@@ -650,6 +655,13 @@ static int frame_count = 0;
printf("cadisaplylink: %d", glView.useCADisplayLink);
glView.animationInterval = 1.0 / kRenderingFrequency;
[glView startAnimation];
+#endif
+
+#if defined(VULKAN_ENABLED)
+ view_controller = [[ViewController alloc] init];
+#endif
+
+ window.rootViewController = view_controller;
// Show the window
[window makeKeyAndVisible];
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index f646b8b1d5..e01950c1db 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -23,6 +23,7 @@ def get_opts():
return [
('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
('IPHONESDK', 'Path to the iPhone SDK', ''),
+ BoolVariable('use_static_mvk', 'Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)', False),
BoolVariable('game_center', 'Support for game center', True),
BoolVariable('store_kit', 'Support for in-app store', True),
BoolVariable('icloud', 'Support for iCloud', True),
@@ -149,7 +150,7 @@ def configure(env):
'-framework', 'Foundation',
'-framework', 'GameController',
'-framework', 'MediaPlayer',
- '-framework', 'OpenGLES',
+ '-framework', 'Metal',
'-framework', 'QuartzCore',
'-framework', 'Security',
'-framework', 'SystemConfiguration',
@@ -170,11 +171,18 @@ def configure(env):
env.Append(CPPDEFINES=['ICLOUD_ENABLED'])
env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
- '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
'$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
])
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Prepend(CPPPATH=['#platform/iphone'])
- env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'GLES_ENABLED', 'COREAUDIO_ENABLED'])
+ env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'COREAUDIO_ENABLED'])
+
+ env.Append(CPPDEFINES=['VULKAN_ENABLED'])
+ env.Append(LINKFLAGS=['-framework', 'IOSurface'])
+ if (env['use_static_mvk']):
+ env.Append(LINKFLAGS=['-framework', 'MoltenVK'])
+ env['builtin_vulkan'] = False
+ elif not env['builtin_vulkan']:
+ env.Append(LIBS=['vulkan'])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 0767ce7638..7cef2351e3 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -447,9 +447,6 @@ void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p
ERR_FAIL_COND(p_dst.is_null());
ERR_FAIL_COND(p_src.is_null());
- p_dst->lock();
- p_src->lock();
-
int sw = p_rot ? p_src->get_height() : p_src->get_width();
int sh = p_rot ? p_src->get_width() : p_src->get_height();
@@ -473,9 +470,6 @@ void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p
p_dst->set_pixel(x_pos + x, y_pos + y, dc);
}
}
-
- p_dst->unlock();
- p_src->unlock();
}
struct IconInfo {
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 696f61f954..99d539d4ff 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -198,11 +198,11 @@ void GameCenter::request_achievement_descriptions() {
ret["type"] = "achievement_descriptions";
if (error == nil) {
ret["result"] = "ok";
- PoolStringArray names;
- PoolStringArray titles;
- PoolStringArray unachieved_descriptions;
- PoolStringArray achieved_descriptions;
- PoolIntArray maximum_points;
+ PackedStringArray names;
+ PackedStringArray titles;
+ PackedStringArray unachieved_descriptions;
+ PackedStringArray achieved_descriptions;
+ PackedInt32Array maximum_points;
Array hidden;
Array replayable;
@@ -253,8 +253,8 @@ void GameCenter::request_achievements() {
ret["type"] = "achievements";
if (error == nil) {
ret["result"] = "ok";
- PoolStringArray names;
- PoolRealArray percentages;
+ PackedStringArray names;
+ PackedFloat32Array percentages;
for (int i = 0; i < [achievements count]; i++) {
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index f846043dde..251f78f2da 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -80,13 +80,13 @@ Variant nsobject_to_variant(NSObject *object) {
const char *str = [(NSString *)object UTF8String];
return String::utf8(str != NULL ? str : "");
} else if ([object isKindOfClass:[NSData class]]) {
- PoolByteArray ret;
+ PackedByteArray ret;
NSData *data = (NSData *)object;
if ([data length] > 0) {
ret.resize([data length]);
{
- PoolByteArray::Write w = ret.write();
- copymem(w.ptr(), [data bytes], [data length]);
+ // PackedByteArray::Write w = ret.write();
+ copymem((void *)ret.ptr(), [data bytes], [data length]);
}
}
return ret;
@@ -184,10 +184,10 @@ NSObject *variant_to_nsobject(Variant v) {
[result addObject:value];
}
return result;
- } else if (v.get_type() == Variant::POOL_BYTE_ARRAY) {
- PoolByteArray arr = v;
- PoolByteArray::Read r = arr.read();
- NSData *result = [NSData dataWithBytes:r.ptr() length:arr.size()];
+ } else if (v.get_type() == Variant::PACKED_BYTE_ARRAY) {
+ PackedByteArray arr = v;
+ // PackedByteArray::Read r = arr.read();
+ NSData *result = [NSData dataWithBytes:arr.ptr() length:arr.size()];
return result;
}
WARN_PRINT(String("Could not add unsupported type to iCloud: '" + Variant::get_type_name(v.get_type()) + "'").utf8().get_data());
@@ -315,7 +315,7 @@ ICloud::ICloud() {
Dictionary ret;
ret["type"] = "key_value_changed";
- //PoolStringArray result_keys;
+ //PackedStringArray result_keys;
//Array result_values;
Dictionary keyValues;
String reason = "";
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 855ab195b0..a8a887824f 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -85,12 +85,12 @@ void InAppStore::_bind_methods() {
Dictionary ret;
ret["type"] = "product_info";
ret["result"] = "ok";
- PoolStringArray titles;
- PoolStringArray descriptions;
- PoolRealArray prices;
- PoolStringArray ids;
- PoolStringArray localized_prices;
- PoolStringArray currency_codes;
+ PackedStringArray titles;
+ PackedStringArray descriptions;
+ PackedFloat32Array prices;
+ PackedStringArray ids;
+ PackedStringArray localized_prices;
+ PackedStringArray currency_codes;
for (NSUInteger i = 0; i < [products count]; i++) {
@@ -113,7 +113,7 @@ void InAppStore::_bind_methods() {
ret["localized_prices"] = localized_prices;
ret["currency_codes"] = currency_codes;
- PoolStringArray invalid_ids;
+ PackedStringArray invalid_ids;
for (NSString *ipid in response.invalidProductIdentifiers) {
@@ -133,7 +133,7 @@ Error InAppStore::request_product_info(Variant p_params) {
Dictionary params = p_params;
ERR_FAIL_COND_V(!params.has("product_ids"), ERR_INVALID_PARAMETER);
- PoolStringArray pids = params["product_ids"];
+ PackedStringArray pids = params["product_ids"];
printf("************ request product info! %i\n", pids.size());
NSMutableArray *array = [[[NSMutableArray alloc] initWithCapacity:pids.size()] autorelease];
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 634062f46b..db203ff2b3 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -32,7 +32,16 @@
#include "os_iphone.h"
+#if defined(OPENGL_ENABLED)
#include "drivers/gles2/rasterizer_gles2.h"
+#endif
+
+#if defined(VULKAN_ENABLED)
+#include "servers/visual/rasterizer_rd/rasterizer_rd.h"
+// #import <QuartzCore/CAMetalLayer.h>
+#include <vulkan/vulkan_metal.h>
+#endif
+
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
@@ -101,7 +110,9 @@ int OSIPhone::get_current_video_driver() const {
}
Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+ video_driver_index = p_video_driver;
+#if defined(OPENGL_ENABLED)
bool gl_initialization_error = false;
// FIXME: Add Vulkan support via MoltenVK. Add fallback code back?
@@ -118,19 +129,25 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
"Unable to initialize video driver");
return ERR_UNAVAILABLE;
}
+#endif
- video_driver_index = p_video_driver;
+#if defined(VULKAN_ENABLED)
+ RasterizerRD::make_current();
+#endif
+
+
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
}
-
visual_server->init();
//visual_server->cursor_set_visible(false, 0);
+#if defined(OPENGL_ENABLED)
// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
RasterizerStorageGLES2::system_fbo = gl_view_base_fb;
+#endif
AudioDriverManager::initialize(p_audio_driver);
@@ -437,9 +454,10 @@ bool OSIPhone::can_draw() const {
};
int OSIPhone::set_base_framebuffer(int p_fb) {
-
+#if defined(OPENGL_ENABLED)
// gl_view_base_fb has not been updated yet
RasterizerStorageGLES2::system_fbo = p_fb;
+#endif
return 0;
};
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index d2d96181f5..f42679e754 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -46,6 +46,11 @@
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
+#if defined(VULKAN_ENABLED)
+#include "drivers/vulkan/rendering_device_vulkan.h"
+#include "platform/iphone/vulkan_context_iphone.h"
+#endif
+
class OSIPhone : public OS_Unix {
private:
@@ -74,6 +79,10 @@ private:
MainLoop *main_loop;
+#if defined(VULKAN_ENABLED)
+ VulkanContextIPhone *context_vulkan;
+ RenderingDeviceVulkan *rendering_device_vulkan;
+#endif
VideoMode video_mode;
virtual int get_video_driver_count() const;
diff --git a/platform/iphone/vulkan_context_iphone.h b/platform/iphone/vulkan_context_iphone.h
new file mode 100644
index 0000000000..200057e14d
--- /dev/null
+++ b/platform/iphone/vulkan_context_iphone.h
@@ -0,0 +1,48 @@
+/*************************************************************************/
+/* vulkan_context_osx.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef VULKAN_CONTEXT_IPHONE_H
+#define VULKAN_CONTEXT_IPHONE_H
+
+#include "drivers/vulkan/vulkan_context.h"
+// #import <UIKit/UIKit.h>
+
+class VulkanContextIPhone : public VulkanContext {
+
+ virtual const char *_get_platform_surface_extension() const;
+
+public:
+ int window_create(void *p_window, int p_width, int p_height);
+
+ VulkanContextIPhone();
+ ~VulkanContextIPhone();
+};
+
+#endif // VULKAN_CONTEXT_IPHONE_H
diff --git a/platform/iphone/vulkan_context_iphone.mm b/platform/iphone/vulkan_context_iphone.mm
new file mode 100644
index 0000000000..f49b85c097
--- /dev/null
+++ b/platform/iphone/vulkan_context_iphone.mm
@@ -0,0 +1,56 @@
+/*************************************************************************/
+/* vulkan_context_osx.mm */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "vulkan_context_iphone.h"
+#include <vulkan/vulkan_ios.h>
+
+const char *VulkanContextIPhone::_get_platform_surface_extension() const {
+ return VK_MVK_IOS_SURFACE_EXTENSION_NAME;
+}
+
+int VulkanContextIPhone::window_create(void *p_window, int p_width, int p_height) {
+
+ VkIOSSurfaceCreateInfoMVK createInfo;
+ createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.pView = p_window;
+
+ VkSurfaceKHR surface;
+ VkResult err = vkCreateIOSSurfaceMVK(_get_instance(), &createInfo, NULL, &surface);
+ ERR_FAIL_COND_V(err, -1);
+ return _window_create(surface, p_width, p_height);
+}
+
+VulkanContextIPhone::VulkanContextIPhone() {
+}
+
+VulkanContextIPhone::~VulkanContextIPhone() {
+}
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 2c2511a3a5..d7796cc4f4 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -103,12 +103,12 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve
return OK;
}
-Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const PoolVector<uint8_t> &p_body) {
+Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const Vector<uint8_t> &p_body) {
Error err = prepare_request(p_method, p_url, p_headers);
if (err != OK)
return err;
- PoolByteArray::Read read = p_body.read();
+ const uint8_t *read = p_body.ptr();
godot_xhr_send_data(xhr_id, read.ptr(), p_body.size());
return OK;
}
@@ -173,18 +173,18 @@ int HTTPClient::get_response_body_length() const {
return polled_response.size();
}
-PoolByteArray HTTPClient::read_response_body_chunk() {
+PackedByteArray HTTPClient::read_response_body_chunk() {
- ERR_FAIL_COND_V(status != STATUS_BODY, PoolByteArray());
+ ERR_FAIL_COND_V(status != STATUS_BODY, PackedByteArray());
int to_read = MIN(read_limit, polled_response.size() - response_read_offset);
- PoolByteArray chunk;
+ PackedByteArray chunk;
chunk.resize(to_read);
- PoolByteArray::Write write = chunk.write();
- PoolByteArray::Read read = polled_response.read();
+ uint8_t *write = chunk.ptrw();
+ const uint8_t *read = polled_response.ptr();
memcpy(write.ptr(), read.ptr() + response_read_offset, to_read);
- write = PoolByteArray::Write();
- read = PoolByteArray::Read();
+ write = uint8_t * ();
+ read = const uint8_t * ();
response_read_offset += to_read;
if (response_read_offset == polled_response.size()) {
@@ -263,23 +263,23 @@ Error HTTPClient::poll() {
status = STATUS_BODY;
- PoolByteArray bytes;
+ PackedByteArray bytes;
int len = godot_xhr_get_response_headers_length(xhr_id);
bytes.resize(len + 1);
- PoolByteArray::Write write = bytes.write();
+ uint8_t *write = bytes.ptrw();
godot_xhr_get_response_headers(xhr_id, reinterpret_cast<char *>(write.ptr()), len);
write[len] = 0;
- write = PoolByteArray::Write();
+ write = uint8_t * ();
- PoolByteArray::Read read = bytes.read();
+ const uint8_t *read = bytes.ptr();
polled_response_header = String::utf8(reinterpret_cast<const char *>(read.ptr()));
- read = PoolByteArray::Read();
+ read = const uint8_t * ();
polled_response.resize(godot_xhr_get_response_length(xhr_id));
- write = polled_response.write();
+ write = polled_response.ptrw();
godot_xhr_get_response(xhr_id, write.ptr(), polled_response.size());
- write = PoolByteArray::Write();
+ write = uint8_t * ();
break;
}
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index d907222d24..44cce28d57 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.cpp
@@ -33,7 +33,7 @@
#include "api/javascript_eval.h"
#include "emscripten.h"
-extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_poolbytearray_and_open_write(PoolByteArray *p_arr, PoolByteArray::Write *r_write, int p_len) {
+extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_PackedByteArray_and_open_write(PackedByteArray *p_arr, uint8_t **r_write, int p_len) {
p_arr->resize(p_len);
*r_write = p_arr->write();
@@ -48,8 +48,8 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
char *s;
} js_data;
- PoolByteArray arr;
- PoolByteArray::Write arr_write;
+ PackedByteArray arr;
+ uint8_t *arr_write;
/* clang-format off */
Variant::Type return_type = static_cast<Variant::Type>(EM_ASM_INT({
@@ -81,7 +81,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
case 'number':
setValue(PTR, eval_ret, 'double');
- return 3; // REAL
+ return 3; // FLOAT
case 'string':
var array_len = lengthBytesUTF8(eval_ret)+1;
@@ -114,9 +114,9 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
eval_ret = new Uint8Array(eval_ret);
}
if (eval_ret instanceof Uint8Array) {
- var bytes_ptr = ccall('resize_poolbytearray_and_open_write', 'number', ['number', 'number' ,'number'], [BYTEARRAY_PTR, BYTEARRAY_WRITE_PTR, eval_ret.length]);
+ var bytes_ptr = ccall('resize_PackedByteArray_and_open_write', 'number', ['number', 'number' ,'number'], [BYTEARRAY_PTR, BYTEARRAY_WRITE_PTR, eval_ret.length]);
HEAPU8.set(eval_ret, bytes_ptr);
- return 20; // POOL_BYTE_ARRAY
+ return 20; // PACKED_BYTE_ARRAY
}
break;
}
@@ -128,7 +128,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
switch (return_type) {
case Variant::BOOL:
return js_data.b;
- case Variant::REAL:
+ case Variant::FLOAT:
return js_data.d;
case Variant::STRING: {
String str = String::utf8(js_data.s);
@@ -137,8 +137,8 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
/* clang-format on */
return str;
}
- case Variant::POOL_BYTE_ARRAY:
- arr_write = PoolByteArray::Write();
+ case Variant::PACKED_BYTE_ARRAY:
+ arr_write = uint8_t * ();
return arr;
default:
return Variant();
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 8ba2b39c85..5acdc5f602 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -536,17 +536,17 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
png_meta.height = texture_size.height;
png_meta.format = PNG_FORMAT_RGBA;
- PoolByteArray png;
+ PackedByteArray png;
size_t len;
- PoolByteArray::Read r = image->get_data().read();
+ const uint8_t *r = image->get_data().ptr();
ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL));
png.resize(len);
- PoolByteArray::Write w = png.write();
+ uint8_t *w = png.ptrw();
ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL));
- w = PoolByteArray::Write();
+ w = uint8_t * ();
- r = png.read();
+ r = png.ptr();
char *object_url;
/* clang-format off */
@@ -563,7 +563,7 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
stringToUTF8(url, string_on_wasm_heap, length_bytes);
}, r.ptr(), len, &object_url);
/* clang-format on */
- r = PoolByteArray::Read();
+ r = const uint8_t * ();
String url = String::utf8(object_url) + "?" + itos(p_hotspot.x) + " " + itos(p_hotspot.y);
@@ -1178,17 +1178,17 @@ void OS_JavaScript::set_icon(const Ref<Image> &p_icon) {
png_meta.height = icon->get_height();
png_meta.format = PNG_FORMAT_RGBA;
- PoolByteArray png;
+ PackedByteArray png;
size_t len;
- PoolByteArray::Read r = icon->get_data().read();
+ const uint8_t *r = icon->get_data().ptr();
ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL));
png.resize(len);
- PoolByteArray::Write w = png.write();
+ uint8_t *w = png.ptrw();
ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL));
- w = PoolByteArray::Write();
+ w = uint8_t * ();
- r = png.read();
+ r = png.ptr();
/* clang-format off */
EM_ASM_ARGS({
var PNG_PTR = $0;
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 0b164a2c56..12ca5c10dc 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -164,5 +164,5 @@ def configure(env):
#env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED'])
- env.Append(CCFLAGS=['-mmacosx-version-min=10.11'])
- env.Append(LINKFLAGS=['-mmacosx-version-min=10.11'])
+ env.Append(CCFLAGS=['-mmacosx-version-min=10.12'])
+ env.Append(LINKFLAGS=['-mmacosx-version-min=10.12'])
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 312987b8cb..dbe52da912 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -139,7 +139,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/timestamp"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/hardened_runtime"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/entitlements", PROPERTY_HINT_GLOBAL_FILE, "*.plist"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "codesign/custom_options"), PoolStringArray()));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray()));
#endif
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true));
@@ -147,7 +147,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false));
}
-void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_source, Vector<uint8_t> &p_dest) {
+void _rgba8_to_packbits_encode(int p_ch, int p_size, Vector<uint8_t> &p_source, Vector<uint8_t> &p_dest) {
int src_len = p_size * p_size;
@@ -160,11 +160,11 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour
int i = 0;
while (i < src_len) {
- uint8_t cur = p_source.read()[i * 4 + p_ch];
+ uint8_t cur = p_source.ptr()[i * 4 + p_ch];
if (i < src_len - 2) {
- if ((p_source.read()[(i + 1) * 4 + p_ch] == cur) && (p_source.read()[(i + 2) * 4 + p_ch] == cur)) {
+ if ((p_source.ptr()[(i + 1) * 4 + p_ch] == cur) && (p_source.ptr()[(i + 2) * 4 + p_ch] == cur)) {
if (buf_size > 0) {
result.write[res_size++] = (uint8_t)(buf_size - 1);
copymem(&result.write[res_size], &buf, buf_size);
@@ -176,7 +176,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour
bool hit_lim = true;
for (int j = 3; j <= lim; j++) {
- if (p_source.read()[(i + j) * 4 + p_ch] != cur) {
+ if (p_source.ptr()[(i + j) * 4 + p_ch] != cur) {
hit_lim = false;
i = i + j - 1;
result.write[res_size++] = (uint8_t)(j - 3 + 0x80);
@@ -278,7 +278,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
DirAccess::remove_file_or_error(path);
} else {
- PoolVector<uint8_t> src_data = copy->get_data();
+ Vector<uint8_t> src_data = copy->get_data();
//encode 24bit RGB RLE icon
{
@@ -302,7 +302,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
data.resize(data.size() + len + 8);
for (int j = 0; j < len; j++) {
- data.write[ofs + 8 + j] = src_data.read()[j * 4 + 3];
+ data.write[ofs + 8 + j] = src_data.ptr()[j * 4 + 3];
}
len += 8;
len = BSWAP32(len);
@@ -386,7 +386,7 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese
args.push_back(p_preset->get("codesign/entitlements"));
}
- PoolStringArray user_args = p_preset->get("codesign/custom_options");
+ PackedStringArray user_args = p_preset->get("codesign/custom_options");
for (int i = 0; i < user_args.size(); i++) {
String user_arg = user_args[i].strip_edges();
if (!user_arg.empty()) {
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index ca29c95f57..f2e5f9369c 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -747,7 +747,7 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
const Vector2 pos = get_mouse_pos([event locationInWindow], backingScaleFactor);
mm->set_position(pos);
mm->set_pressure([event pressure]);
- if ([event subtype] == NSTabletPointEventSubtype) {
+ if ([event subtype] == NSEventSubtypeTabletPoint) {
const NSPoint p = [event tilt];
mm->set_tilt(Vector2(p.x, p.y));
}
@@ -1757,7 +1757,7 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) {
[window addButtonWithTitle:@"OK"];
[window setMessageText:ns_title];
[window setInformativeText:ns_alert];
- [window setAlertStyle:NSWarningAlertStyle];
+ [window setAlertStyle:NSAlertStyleWarning];
// Display it, then release
[window runModal];
@@ -1892,10 +1892,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
uint8_t *pixels = [imgrep bitmapData];
int len = int(texture_size.width * texture_size.height);
- PoolVector<uint8_t> data = image->get_data();
- PoolVector<uint8_t>::Read r = data.read();
-
- image->lock();
for (int i = 0; i < len; i++) {
int row_index = floor(i / texture_size.width) + atlas_rect.position.y;
@@ -1915,8 +1911,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
pixels[i * 4 + 3] = alpha;
}
- image->unlock();
-
NSImage *nsimage = [[NSImage alloc] initWithSize:NSMakeSize(texture_size.width, texture_size.height)];
[nsimage addRepresentation:imgrep];
@@ -2051,8 +2045,7 @@ void OS_OSX::set_icon(const Ref<Image> &p_icon) {
uint8_t *pixels = [imgrep bitmapData];
int len = img->get_width() * img->get_height();
- PoolVector<uint8_t> data = img->get_data();
- PoolVector<uint8_t>::Read r = data.read();
+ const uint8_t *r = img->get_data().ptr();
/* Premultiply the alpha channel */
for (int i = 0; i < len; i++) {
diff --git a/platform/server/detect.py b/platform/server/detect.py
index d82df77957..ef94dc436c 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -32,6 +32,7 @@ def get_opts():
return [
BoolVariable('use_llvm', 'Use the LLVM compiler', False),
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
+ BoolVariable('use_coverage', 'Test Godot coverage', False),
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
@@ -99,6 +100,9 @@ def configure(env):
env.Append(CPPDEFINES=['TYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix
+ if env['use_coverage']:
+ env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+ env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
env.extra_suffix += "s"
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index c0a4813596..8a66332ff1 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -31,7 +31,6 @@
#include "os_server.h"
#include "core/print_string.h"
-#include "drivers/dummy/audio_driver_dummy.h"
#include "drivers/dummy/rasterizer_dummy.h"
#include "drivers/dummy/texture_loader_dummy.h"
#include "servers/visual/visual_server_raster.h"
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 31501c2cd3..78a3fc8f79 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -85,7 +85,7 @@ void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_optio
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/timestamp_server_url"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/digest_algorithm", PROPERTY_HINT_ENUM, "SHA1,SHA256"), 1));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/description"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "codesign/custom_options"), PoolStringArray()));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray()));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.ico"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/file_version", PROPERTY_HINT_PLACEHOLDER_TEXT, "1.0.0"), ""));
@@ -297,7 +297,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
}
//user options
- PoolStringArray user_args = p_preset->get("codesign/custom_options");
+ PackedStringArray user_args = p_preset->get("codesign/custom_options");
for (int i = 0; i < user_args.size(); i++) {
String user_arg = user_args[i].strip_edges();
if (!user_arg.empty()) {
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index cdcdf65e21..716a637993 100755..100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -34,6 +34,7 @@
#include "os_windows.h"
#include "core/io/marshalls.h"
+#include "core/script_language.h"
#include "core/version_generated.gen.h"
#if defined(OPENGL_ENABLED)
@@ -708,7 +709,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
}
}
- FALLTHROUGH;
+ [[fallthrough]];
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
@@ -983,7 +984,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (wParam==VK_WIN) TODO wtf is this?
meta_mem=uMsg==WM_KEYDOWN;
*/
- FALLTHROUGH;
+ [[fallthrough]];
}
case WM_CHAR: {
@@ -2567,7 +2568,6 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
// Create the BITMAP with alpha channel
COLORREF *buffer = (COLORREF *)memalloc(sizeof(COLORREF) * image_size);
- image->lock();
for (UINT index = 0; index < image_size; index++) {
int row_index = floor(index / texture_size.width) + atlas_rect.position.y;
int column_index = (index % int(texture_size.width)) + atlas_rect.position.x;
@@ -2579,7 +2579,6 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
*(buffer + index) = image->get_pixel(column_index, row_index).to_argb32();
}
- image->unlock();
// Using 4 channels, so 4 * 8 bits
HBITMAP bitmap = CreateBitmap(texture_size.width, texture_size.height, 1, 4 * 8, buffer);
@@ -2934,7 +2933,7 @@ void OS_Windows::set_icon(const Ref<Image> &p_icon) {
encode_uint32(0, &icon_bmp[36]);
uint8_t *wr = &icon_bmp[40];
- PoolVector<uint8_t>::Read r = icon->get_data().read();
+ const uint8_t *r = icon->get_data().ptr();
for (int i = 0; i < h; i++) {
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 9d5affcb3c..cd22ee9ff6 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -61,6 +61,7 @@ def get_opts():
BoolVariable('use_lld', 'Use the LLD linker', False),
BoolVariable('use_thinlto', 'Use ThinLTO', False),
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
+ BoolVariable('use_coverage', 'Test Godot coverage', False),
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
@@ -141,6 +142,10 @@ def configure(env):
print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.")
sys.exit(255)
+ if env['use_coverage']:
+ env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+ env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+
if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
env.extra_suffix += "s"
@@ -179,18 +184,10 @@ def configure(env):
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
- # Check for gcc version >= 6 before adding -no-pie
- if using_gcc(env):
- version = get_compiler_version(env)
- if version != None and version[0] >= '6':
- env.Append(CCFLAGS=['-fpie'])
- env.Append(LINKFLAGS=['-no-pie'])
- # Do the same for clang should be fine with Clang 4 and higher
- if using_clang(env):
- version = get_compiler_version(env)
- if version != None and version[0] >= '4':
- env.Append(CCFLAGS=['-fpie'])
- env.Append(LINKFLAGS=['-no-pie'])
+ # -fpie and -no-pie is supported on GCC 6+ and Clang 4+, both below our
+ # minimal requirements.
+ env.Append(CCFLAGS=['-fpie'])
+ env.Append(LINKFLAGS=['-no-pie'])
## Dependencies
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 26170a8335..36e9681f5f 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -3076,8 +3076,6 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
// allocate memory to contain the whole file
cursor_image->pixels = (XcursorPixel *)memalloc(size);
- image->lock();
-
for (XcursorPixel index = 0; index < image_size; index++) {
int row_index = floor(index / texture_size.width) + atlas_rect.position.y;
int column_index = (index % int(texture_size.width)) + atlas_rect.position.x;
@@ -3090,8 +3088,6 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
*(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32();
}
- image->unlock();
-
ERR_FAIL_COND(cursor_image->pixels == NULL);
// Save it for a further usage
@@ -3269,10 +3265,10 @@ void OS_X11::set_icon(const Ref<Image> &p_icon) {
pd.write[0] = w;
pd.write[1] = h;
- PoolVector<uint8_t>::Read r = img->get_data().read();
+ const uint8_t *r = img->get_data().ptr();
long *wr = &pd.write[2];
- uint8_t const *pr = r.ptr();
+ uint8_t const *pr = r;
for (int i = 0; i < w * h; i++) {
long v = 0;