Skip to content

Arm64 support for the samples#966

Open
jenatali wants to merge 10 commits into
masterfrom
arm64
Open

Arm64 support for the samples#966
jenatali wants to merge 10 commits into
masterfrom
arm64

Conversation

@jenatali

@jenatali jenatali commented Jul 8, 2026

Copy link
Copy Markdown
Member

Adds native arm64 support for most of the samples in the repository.

What changed:

  • Arm64 configs added to all applicable projects and solutions
  • Toolset and SDK versions unpinned, they now depend on the build environment to pick a default
  • DirectXTK12, DirectXTex, and DirectXMesh are now consumed via vcpkg instead of NuGet
  • MiniEngine gained a few NEON paths
  • MiniEngine shaders explicitly target DXC
  • Misc other minor fixes

Big changes:

  • Vcpkg support: The NuGet package for DXTK12 indicates on its page that NuGet support is deprecated and vcpkg is the recommended way to consume it. Deprecation alone isn't a good enough reason to switch, but the arm64 static libraries failed to link with the VS2022 toolset I was using due to some stale STL references. Vcpkg is the correct approach for consuming static library code anyway. NuGet continues to be used for binary or header-only dependencies.

A few tools aren't updated due to either pre-existing build complexities, or x64-only dependencies.

jenatali and others added 4 commits July 8, 2026 16:53
Add ARM64 solution platform to D3D12Raytracing.slnx and ARM64
Debug/Release project configurations to all standalone raytracing
sample projects, mirroring the existing x64 configurations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On ARM64 XMVECTOR maps to __n128, which does not accept the
{ x, y, z, w } aggregate initializer that works for __m128 on x64.
Replace those brace initializations with XMVectorSet(), which is
portable across architectures and behavior-identical on x64.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ARM64 solution platforms and per-project ARM64 Debug/Release
configurations to all standalone desktop samples (Samples/Desktop,
TechniqueDemos, Tools), mirroring the existing x64 configurations.

Also float the previously hard-pinned toolset and SDK so the samples build
with the installed Visual Studio. Set <PlatformToolset> to
$(DefaultPlatformToolset) rather than removing it: a bare removal makes x64
fall back to the ancient v100 toolset (ARM64 happens to resolve to v143),
so an explicit floating value is required. Retarget
<WindowsTargetPlatformVersion> to 10.0 (latest installed). The old
v140/v141/v142 and fixed SDK pins referenced toolsets/SDKs not present in
current VS installs and blocked building on both x64 and ARM64.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Floating the pinned Windows SDK to the latest installed version (part of the
ARM64 build enablement) surfaces ID2D1Factory::GetDesktopDpi as deprecated,
which this project's SDLCheck promotes to a hard build error. This is purely
an SDK-upgrade compatibility fix and is unrelated to the ARM64 platform itself.

Switch to GetDpiForWindow(m_Hwnd) -- the recommended replacement -- which
queries per-monitor DPI. m_Hwnd is created before CreateSwapChainResources, so
it is valid here; behavior matches the previous single system-DPI value.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread vcpkg/DirectX.vcpkg.targets
Comment thread vcpkg/DirectX.vcpkg.props Outdated
Comment thread vcpkg/DirectX.vcpkg.targets
@jenatali

jenatali commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Thank you @walbourn for taking a look before I even took it out of draft!

jenatali and others added 6 commits July 9, 2026 09:10
The prebuilt directx*_desktop NuGet packages are deprecated and their ARM64
static libs fail to link against the current toolset (they reference legacy
STL __std_init_once symbols the current arm64 msvcprt.lib only resolves for
code built with the current STL). Build these three static libraries from
source via vcpkg instead, so they use the same toolset as the samples -- this
fixes ARM64 and aligns with Microsoft's deprecation guidance. Header/binary
NuGet deps (Agility SDK, DXC, WinPix, WARP) are unaffected.

