Skip to content

Enable Windows ARM64 & ARM64EC in "stb_image.h" and "stb_image_resize2.h" and fix build failures. #1918

Open
navvyswethgraphics wants to merge 3 commits into
nothings:masterfrom
navvyswethgraphics:support_arm64_arm64ec_msvc
Open

Enable Windows ARM64 & ARM64EC in "stb_image.h" and "stb_image_resize2.h" and fix build failures. #1918
navvyswethgraphics wants to merge 3 commits into
nothings:masterfrom
navvyswethgraphics:support_arm64_arm64ec_msvc

Conversation

@navvyswethgraphics

Copy link
Copy Markdown

Summary

This PR adds proper detection and support for Windows ARM64 and ARM64EC:

  • Treat ARM64EC as native ARM64 and enable NEON where allowed.
  • Include the correct MSVC headers on ARM64/ARM64EC (<intrin.h>, <arm64_neon.h>).
  • Respect STBI_NO_SIMD (don’t enable NEON when SIMD is disabled).
  • Avoid accidentally selecting x86/SSE intrinsics on ARM64EC.
  • No behavior changes for existing x86/x64 builds.

Background

On MSVC ARM64EC, building could pull in x86 headers (<emmintrin.h>) and fail with:
error C1189: #error: this header should only be included through <intrin.h>
This came from incorrect architecture gating that didn’t exclude ARM64EC from x86/SSE paths.

Fix

Architecture selection updated to detect _M_ARM64EC.
ARM64/ARM64EC: include <intrin.h> and <arm64_neon.h> when NEON is enabled.
Ensure STBI_NO_SIMD disables NEON as intended.
In "stb_image_resize2.h" add NEON support for ARM64EC code paths.

Build & Test

Environment: Windows 11 on ARM64; MSVC (VS 2022 v143 toolset).
Result: ARM64 and ARM64EC configurations compile cleanly; x86/x64 unchanged.

@jeffrbig2

Copy link
Copy Markdown
Contributor

I'll check this the resize stuff in the next couple weeks!

Exclude _M_ARM64EC from x64 target detection to avoid incorrect
SIMD paths under MSVC.
Remove generic ARM64 detection and stop auto-enabling NEON.
NEON is now enabled only when explicitly requested via STBI_NEON.
OA# Your branch is up to date with 'origin/support_arm64_arm64ec_msvc'.
@navvyswethgraphics

Copy link
Copy Markdown
Author

I'll check this the resize stuff in the next couple weeks!

Thank you.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants