Skip to content

Commit

Permalink
Merge pull request #69957 from akien-mga/3.x-cherrypicks
Browse files Browse the repository at this point in the history
Cherry-picks for the 3.x branch (future 3.6) - 10th batch
  • Loading branch information
akien-mga authored Dec 12, 2022
2 parents 0e594bb + f694ab1 commit 3a2f2d9
Show file tree
Hide file tree
Showing 181 changed files with 11,944 additions and 7,369 deletions.
4 changes: 2 additions & 2 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ Copyright: lieff
License: CC0-1.0

Files: ./thirdparty/miniupnpc/
Comment: MiniUPnPc
Copyright: 2005-2021, Thomas Bernard
Comment: MiniUPnP Project
Copyright: 2005-2022, Thomas Bernard
License: BSD-3-clause

Files: ./thirdparty/minizip/
Expand Down
5 changes: 4 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ env_base.__class__.add_library = methods.add_library
env_base.__class__.add_program = methods.add_program
env_base.__class__.CommandNoCache = methods.CommandNoCache
env_base.__class__.disable_warnings = methods.disable_warnings
env_base.__class__.force_optimization_on_debug = methods.force_optimization_on_debug

env_base["x86_libtheora_opt_gcc"] = False
env_base["x86_libtheora_opt_vc"] = False
Expand Down Expand Up @@ -330,6 +331,9 @@ if env_base["target"] == "debug":
# DEV_ENABLED enables *engine developer* code which should only be compiled for those
# working on the engine itself.
env_base.Append(CPPDEFINES=["DEV_ENABLED"])
else:
# Disable assert() for production targets (only used in thirdparty code).
env_base.Append(CPPDEFINES=["NDEBUG"])

