Merge pull request #64921 from bruvzg/win_arm

[Windows] Improve build environment detection, add support for Windows on ARM.
This commit is contained in:
Rémi Verschelde
2022-08-27 18:46:54 +02:00
committed by GitHub
8 changed files with 310 additions and 115 deletions

View File

@@ -191,11 +191,11 @@ String Engine::get_architecture_name() const {
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
return "x86_32";
#elif defined(__aarch64__) || defined(_M_ARM64)
#elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
return "arm64";
#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__)
return "armv7";
#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) || defined(_M_ARM)
return "arm32";
#elif defined(__riscv)
#if __riscv_xlen == 8

View File

@@ -1,5 +1,8 @@
def can_build(env, platform):
# Depends on Embree library, which only supports x86_64 and arm64.
if platform == "windows":
return env["arch"] == "x86_64" # TODO build for Windows on ARM
return env["arch"] in ["x86_64", "arm64"]

View File

@@ -173,10 +173,18 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
frame.AddrStack.Mode = AddrModeFlat;
frame.AddrFrame.Mode = AddrModeFlat;
#ifdef _M_X64
#if defined(_M_X64)
frame.AddrPC.Offset = context->Rip;
frame.AddrStack.Offset = context->Rsp;
frame.AddrFrame.Offset = context->Rbp;
#elif defined(_M_ARM64) || defined(_M_ARM64EC)
frame.AddrPC.Offset = context->Pc;
frame.AddrStack.Offset = context->Sp;
frame.AddrFrame.Offset = context->Fp;
#elif defined(_M_ARM)
frame.AddrPC.Offset = context->Pc;
frame.AddrStack.Offset = context->Sp;
frame.AddrFrame.Offset = context->R11;
#else
frame.AddrPC.Offset = context->Eip;
frame.AddrStack.Offset = context->Esp;

File diff suppressed because it is too large Load Diff

View File

@@ -123,7 +123,7 @@ bool EditorExportPlatformWindows::get_export_option_visibility(const EditorExpor
void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_options) {
EditorExportPlatformPC::get_export_options(r_options);
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32"), "x86_64"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64"), "x86_64"));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/enable"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/identity_type", PROPERTY_HINT_ENUM, "Select automatically,Use PKCS12 file (specify *.PFX/*.P12 file),Use certificate store (specify SHA1 hash)"), 0));

View File

@@ -345,6 +345,9 @@ File extracted from upstream release tarball:
- Added 2 files `godot_core_mbedtls_platform.c` and `godot_core_mbedtls_config.h`
providing configuration for light bundling with core.
Some changes have been made in order to fix Windows on ARM build errors.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
## meshoptimizer
@@ -375,6 +378,9 @@ Files extracted from upstream repository:
- `minimp3_ex.h`
- `LICENSE`
Some changes have been made in order to fix Windows on ARM build errors.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
## miniupnpc

View File

@@ -195,8 +195,10 @@ unsigned long mbedtls_timing_hardclock( void )
#endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM &&
__GNUC__ && __ia64__ */
#if !defined(HAVE_HARDCLOCK) && defined(_MSC_VER) && \
// -- GODOT start --
#if !defined(HAVE_HARDCLOCK) && defined(_WIN32) && \
!defined(EFIX64) && !defined(EFI32)
// -- GODOT end --
#define HAVE_HARDCLOCK

View File

@@ -1566,7 +1566,18 @@ static void mp3d_synth(float *xl, mp3d_sample_t *dstl, int nch, float *lins)
#else /* MINIMP3_FLOAT_OUTPUT */
// -- GODOT start --
#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
static f4 g_scale;
g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 0);
g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 1);
g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 2);
g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 3);
#else
static const f4 g_scale = { 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f };
#endif
// -- GODOT end --
a = VMUL(a, g_scale);
b = VMUL(b, g_scale);
#if HAVE_SSE
@@ -1813,7 +1824,19 @@ void mp3dec_f32_to_s16(const float *in, int16_t *out, int num_samples)
int aligned_count = num_samples & ~7;
for(; i < aligned_count; i += 8)
{
// -- GODOT start --
#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
static f4 g_scale;
g_scale = vsetq_lane_f32(32768.0f, g_scale, 0);
g_scale = vsetq_lane_f32(32768.0f, g_scale, 1);
g_scale = vsetq_lane_f32(32768.0f, g_scale, 2);
g_scale = vsetq_lane_f32(32768.0f, g_scale, 3);
#else
static const f4 g_scale = { 32768.0f, 32768.0f, 32768.0f, 32768.0f };
#endif
// -- GODOT end --
f4 a = VMUL(VLD(&in[i ]), g_scale);
f4 b = VMUL(VLD(&in[i+4]), g_scale);
#if HAVE_SSE