diff options
-rw-r--r-- | core/io/resource_format_binary.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 1 | ||||
-rw-r--r-- | core/io/resource_loader.h | 2 | ||||
-rw-r--r-- | core/message_queue.cpp | 5 | ||||
-rw-r--r-- | core/rid_owner.h | 4 | ||||
-rw-r--r-- | core/variant_parser.h | 2 | ||||
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.cpp | 5 | ||||
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 46 | ||||
-rw-r--r-- | methods.py | 7 | ||||
-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 | ||||
-rw-r--r-- | platform/x11/detect.py | 2 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 12 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 1 | ||||
-rw-r--r-- | servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp | 2 | ||||
-rw-r--r-- | servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp | 6 |
18 files changed, 92 insertions, 72 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 54b75cc29d..efd452191a 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1008,7 +1008,9 @@ String ResourceLoaderBinary::recognize(FileAccess *p_f) { ResourceLoaderBinary::ResourceLoaderBinary() : translation_remapped(false), + ver_format(0), f(NULL), + importmd_ofs(0), error(OK) { progress = nullptr; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 504dbe2d63..5dca8b3b89 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -538,6 +538,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p if (r_error) { *r_error = err; } + thread_load_mutex->unlock(); return RES(); } thread_load_mutex->unlock(); diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index 3b7a27f551..ea89917a5f 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -116,7 +116,7 @@ private: String type_hint; float progress = 0.0; ThreadLoadStatus status = THREAD_LOAD_IN_PROGRESS; - Error error; + Error error = OK; RES resource; bool xl_remapped = false; bool use_sub_threads = false; diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 235003627e..37207483fe 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -268,7 +268,10 @@ void MessageQueue::flush() { //using reverse locking strategy _THREAD_SAFE_LOCK_ - ERR_FAIL_COND(flushing); //already flushing, you did something odd + if (flushing) { + _THREAD_SAFE_UNLOCK_ + ERR_FAIL_COND(flushing); //already flushing, you did something odd + } flushing = true; while (read_pos < buffer_end) { 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/core/variant_parser.h b/core/variant_parser.h index ad0a4d6682..d50842145c 100644 --- a/core/variant_parser.h +++ b/core/variant_parser.h @@ -77,7 +77,7 @@ public: struct ResourceParser { - void *userdata; + void *userdata = nullptr; ParseResourceFunc func; ParseResourceFunc ext_func; ParseResourceFunc sub_func; diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 8cea8ebb86..3b0d1f6ac3 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -4182,7 +4182,10 @@ RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_a descriptor_pool_create_info.poolSizeCount = sizes.size(); descriptor_pool_create_info.pPoolSizes = sizes.ptr(); VkResult res = vkCreateDescriptorPool(device, &descriptor_pool_create_info, NULL, &pool->pool); - ERR_FAIL_COND_V(res, NULL); + if (res) { + memdelete(pool); + ERR_FAIL_COND_V(res, NULL); + } descriptor_pools[p_key].insert(pool); } diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 90d32c9703..038cae7f96 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -44,7 +44,8 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #define APP_SHORT_NAME "GodotEngine" -VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, +VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback( + VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *pUserData) { @@ -67,24 +68,6 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(VkDebugU return VK_FALSE; } - String severity_string; - switch (messageSeverity) { - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: - severity_string = "VERBOSE : "; - break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: - severity_string = "INFO : "; - break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: - severity_string = "WARNING : "; - break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: - severity_string = "ERROR : "; - break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT: - break; - } - String type_string; switch (messageType) { case (VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT): @@ -133,16 +116,31 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(VkDebugU } } - String error_message(severity_string + type_string + + String error_message(type_string + " - Message Id Number: " + String::num_int64(pCallbackData->messageIdNumber) + " | Message Id Name: " + pCallbackData->pMessageIdName + "\n\t" + pCallbackData->pMessage + objects_string + labels_string); - ERR_PRINT(error_message); - - CRASH_COND_MSG(Engine::get_singleton()->is_abort_on_gpu_errors_enabled(), - "Crashing, because abort on GPU errors is enabled."); + // Convert VK severity to our own log macros. + switch (messageSeverity) { + case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: + print_verbose(error_message); + break; + case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: + print_line(error_message); + break; + case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: + WARN_PRINT(error_message); + break; + case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: + ERR_PRINT(error_message); + CRASH_COND_MSG(Engine::get_singleton()->is_abort_on_gpu_errors_enabled(), + "Crashing, because abort on GPU errors is enabled."); + break; + case VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT: + break; // Shouldn't happen, only handling to make compilers happy. + } return VK_FALSE; } diff --git a/methods.py b/methods.py index 3f03e6bbd2..28c6d0c097 100644 --- a/methods.py +++ b/methods.py @@ -1,5 +1,4 @@ import os -import os.path import re import glob import subprocess @@ -564,7 +563,11 @@ def get_compiler_version(env): if not env.msvc: # Not using -dumpversion as some GCC distros only return major, and # Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803 - version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip()) + try: + version = decode_utf8(subprocess.check_output([env.subst(env['CXX']), '--version']).strip()) + except (subprocess.CalledProcessError, OSError): + print("Couldn't parse CXX environment variable to infer compiler version.") + return None else: # TODO: Implement for MSVC return None match = re.search('[0-9]+\.[0-9.]+', version) 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 022d9700d5..9768ee9ebe 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; @@ -1355,7 +1351,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); @@ -1387,7 +1383,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; diff --git a/platform/x11/detect.py b/platform/x11/detect.py index cd22ee9ff6..8952aa5e82 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -1,7 +1,7 @@ import os import platform import sys -from methods import get_compiler_version, using_gcc, using_clang +from methods import using_gcc, using_clang def is_active(): diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 97bd12c119..238bdf05ef 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -403,8 +403,6 @@ Ref<PackedScene> ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars return Ref<PackedScene>(); } } - - return packed_scene; } Error ResourceLoaderText::load() { @@ -671,10 +669,6 @@ Error ResourceLoaderText::load() { return error; } } - - if (progress) { - *progress = resource_current / float(resources_total); - } } //for scene files @@ -731,9 +725,15 @@ void ResourceLoaderText::set_translation_remapped(bool p_remapped) { } ResourceLoaderText::ResourceLoaderText() { + resources_total = 0; + resource_current = 0; + use_sub_threads = false; + progress = nullptr; + lines = false; translation_remapped = false; use_sub_threads = false; + error = OK; } ResourceLoaderText::~ResourceLoaderText() { diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 3a219ec7e3..0a55c78133 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -1171,6 +1171,7 @@ public: Command *n = c->next; if (c == commands) { memdelete(commands); + commands = NULL; } else { c->~Command(); } diff --git a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp index 85750df9d1..6b6c750fd3 100644 --- a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp @@ -1081,7 +1081,7 @@ RasterizerEffectsRD::~RasterizerEffectsRD() { RD::get_singleton()->free(filter.image_uniform_set); } - if (RD::get_singleton()->uniform_set_is_valid(filter.image_uniform_set)) { + if (RD::get_singleton()->uniform_set_is_valid(filter.uniform_set)) { RD::get_singleton()->free(filter.uniform_set); } diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp index 15cbc61b76..52cefa7511 100644 --- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp @@ -1906,8 +1906,10 @@ void RasterizerStorageRD::mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_ for (int i = 0; i < p_surface.blend_shapes.size(); i++) { - ERR_FAIL_COND(p_surface.blend_shapes[i].size() != p_surface.vertex_data.size()); - + if (p_surface.blend_shapes[i].size() != p_surface.vertex_data.size()) { + memdelete(s); + ERR_FAIL_COND(p_surface.blend_shapes[i].size() != p_surface.vertex_data.size()); + } RID vertex_buffer = RD::get_singleton()->vertex_buffer_create(p_surface.blend_shapes[i].size(), p_surface.blend_shapes[i]); s->blend_shapes.push_back(vertex_buffer); } |