# SCons speed optimization controlled by the `fast_unsafe` option, which provide
# more than 10 s speed up for incremental rebuilds.
Expand Down Expand Up @@ -542,7 +546,6 @@ if selected_platform in platform_list:
print(" Use `tools=no target=release` to build a release export template.")
Exit(255)
suffix += ".opt"
env.Append(CPPDEFINES=["NDEBUG"])
elif env["target"] == "release_debug":
if env["tools"]:
suffix += ".opt.tools"
Expand Down
4 changes: 0 additions & 4 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ uint64_t OS::get_system_time_msecs() const {
double OS::get_subsecond_unix_time() const {
return 0.0;
}
void OS::debug_break(){

// something
};

void OS::_set_logger(CompositeLogger *p_logger) {
if (_logger) {
Expand Down
2 changes: 0 additions & 2 deletions core/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,6 @@ class OS {
virtual void enable_for_stealing_focus(ProcessID pid) {}
virtual void move_window_to_foreground() {}

virtual void debug_break();

virtual void release_rendering_thread();
virtual void make_rendering_thread();
virtual void swap_buffers();
Expand Down
8 changes: 0 additions & 8 deletions core/pool_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#include "core/os/os.h"
#include "core/print_string.h"

#include <assert.h>

#define COMPACT_CHUNK(m_entry, m_to_pos) \
do { \
void *_dst = &((unsigned char *)pool)[m_to_pos]; \
Expand Down Expand Up @@ -169,11 +167,6 @@ bool PoolAllocator::find_entry_index(EntryIndicesPos *p_map_pos, Entry *p_entry)

PoolAllocator::ID PoolAllocator::alloc(int p_size) {
ERR_FAIL_COND_V(p_size < 1, POOL_ALLOCATOR_INVALID_ID);
#ifdef DEBUG_ENABLED
if (p_size > free_mem) {
OS::get_singleton()->debug_break();
}
#endif
ERR_FAIL_COND_V(p_size > free_mem, POOL_ALLOCATOR_INVALID_ID);

mt_lock();
Expand Down Expand Up @@ -482,7 +475,6 @@ void *PoolAllocator::get(ID p_mem) {
ERR_FAIL_COND_V(!e, nullptr);
}
if (e->lock == 0) {
//assert(0);
mt_unlock();
ERR_PRINT("e->lock == 0");
return nullptr;
Expand Down
5 changes: 0 additions & 5 deletions drivers/unix/os_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <sys/sysctl.h>
#endif

#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
#include <poll.h>
Expand Down Expand Up @@ -87,10 +86,6 @@ static void _setup_clock() {
}
#endif

void OS_Unix::debug_break() {
assert(false);
};

static void handle_interrupt(int sig) {
if (ScriptDebugger::get_singleton() == nullptr) {
return;
Expand Down
1 change: 0 additions & 1 deletion drivers/unix/os_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class OS_Unix : public OS {
virtual bool set_environment(const String &p_var, const String &p_value) const;
virtual String get_locale() const;

virtual void debug_break();
virtual void initialize_debugging();

virtual String get_executable_path() const;
Expand Down
2 changes: 2 additions & 0 deletions editor/editor_properties_array_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,8 @@ void EditorPropertyArray::_reorder_button_up() {
reorder_mouse_y_delta = 0.0f;

Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);

ERR_FAIL_NULL(reorder_selected_button);
reorder_selected_button->warp_mouse(reorder_selected_button->get_size() / 2.0f);

reorder_selected_element_hbox = nullptr;
Expand Down
120 changes: 88 additions & 32 deletions main/gamecontrollerdb.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions main/godotcontrollerdb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Linux046dc216,046d-c216-Logitech Logitech Dual Action,a:b1,b:b2,y:b3,x:b0,start:
Linux20d6a713,Bensussen Deutsch & Associates Inc.(BDA) NSW Wired controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Javascript
Linux054c05c4,Sony Computer Entertainment Wireless Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript
Linux18d19400,18d1-9400-Google LLC Stadia Controller rev. A,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Javascript
Linux054c0268,054c-0268-Sony PLAYSTATION(R)3 Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web

# UWP
__UWP_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:UWP,
31 changes: 21 additions & 10 deletions methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,28 @@ def disable_warnings(self):
if self.msvc:
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"]
self.Append(CCFLAGS=["/w"])
self.Append(CFLAGS=["/w"])
self.Append(CXXFLAGS=["/w"])
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x in warn_flags]
self["CFLAGS"] = [x for x in self["CFLAGS"] if not x in warn_flags]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x in warn_flags]
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
self["CFLAGS"] = [x for x in self["CFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
self.AppendUnique(CCFLAGS=["/w"])
else:
self.Append(CCFLAGS=["-w"])
self.Append(CFLAGS=["-w"])
self.Append(CXXFLAGS=["-w"])
self.AppendUnique(CCFLAGS=["-w"])


def force_optimization_on_debug(self):
# 'self' is the environment
if self["target"] != "debug":
return

if self.msvc:
# We have to remove existing optimization level defines before appending /O2,
# otherwise we get: "warning D9025 : overriding '/0d' with '/02'"
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x.startswith("/O")]
self["CFLAGS"] = [x for x in self["CFLAGS"] if not x.startswith("/O")]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x.startswith("/O")]
self.AppendUnique(CCFLAGS=["/O2"])
else:
self.AppendUnique(CCFLAGS=["-O3"])


def add_module_version_string(self, s):
Expand Down
1 change: 0 additions & 1 deletion misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
Expand Down
2 changes: 1 addition & 1 deletion modules/denoise/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ env_oidn.Append(
"__STDC_LIMIT_MACROS",
"DISABLE_VERBOSE",
"MKLDNN_ENABLE_CONCURRENT_EXEC",
"NDEBUG",
]
)
env_oidn.AppendUnique(CPPDEFINES=["NDEBUG"]) # No assert() even in debug builds.

env_thirdparty = env_oidn.Clone()
env_thirdparty.disable_warnings()
Expand Down
7 changes: 6 additions & 1 deletion modules/raycast/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ if env["builtin_embree"]:
"kernels/bvh/bvh_builder_sah_mb.cpp",
"kernels/bvh/bvh_builder_twolevel.cpp",
"kernels/bvh/bvh_intersector1_bvh4.cpp",
"kernels/bvh/bvh_intersector_hybrid4_bvh4.cpp",
"kernels/bvh/bvh_intersector_stream_bvh4.cpp",
"kernels/bvh/bvh_intersector_stream_filters.cpp",
]

thirdparty_sources = [thirdparty_dir + file for file in embree_src]

env_raycast.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "include"])
env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2", "EMBREE_LOWEST_ISA", "TASKING_INTERNAL", "NDEBUG"])
env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2", "EMBREE_LOWEST_ISA", "TASKING_INTERNAL"])
env_raycast.AppendUnique(CPPDEFINES=["NDEBUG"]) # No assert() even in debug builds.

if not env.msvc:
if env["arch"] in ["x86", "x86_64"]:
Expand All @@ -76,6 +80,7 @@ if env["builtin_embree"]:
env.Append(LIBS=["psapi"])

env_thirdparty = env_raycast.Clone()
env_thirdparty.force_optimization_on_debug()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)

Expand Down
36 changes: 25 additions & 11 deletions modules/raycast/godot_update_embree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import glob, os, shutil, subprocess, re

git_tag = "v3.13.5"

include_dirs = [
"common/tasking",
"kernels/bvh",
Expand All @@ -12,6 +14,7 @@
"common/lexers",
"common/simd",
"common/simd/arm",
"common/simd/wasm",
"include/embree3",
"kernels/subdiv",
"kernels/geometry",
Expand Down Expand Up @@ -61,6 +64,11 @@
"kernels/bvh/bvh_builder_twolevel.cpp",
"kernels/bvh/bvh_intersector1.cpp",
"kernels/bvh/bvh_intersector1_bvh4.cpp",
"kernels/bvh/bvh_intersector_hybrid4_bvh4.cpp",
"kernels/bvh/bvh_intersector_stream_bvh4.cpp",
"kernels/bvh/bvh_intersector_stream_filters.cpp",
"kernels/bvh/bvh_intersector_hybrid.cpp",
"kernels/bvh/bvh_intersector_stream.cpp",
]

os.chdir("../../thirdparty")
Expand All @@ -71,6 +79,7 @@

subprocess.run(["git", "clone", "https://github.com/embree/embree.git", "embree-tmp"])
os.chdir("embree-tmp")
subprocess.run(["git", "checkout", git_tag])

commit_hash = str(subprocess.check_output(["git", "rev-parse", "HEAD"], universal_newlines=True)).strip()

Expand All @@ -89,8 +98,7 @@

with open(os.path.join(dest_dir, "kernels/hash.h"), "w") as hash_file:
hash_file.write(
f"""
// Copyright 2009-2020 Intel Corporation
f"""// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#define RTC_HASH "{commit_hash}"
Expand All @@ -99,8 +107,7 @@

with open(os.path.join(dest_dir, "kernels/config.h"), "w") as config_file:
config_file.write(
"""
// Copyright 2009-2020 Intel Corporation
"""// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
/* #undef EMBREE_RAY_MASK */
Expand All @@ -117,10 +124,11 @@
/* #undef EMBREE_GEOMETRY_INSTANCE */
/* #undef EMBREE_GEOMETRY_GRID */
/* #undef EMBREE_GEOMETRY_POINT */
/* #undef EMBREE_RAY_PACKETS */
#define EMBREE_RAY_PACKETS
/* #undef EMBREE_COMPACT_POLYS */
#define EMBREE_CURVE_SELF_INTERSECTION_AVOIDANCE_FACTOR 2.0
#define EMBREE_DISC_POINT_SELF_INTERSECTION_AVOIDANCE
#if defined(EMBREE_GEOMETRY_TRIANGLE)
#define IF_ENABLED_TRIS(x) x
Expand Down Expand Up @@ -187,8 +195,7 @@

with open(os.path.join(dest_dir, "include/embree3/rtcore_config.h"), "w") as config_file:
config_file.write(
f"""
// Copyright 2009-2021 Intel Corporation
f"""// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
Expand All @@ -204,14 +211,16 @@
#define EMBREE_MIN_WIDTH 0
#define RTC_MIN_WIDTH EMBREE_MIN_WIDTH
#define EMBREE_STATIC_LIB
/* #undef EMBREE_API_NAMESPACE */
#if !defined(EMBREE_STATIC_LIB)
# define EMBREE_STATIC_LIB
#endif
/* #undef EMBREE_API_NAMESPACE*/
#if defined(EMBREE_API_NAMESPACE)
# define RTC_NAMESPACE
# define RTC_NAMESPACE_BEGIN namespace {{
# define RTC_NAMESPACE_BEGIN namespace {{
# define RTC_NAMESPACE_END }}
# define RTC_NAMESPACE_USE using namespace ;
# define RTC_NAMESPACE_USE using namespace;
# define RTC_API_EXTERN_C
# undef EMBREE_API_NAMESPACE
#else
Expand Down Expand Up @@ -249,3 +258,8 @@

os.chdir("..")
shutil.rmtree("embree-tmp")

subprocess.run(["git", "restore", "embree/patches"])

for patch in os.listdir("embree/patches"):
subprocess.run(["git", "apply", "embree/patches/" + patch])
4 changes: 2 additions & 2 deletions modules/upnp/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ if env["builtin_miniupnpc"]:
"receivedata.c",
"addr_is_reserved.c",
]
thirdparty_sources = [thirdparty_dir + "miniupnpc/" + file for file in thirdparty_sources]
thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]

env_upnp.Prepend(CPPPATH=[thirdparty_dir])
env_upnp.Prepend(CPPPATH=[thirdparty_dir + "include"])
env_upnp.Append(CPPDEFINES=["MINIUPNP_STATICLIB"])
env_upnp.Append(CPPDEFINES=["MINIUPNPC_SET_SOCKET_TIMEOUT"])

Expand Down
4 changes: 2 additions & 2 deletions modules/upnp/upnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include "upnp.h"

#include <miniupnpc/miniwget.h>
#include <miniupnpc/upnpcommands.h>
#include <miniwget.h>
#include <upnpcommands.h>

#include <stdlib.h>

Expand Down
2 changes: 1 addition & 1 deletion modules/upnp/upnp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include "upnp_device.h"

#include <miniupnpc/miniupnpc.h>
#include <miniupnpc.h>

class UPNP : public Reference {
GDCLASS(UPNP, Reference);
Expand Down
2 changes: 1 addition & 1 deletion modules/upnp/upnp_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "upnp.h"

#include <miniupnpc/upnpcommands.h>
#include <upnpcommands.h>

String UPNPDevice::query_external_address() const {
ERR_FAIL_COND_V(!is_valid_gateway(), "");
Expand Down
5 changes: 1 addition & 4 deletions platform/android/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,9 @@ def configure(env):
env.Append(CCFLAGS=[opt])
elif env["optimize"] == "size": # optimize for size
env.Append(CCFLAGS=["-Oz"])
env.Append(CPPDEFINES=["NDEBUG"])
elif env["target"] == "debug":
env.Append(LINKFLAGS=["-O0"])
env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
env.Append(CPPDEFINES=["_DEBUG"])
env.Append(CPPFLAGS=["-UNDEBUG"])
env.Append(CCFLAGS=["-O0", "-g"])

# LTO

Expand Down
8 changes: 4 additions & 4 deletions platform/android/java/app/config.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ext.versions = [
androidGradlePlugin: '7.0.3',
androidGradlePlugin: '7.2.1',
compileSdk : 32,
minSdk : 19, // Also update 'platform/android/java/lib/AndroidManifest.xml#minSdkVersion' & 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
targetSdk : 32, // Also update 'platform/android/java/lib/AndroidManifest.xml#targetSdkVersion' & 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION'
minSdk : 19, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
targetSdk : 32, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION'
buildTools : '32.0.0',
kotlinVersion : '1.6.21',
kotlinVersion : '1.7.0',
fragmentVersion : '1.3.6',
nexusPublishVersion: '1.1.0',
javaVersion : 11,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3a2f2d9

Please sign in to comment.