Skip to content

fix: load ARM64 NEON constant via vld1q_u16 instead of guessing MSVC's struct layout - #640

Merged
BenJule merged 1 commit into
developfrom
fix/636c-arm64-neon-load
Jul 28, 2026
Merged

fix: load ARM64 NEON constant via vld1q_u16 instead of guessing MSVC's struct layout#640
BenJule merged 1 commit into
developfrom
fix/636c-arm64-neon-load

Conversation

@BenJule

@BenJule BenJule commented Jul 28, 2026

Copy link
Copy Markdown
Owner

#639's nested-braces fix wasn't enough - the nightly rebuild still failed with the exact same error C2078 on the same line, just different columns. Rather than keep guessing at how MSVC's arm64_neon.h actually lays out uint16x8_t internally, this sidesteps the whole aggregate-init question:

static const uint16_t g_ign_first_arr[8] = { 0, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff };
uint16x8_t g_ign_first = vld1q_u16(g_ign_first_arr);

A plain uint16_t[8] array is always a valid static initializer on every compiler - no vector-type ambiguity possible. vld1q_u16 is the same portable ACLE load intrinsic family already used throughout this file (vld1_u8 etc.), so it's guaranteed to work wherever NEON already builds. Only downside: loses the static on the vector itself, so it's now loaded fresh per call instead of computed once - negligible cost for a single 128-bit load.

Closes #636

…llow-up to #637)

The nested-braces fix (#639) wasn't enough - MSVC's ARM64 uint16x8_t still
rejected the aggregate init with the same error C2078, just pointing at
slightly different columns. Rather than keep guessing at MSVC's exact
internal struct layout, sidestep it entirely: keep the constant data as a
plain uint16_t[8] array (always valid as a static initializer, no vector-type
ambiguity) and load it into the vector register with the portable vld1q_u16
intrinsic, already used throughout this file (e.g. vld1_u8 at line 3416+).

Closes #636
@BenJule BenJule self-assigned this Jul 28, 2026
@BenJule
BenJule requested a review from Copilot July 28, 2026 00:25
@github-actions github-actions Bot added area: ci GitHub Actions, CI/CD platform: windows Windows-specific issue labels Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@BenJule
BenJule merged commit 19d38b2 into develop Jul 28, 2026
13 of 14 checks passed
@BenJule
BenJule deleted the fix/636c-arm64-neon-load branch July 28, 2026 08:11
BenJule added a commit that referenced this pull request Jul 28, 2026
…#642)

After #640 fixed the NEON/SIMD compile errors, the ARM64 nightly build
got all the way through compilation and failed at link time instead:

```
libslic3r_gui.lib(wxMediaCtrl3.obj) : error LNK2001: unresolved external symbol "AVVideoDecoder::AVVideoDecoder(void)"
... 6 unresolved externals total
BambuStudio.dll : fatal error LNK1120: 6 unresolved externals
```

CMakeLists.txt excludes `AVVideoDecoder.cpp`/`.hpp` from the ARM64
source list entirely (no prebuilt libav there), but `wxMediaCtrl3.cpp`
unconditionally includes the header and declares an `AVVideoDecoder`
instance. The header itself compiles fine (it's just a class
declaration), but there's no `.cpp` providing the implementation, hence
the link failure.

Rather than touching the ~130-line streaming thread in
`wxMediaCtrl3.cpp` with a spread of `#ifdef`s, this moves the exclusion
inside `AVVideoDecoder.cpp`/`.hpp`: the real libav-based implementation
is guarded by the already-existing `BAMBUSTUDIO_NO_AVVIDEODECODER`
define (already set for MSVC ARM64 at CMakeLists.txt:760), with a stub
implementation for when it's defined that always reports failure. The
file is now always part of `SLIC3R_GUI_SOURCES` instead of being
conditionally excluded. `wxMediaCtrl3.cpp` needs zero changes -
camera/live-view will just report "no frame" on ARM64 instead of the
whole binary failing to link.

Closes #641
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci GitHub Actions, CI/CD platform: windows Windows-specific issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants