加载论坛时出错,请强制刷新页面重试。

loongarch 原生 godot

Qinka

尝试编译 godot 当前的 master分支 ,基本能过,添加一下 loongarch的目标,同时 pcre2 的 jit 根据最新的修改一下,就能编译。

目前遇到的问题

  1. 编译好的 editor 不显示界面(点击会有反馈),用的3a6000 的小主机 只有 7a2000 上的 GPU ,估计还是驱动的问题

  2. 不支持 vulkan 和 Wayland

  3. 执行游戏的时候和打包的时候 遇到了访问空指针的问题

    [1] 3203978 IOT instruction (core dumped) ../../godot/bin/godot.linuxbsd.editor.loongarch64 --headless --export-pack

    [617137.581374] do_page_fault(): sending SIGSEGV to godot.linuxbsd. for invalid read access from 0000000000000000

    [617137.581382] era = 000055555685d900 in godot.linuxbsd.editor.loongarch64[55555627c000+7648000]

    [617137.581391] ra = 000055555685d900 in godot.linuxbsd.editor.loongarch64[55555627c000+7648000]

此外,测试了一下 godot-rust 写的脚本库能够编译过,就是不知道运行上会有啥问题。


TSiNGKONG

新世界集显,不显示界面,可以试一下:
export LIBGL_ALWAYS_SOFTWARE=true
export GALLIUM_DRIVER=softpipe
./your_prog

这种方式的性能很差,界面比较卡顿。


EMCA

TSiNGKONG softpipe太可怕了


吴小白

测试了下 4.2.2-stable 分支

docker run -it ghcr.io/loong64/debian:trixie-slim bash
apt-get update
apt-get install -y build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev libwayland-dev python3-pip 
gettext wget git
pip install scons==4.4.0 --break-system-packages
cd /opt
git clone -b 4.2.2-stable --depth=1 https://github.com/godotengine/godot
# pcre2 10.43 补丁 https://github.com/godotengine/godot/pull/89371
wget https://github.com/godotengine/godot/commit/dab95993c6c8ebd4fb439385a892dabda22698a2.patch
# loong64 架构补丁
cat loong64.patch

diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index 24080c0..2c550b8 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -212,6 +212,9 @@ String Engine::get_architecture_name() const {
 #elif defined(__arm__) || defined(_M_ARM)
 	return "arm32";
 
+#elif defined(__loongarch64) || defined(_LOONGARCH_ARCH_LOONGARCH64)
+	return "loong64";
+
 #elif defined(__riscv)
 #if __riscv_xlen == 8
 	return "rv64";
diff --git a/core/os/os.cpp b/core/os/os.cpp
index f5d55ca..36b45f7 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -465,6 +465,10 @@ bool OS::has_feature(const String &p_feature) {
 	if (p_feature == "arm") {
 		return true;
 	}
+#elif defined(__loongarch64) || defined(_LOONGARCH_ARCH_LOONGARCH64)
+	if (p_feature == "loong64") {
+                return true;
+        }
 #elif defined(__riscv)
 #if __riscv_xlen == 8
 	if (p_feature == "rv64") {
diff --git a/editor/plugins/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h
index c56591c..293bdc9 100644
--- a/editor/plugins/gdextension_export_plugin.h
+++ b/editor/plugins/gdextension_export_plugin.h
@@ -68,6 +68,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
 	all_archs.insert("x86_64");
 	all_archs.insert("arm32");
 	all_archs.insert("arm64");
+	all_archs.insert("loong64");
 	all_archs.insert("rv64");
 	all_archs.insert("ppc32");
 	all_archs.insert("ppc64");
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 59cc6e7..e3fc5d3 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -65,12 +65,13 @@ def get_doc_path():
 def get_flags():
     return [
         ("arch", detect_arch()),
+        ("builtin_pcre2_with_jit", False),
     ]
 
 
 def configure(env: "Environment"):
     # Validate arch.
-    supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
+    supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "loong64", "rv64", "ppc32", "ppc64"]
     if env["arch"] not in supported_arches:
         print(
             'Unsupported CPU architecture "%s" for Linux / *BSD. Supported architectures are: %s.'
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index 9d1e058..83e781a 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -159,7 +159,7 @@ bool EditorExportPlatformLinuxBSD::get_export_option_visibility(const EditorExpo
 void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) const {
 	EditorExportPlatformPC::get_export_options(r_options);
 
-	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,rv64,ppc64,ppc32"), "x86_64"));
+	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,loong64,rv64,ppc64,ppc32"), "x86_64"));
 
 	String run_script = "#!/usr/bin/env bash\n"
 						"export DISPLAY=:0\n"
diff --git a/platform_methods.py b/platform_methods.py
index 8b2c62a..3bae7f9 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -79,7 +79,7 @@ def subprocess_main(namespace):
 
 
 # CPU architecture options.
-architectures = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "wasm32"]
+architectures = ["x86_32", "x86_64", "arm32", "arm64", "loong64", "rv64", "ppc32", "ppc64", "wasm32"]
 architecture_aliases = {
     "x86": "x86_32",
     "x64": "x86_64",
@@ -88,6 +88,7 @@ architecture_aliases = {
     "armv8": "arm64",
     "arm64v8": "arm64",
     "aarch64": "arm64",
+    "loongarch64": "loong64",
     "rv": "rv64",
     "riscv": "rv64",
     "riscv64": "rv64",
diff --git a/thirdparty/openxr/src/common/platform_utils.hpp b/thirdparty/openxr/src/common/platform_utils.hpp
index 0b295f5..01b0c24 100644
--- a/thirdparty/openxr/src/common/platform_utils.hpp
+++ b/thirdparty/openxr/src/common/platform_utils.hpp
@@ -71,6 +71,8 @@
 #define XR_ARCH_ABI "riscv64"
 #elif defined(__sparc__) && defined(__arch64__)
 #define XR_ARCH_ABI "sparc64"
+#elif defined(__loongarch64) || defined(_LOONGARCH_ARCH_LOONGARCH64)
+#define XR_ARCH_ABI "loongarch64"
 #else
 #error "No architecture string known!"
 #endif
cd /opt/godot
# 应用补丁
git apply ../*.patch
scons platform=linuxbsd production=yes
scons platform=linuxbsd target=template_release production=yes
scons platform=linuxbsd target=template_debug production=yes

生成的文件在 bin 目录下,简单测试了下项目编译导出没问题。没太深入使用


吴小白

master 分支补丁

scons==4.8.0
cat loong64.patch

diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index 9cdc21f..93b2e68 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -224,6 +224,9 @@ String Engine::get_architecture_name() const {
 #elif defined(__arm__) || defined(_M_ARM)
 	return "arm32";
 
+#elif defined(__loongarch_lp64)
+	return "loong64";
+
 #elif defined(__riscv)
 #if __riscv_xlen == 8
 	return "rv64";
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 642de11..cdc514b 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -473,6 +473,10 @@ bool OS::has_feature(const String &p_feature) {
 	if (p_feature == "arm") {
 		return true;
 	}
+#elif defined(__loongarch_lp64)
+	if (p_feature == "loong64") {
+		return true;
+	}
 #elif defined(__riscv)
 #if __riscv_xlen == 8
 	if (p_feature == "rv64") {
diff --git a/editor/plugins/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h
index 0de6b7b..148c9b4 100644
--- a/editor/plugins/gdextension_export_plugin.h
+++ b/editor/plugins/gdextension_export_plugin.h
@@ -69,6 +69,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
 	all_archs.insert("x86_64");
 	all_archs.insert("arm32");
 	all_archs.insert("arm64");
+	all_archs.insert("loong64");
 	all_archs.insert("rv64");
 	all_archs.insert("ppc32");
 	all_archs.insert("ppc64");
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index d1de760..cfee8e6 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -68,12 +68,13 @@ def get_flags():
     return {
         "arch": detect_arch(),
         "supported": ["mono"],
+        "builtin_pcre2_with_jit": False,
     }
 
 
 def configure(env: "SConsEnvironment"):
     # Validate arch.
-    supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
+    supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "loong64", "rv64", "ppc32", "ppc64"]
     if env["arch"] not in supported_arches:
         print_error(
             'Unsupported CPU architecture "%s" for Linux / *BSD. Supported architectures are: %s.'
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index 69ba742..4be91c8 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -180,7 +180,7 @@ bool EditorExportPlatformLinuxBSD::get_export_option_visibility(const EditorExpo
 void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) const {
 	EditorExportPlatformPC::get_export_options(r_options);
 
-	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,rv64,ppc64,ppc32"), "x86_64"));
+	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,loong64,rv64,ppc64,ppc32"), "x86_64"));
 
 	String run_script = "#!/usr/bin/env bash\n"
 						"export DISPLAY=:0\n"
diff --git a/platform_methods.py b/platform_methods.py
index 2b157da..c8e8454 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -8,7 +8,7 @@ import methods
 
 
 # CPU architecture options.
-architectures = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64", "wasm32"]
+architectures = ["x86_32", "x86_64", "arm32", "arm64", "loong64", "rv64", "ppc32", "ppc64", "wasm32"]
 architecture_aliases = {
     "x86": "x86_32",
     "x64": "x86_64",
@@ -17,6 +17,7 @@ architecture_aliases = {
     "armv8": "arm64",
     "arm64v8": "arm64",
     "aarch64": "arm64",
+    "loongarch64": "loong64",
     "rv": "rv64",
     "riscv": "rv64",
     "riscv64": "rv64",
diff --git a/thirdparty/libpng/pngpriv.h b/thirdparty/libpng/pngpriv.h
index 9bfdb71..7ed8d57 100644
--- a/thirdparty/libpng/pngpriv.h
+++ b/thirdparty/libpng/pngpriv.h
@@ -221,7 +221,7 @@
 
 #ifndef PNG_LOONGARCH_LSX_OPT
 #  if defined(__loongarch_sx)
-#     define PNG_LOONGARCH_LSX_OPT 1
+#     define PNG_LOONGARCH_LSX_OPT 0
 #  else
 #     define PNG_LOONGARCH_LSX_OPT 0
 #  endif
diff --git a/thirdparty/openxr/src/common/platform_utils.hpp b/thirdparty/openxr/src/common/platform_utils.hpp
index d047c17..7b47d29 100644
--- a/thirdparty/openxr/src/common/platform_utils.hpp
+++ b/thirdparty/openxr/src/common/platform_utils.hpp
@@ -67,6 +67,8 @@
 #define XR_ARCH_ABI "ia64"
 #elif defined(__m68k__)
 #define XR_ARCH_ABI "m68k"
+#elif defined(__loongarch__) && defined(__loongarch_lp64)
+#define XR_ARCH_ABI "loongarch64"
 #elif defined(__riscv_xlen) && (__riscv_xlen == 64)
 #define XR_ARCH_ABI "riscv64"
 #elif defined(__sparc__) && defined(__arch64__)

杀毒软件吧

能分享一个已经编译好的godot程序么?


知识共享许可协议
本站文章除其作者特殊声明外,一律采用CC BY-NC-SA 4.0许可协议进行授权。
进行转载或二次创作时务必以相同协议进行共享,严禁用于商业用途