microsoft / DirectXTex

DirectXTex texture processing library
https://walbourn.github.io/directxtex/
MIT License
1.79k stars 441 forks source link

Add Spectre mitigation support to NuGet and vcpkg #294

Closed walbourn closed 1 year ago

walbourn commented 1 year ago

For NuGet, add an alternative library built with /p:SpectreMitigation=Spectre for Desktop (not supported by UWP).

For vcpkg, add a spectre feature that sets a CMake build option ENABLE_SPECTRE_MITIGATION=ON.

walbourn commented 1 year ago

See https://github.com/microsoft/DirectXTex/pull/293 for a related PR.

walbourn commented 1 year ago

CMake build support and validation has been committed.

DirectXTex parses files, which is why it's important for this mitigation to be supported.

walbourn commented 1 year ago

While DirectXMesh does not have much in the way of file parsing features (it's all local to the meshconvert sample), I added opt-in support in CMake and validation for Spectre-mitigations via https://github.com/microsoft/DirectXMesh/commit/133c459a8f6a2cebe16c10f08a3097e83901369e

walbourn commented 1 year ago

For the DirectX Tool Kit, most use cases are to parse models and texture files included with the application rather than from untrusted sources. Added opt-in support in CMake and validation for Spectre-mitigations via: https://github.com/microsoft/DirectXTK/commit/0b8ca84069703139234a74ec753e3081651820b1, https://github.com/microsoft/DirectXTK12/commit/9b3bda236e9b14d636ec064953c36a279219633e

walbourn commented 1 year ago

Adding pre-built Spectre libs to the DirectXTex, DirectXMesh, and UVAtlas Nuget packages is no biggie as the packages only grow to about ~20 MB.

https://github.com/microsoft/DirectXMesh/pull/78

https://github.com/microsoft/UVAtlas/pull/89

The DirectX Tool Kit packages would exceed 100 MB so I'm not going to add those.

I will add a spectre feature to all my vcpkg ports though.