Add a repo-root vcpkg manifest (vcpkg.json + pinned builtin-baseline) and
shared MSBuild integration (vcpkg/DirectX.vcpkg.props/.targets) that:
- derive the triplet from $(Platform) as <arch>-windows-static-md (static lib,
  dynamic CRT to match the samples' /MD);
- request the directxtex/directxmesh 'dx12' feature (the D3D12 helpers the
  samples use, e.g. ComputeInputLayout(D3D12_INPUT_LAYOUT_DESC), are off by
  default in the base ports);
- add include\directxtk12 to the include path (vcpkg nests DirectXTK12 headers
  there whereas the NuGet layout was flat);
- derive VcpkgConfiguration from the configuration name so projects like
  MiniEngine that set RuntimeLibrary directly (without UseDebugLibraries) still
  link the matching debug/release libraries.

Update all consumers to import the shared props/targets, drop the NuGet
directx* imports/error-checks, and remove them from packages.config. Uses the
vcpkg bundled with Visual Studio by default (no VCPKG_ROOT needed).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
packages.config listed zlib-vc140-static-64, but ModelConverter.vcxproj
references zlib-msvc-x64.1.2.11.8900 (imports its targets and links
zlibstatic.lib from its lib_release). The referenced package was therefore
never restored on a clean machine, failing the build with a missing
zlib-msvc-x64.targets. Align packages.config to the package the project
actually uses. Verified a clean restore now fetches it and ModelConverter
builds and links.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MiniEngine/Core used x86 SSE intrinsics that do not compile on ARM64:
- Utility.cpp SIMDMemCopy/SIMDMemFill: add an ARM64 NEON implementation
  (vld1q/vst1q) alongside the existing SSE (streaming-store) path, guarded by
  _M_ARM64. Change the SIMDMemFill signature from __m128 to DirectX::XMVECTOR
  (identical to __m128 on x64) so it is expressible on both architectures.
- Color.h R10G10B10A2/R8G8B8A8: replace _mm_castsi128_ps(_mm_cvttps_epi32(..))
  with the portable XMConvertVectorFloatToInt(.., 0) (same truncate-to-int).
- CommandContext.cpp FillBuffer: build the fill pattern with XMVectorReplicate
  instead of _mm_set1_ps.

Math/Common.h, Color.cpp and Hash.h already had non-SSE fallbacks, and the
_BitScan*/__popcnt intrinsics are available on MSVC ARM64, so no change there.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MiniEngine's Build.props compiles shaders with -HV 2021 (HLSL 2021), which is
a DXC-only option, but set no ShaderModel. VS therefore defaulted to the
4_0_level_9_3 profile and invoked legacy fxc.exe, which on current Windows SDKs
rejects both -HV and the compute profile (cs_4_0_level_9_3) -- breaking clean
builds on x64 and ARM64 alike (previously masked by cached CompiledShaders).

Set ShaderModel 6.0 so the FxCompile task routes to dxc.exe, which supports
-HV 2021 and compiles these shaders as SM6. A native arm64 dxc.exe is available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ARM64 Debug/Profile/Release configurations to the MiniEngine Core and
Model libraries and the two MiniEngine-based raytracing samples
(RaytracingMiniEngineSample, RealTimeDenoisedAmbientOcclusion), mirroring the
existing x64 configurations. Also fix XMVECTOR aggregate initialization in
RTAO's RaytracingSceneDefines.cpp (invalid for __n128 on ARM64) by using
XMVectorSet, matching the earlier raytracing-sample fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ARM64 Debug/Profile/Release configurations to ModelViewer.vcxproj and an
ARM64 platform to ModelViewer.slnx (the existing abstract 'Windows' solution
platform continues to map to the x64 project configuration). Core and Model
already gained ARM64 configurations with the SSE->NEON port.

ModelConverter is intentionally left x64-only: it is an offline content tool
that depends on x64-only NuGet packages (assimp, zlib-msvc-x64).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jenatali jenatali marked this pull request as ready for review July 9, 2026 16:11
@jenatali jenatali requested a review from walbourn July 9, 2026 16:21
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.

3 participants