diff options
-rw-r--r-- | SConstruct | 2 | ||||
-rw-r--r-- | core/math/rect2.h | 42 | ||||
-rw-r--r-- | core/variant_call.cpp | 4 | ||||
-rw-r--r-- | doc/classes/Rect2.xml | 5 | ||||
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 46 | ||||
-rw-r--r-- | editor/plugins/gi_probe_editor_plugin.cpp | 23 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 5 | ||||
-rw-r--r-- | methods.py | 7 | ||||
-rw-r--r-- | platform/x11/detect.py | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_canvas.cpp | 2 |
10 files changed, 76 insertions, 62 deletions
diff --git a/SConstruct b/SConstruct index f2c20ea91e..436dd48800 100644 --- a/SConstruct +++ b/SConstruct @@ -330,7 +330,7 @@ if selected_platform in platform_list: else: # MSVC doesn't have clear C standard support, /std only covers C++. # We apply it to CCFLAGS (both C and C++ code) in case it impacts C features. - env.Prepend(CCFLAGS=['/std:c++17', '/permissive-']) + env.Prepend(CCFLAGS=['/std:c++17']) # Enforce our minimal compiler version requirements cc_version = methods.get_compiler_version(env) or [-1, -1] diff --git a/core/math/rect2.h b/core/math/rect2.h index e4ea615c22..3b9660e2f0 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -47,28 +47,26 @@ struct Rect2 { real_t get_area() const { return size.width * size.height; } - inline bool intersects(const Rect2 &p_rect) const { - if (position.x >= (p_rect.position.x + p_rect.size.width)) - return false; - if ((position.x + size.width) <= p_rect.position.x) - return false; - if (position.y >= (p_rect.position.y + p_rect.size.height)) - return false; - if ((position.y + size.height) <= p_rect.position.y) - return false; - - return true; - } - - inline bool intersects_touch(const Rect2 &p_rect) const { - if (position.x > (p_rect.position.x + p_rect.size.width)) - return false; - if ((position.x + size.width) < p_rect.position.x) - return false; - if (position.y > (p_rect.position.y + p_rect.size.height)) - return false; - if ((position.y + size.height) < p_rect.position.y) - return false; + inline bool intersects(const Rect2 &p_rect, const bool p_include_borders = false) const { + if (p_include_borders) { + if (position.x > (p_rect.position.x + p_rect.size.width)) + return false; + if ((position.x + size.width) < p_rect.position.x) + return false; + if (position.y > (p_rect.position.y + p_rect.size.height)) + return false; + if ((position.y + size.height) < p_rect.position.y) + return false; + } else { + if (position.x >= (p_rect.position.x + p_rect.size.width)) + return false; + if ((position.x + size.width) <= p_rect.position.x) + return false; + if (position.y >= (p_rect.position.y + p_rect.size.height)) + return false; + if ((position.y + size.height) <= p_rect.position.y) + return false; + } return true; } diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 9cc08b54e6..99cfc7ed3c 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -391,7 +391,7 @@ struct _VariantCall { VCALL_LOCALMEM0R(Rect2, has_no_area); VCALL_LOCALMEM1R(Rect2, has_point); VCALL_LOCALMEM1R(Rect2, is_equal_approx); - VCALL_LOCALMEM1R(Rect2, intersects); + VCALL_LOCALMEM2R(Rect2, intersects); VCALL_LOCALMEM1R(Rect2, encloses); VCALL_LOCALMEM1R(Rect2, clip); VCALL_LOCALMEM1R(Rect2, merge); @@ -1834,7 +1834,7 @@ void register_variant_methods() { ADDFUNC0R(RECT2, BOOL, Rect2, has_no_area, varray()); ADDFUNC1R(RECT2, BOOL, Rect2, has_point, VECTOR2, "point", varray()); ADDFUNC1R(RECT2, BOOL, Rect2, is_equal_approx, RECT2, "rect", varray()); - ADDFUNC1R(RECT2, BOOL, Rect2, intersects, RECT2, "b", varray()); + ADDFUNC2R(RECT2, BOOL, Rect2, intersects, RECT2, "b", BOOL, "include_borders", varray(false)); ADDFUNC1R(RECT2, BOOL, Rect2, encloses, RECT2, "b", varray()); ADDFUNC1R(RECT2, RECT2, Rect2, clip, RECT2, "b", varray()); ADDFUNC1R(RECT2, RECT2, Rect2, merge, RECT2, "b", varray()); diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index 26abfb538b..dbf461cdf1 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -143,8 +143,11 @@ </return> <argument index="0" name="b" type="Rect2"> </argument> + <argument index="1" name="include_borders" type="bool" default="false"> + </argument> <description> - Returns [code]true[/code] if the [Rect2] overlaps with another. + Returns [code]true[/code] if the [Rect2] overlaps with [code]b[/code] (i.e. they have at least one point in common). + If [code]include_borders[/code] is [code]true[/code], they will also be considered overlapping if their borders touch, even without intersection. </description> </method> <method name="is_equal_approx"> 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/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index ddcbb11f7c..c077c23e8a 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -70,22 +70,33 @@ void GIProbeEditorPlugin::_notification(int p_what) { return; } - String text; - - Vector3i size = gi_probe->get_estimated_cell_size(); - text = itos(size.x) + ", " + itos(size.y) + ", " + itos(size.z); + const Vector3i size = gi_probe->get_estimated_cell_size(); + String text = vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z); int data_size = 4; if (GLOBAL_GET("rendering/quality/gi_probes/anisotropic")) { data_size += 4; } - text += " - VRAM Size: " + String::num(size.x * size.y * size.z * data_size / (1024.0 * 1024.0), 2) + " Mb."; + const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0); + text += " - " + vformat(TTR("VRAM Size: %s MB"), String::num(size_mb, 2)); if (bake_info->get_text() == text) { return; } - bake_info->add_color_override("font_color", bake_info->get_color("success_color", "Editor")); + // Color the label depending on the estimated performance level. + Color color; + if (size_mb <= 16.0 + CMP_EPSILON) { + // Fast. + color = bake_info->get_color("success_color", "Editor"); + } else if (size_mb <= 64.0 + CMP_EPSILON) { + // Medium. + color = bake_info->get_color("warning_color", "Editor"); + } else { + // Slow. + color = bake_info->get_color("error_color", "Editor"); + } + bake_info->add_color_override("font_color", color); bake_info->set_text(text); } } diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index c155430eae..d6e443ec14 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -2724,10 +2724,11 @@ GIProbeGizmoPlugin::GIProbeGizmoPlugin() { create_material("gi_probe_material", gizmo_color); - gizmo_color.a = 0.5; + // This gizmo draws a lot of lines. Use a low opacity to make it not too intrusive. + gizmo_color.a = 0.1; create_material("gi_probe_internal_material", gizmo_color); - gizmo_color.a = 0.1; + gizmo_color.a = 0.05; create_material("gi_probe_solid_material", gizmo_color); create_icon_material("gi_probe_icon", SpatialEditor::get_singleton()->get_icon("GizmoGIProbe", "EditorIcons")); 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/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/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index c1833fea44..c192b77988 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -183,7 +183,7 @@ void VisualServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2 VisualServerRaster::redraw_request(); } - if ((ci->commands != NULL && p_clip_rect.intersects_touch(global_rect)) || ci->vp_render || ci->copy_back_buffer) { + if ((ci->commands != NULL && p_clip_rect.intersects(global_rect, true)) || ci->vp_render || ci->copy_back_buffer) { //something to draw? ci->final_transform = xform; ci->final_modulate = Color(modulate.r * ci->self_modulate.r, modulate.g * ci->self_modulate.g, modulate.b * ci->self_modulate.b, modulate.a * ci->self_modulate.a); |