From ce11acc5d84a193ba881522f9b21343e9f0ceba9 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 18:56:54 -0700 Subject: [PATCH 01/15] Convert release instructions to CoPilot skill --- .github/copilot-instructions.md | 28 +----------- .github/skills/release/SKILL.md | 79 +++++++++++++++++++++++++++++++++ .github/workflows/codeql.yml | 4 +- .github/workflows/msvc.yml | 2 +- .gitignore | 1 + 5 files changed, 84 insertions(+), 30 deletions(-) create mode 100644 .github/skills/release/SKILL.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4f04ad3a..1b3410d5 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -289,30 +289,4 @@ When reviewing documentation, do the following: ## Release Process -1. Ensure all changes are merged into the `main` branch and that all tests pass. -2. Git pull the local repository to ensure it is up to date with the `main` branch. -3. Run the PowerShell script `build\preparerelease.ps1` which will generate a topic branch for the release, update the version number in `CMakeLists.txt`, the `README.md` file, the release notes in the nuspec files, and create a stub in the `CHANGELOG.md` file for the new release. -4. Edit the `CHANGELOG.md` file to update it with a summary of changes. -5. Submit the topic branch for review and merge into `main` once approved. Allow the GitHub Actions workflows and the Azure DevOps pipelines to complete successfully before proceeding. -6. Run the PowerShell script `build\completerelease.ps1` which will set a tag on the project repo and the test repo, and create a release on GitHub with the release notes from `CHANGELOG.md`. Ensure you have set up GPG signing for your GitHub account so that the tags will be verified. -7. Git pull the local repository to ensure it is up to date with the `main` branch. Be sure to include `--tags`. -8. Push the `main` branch to the MSCodeHub mirror repository. Be sure to include `--tags`. -9. Create a PR on MSCodeHub from the `main` branch to the `release` branch. -10. Merge the PR on MSCodeHub to update the release branch, which will trigger the Azure DevOps pipeline to build signed binaries and the NuGet packages. -11. Run the PowerShell script `build\downloadartifacts.ps1` to download the signed binaries from the Azure DevOps pipeline artifacts. -12. Edit the GitHub release and upload the signed binaries to the release assets. -13. Download the GitHub source .zip archive from the release. Unzip and compare to the local repo to ensure it matches — keep in mind there may be some CR/LF differences. Run minisign on the .zip to generate a signature file, and upload the signature file to the release assets. -14. Validate the NuGet packages with by pushing the NuGet packages to a local Packages Source folder, updating the NuGet packages from that folder, and then build the project. -15. Run the PowerShell script `build\promotenuget.ps1` with the `-Release` parameter to promote the version to the Release view on the project-scoped ADO feed. -16. Run the MSCodeHub pipeline to publish the NuGet packages to nuget.org. The pipeline will automatically push the most recent package promoted to the Release view to nuget.org. -17. Git pull a local repository of VCPKG to `d:\vcpkg` in sync with the `main` branch of the VCPKG repository. -18. Run the PowerShell script `build\updatevcpkg.ps1` to update the DirectXMesh port in VCPKG with the new release version. This will edit the files in `ports\directxmesh`. -19. Test the VCPKG port using all appropriate triplets and features. -20. Run `.\vcpkg --x-add-version directxmesh` to update the VCPKG versioning history. -21. Submit a PR to the VCPKG repository to update the DirectXMesh port back to the main GitHub repo. The PR will be reviewed and merged by the VCPKG maintainers. -22. If relevant changes were made to the `meshconvert` tool, update the winget manifests for that tool in the `winget` repository. -- Git pull a local repository to `D:\winget-pkgs` in sync with the `master` branch of the WinGet repository. -- Run the PowerShell script `build\updatewinget.ps1` to update the winget manifests for the tool with the new release version. -- Submit a PR to the `winget` repository to update the manifests for the tool. - -> When fully completed, be sure to update the GitHub release with links to the matching NuGet packages, the VCPKG port, and the winget manifests for the tools. +The release process is documented in the [release skill](.github/skills/release/SKILL.md). Invoke the `release` skill for step-by-step guidance when performing a release. diff --git a/.github/skills/release/SKILL.md b/.github/skills/release/SKILL.md new file mode 100644 index 00000000..499cc9e7 --- /dev/null +++ b/.github/skills/release/SKILL.md @@ -0,0 +1,79 @@ +--- +name: Release Process +description: Guide for performing the DirectXMesh release process. Use this skill when asked to help with releasing a new version, publishing packages, or updating ports. +--- + +# Release Process + +## Prerequisites + +- All changes merged into the `main` branch with all tests passing. +- GPG signing configured for your GitHub account (for verified tags). +- Access to the MSCodeHub mirror repository and Azure DevOps pipelines. +- Local repositories: + - VCPKG at `d:\vcpkg` (synced with `main` branch) + - WinGet at `D:\winget-pkgs` (synced with `master` branch, only if tool updates needed) + +## Steps + +### Phase 1: Prepare Release + +1. Git pull the local repository to ensure it is up to date with the `main` branch. +2. Run the PowerShell script `build\preparerelease.ps1` which will generate a topic branch for the release, update the version number in `CMakeLists.txt`, the `README.md` file, the release notes in the nuspec files, and create a stub in the `CHANGELOG.md` file for the new release. +3. Edit the `CHANGELOG.md` file to update it with a summary of changes. +4. Submit the topic branch for review and merge into `main` once approved. Allow the GitHub Actions workflows and the Azure DevOps pipelines to complete successfully before proceeding. + +### Phase 2: Tag and Create GitHub Release + +5. Run the PowerShell script `build\completerelease.ps1` which will set a tag on the project repo and the test repo, and create a release on GitHub with the release notes from `CHANGELOG.md`. Ensure you have set up GPG signing for your GitHub account so that the tags will be verified. +6. Git pull the local repository to ensure it is up to date with the `main` branch. Be sure to include `--tags`. + +### Phase 3: MSCodeHub and Signed Binaries + +7. Push the `main` branch to the MSCodeHub mirror repository. Be sure to include `--tags`. +8. Create a PR on MSCodeHub from the `main` branch to the `release` branch. +9. Merge the PR on MSCodeHub to update the release branch, which will trigger the Azure DevOps pipeline to build signed binaries and the NuGet packages. +10. Run the PowerShell script `build\downloadartifacts.ps1` to download the signed binaries from the Azure DevOps pipeline artifacts. +11. Edit the GitHub release and upload the signed binaries to the release assets. + +### Phase 4: Source Archive Signing + +12. Download the GitHub source .zip archive from the release. Unzip and compare to the local repo to ensure it matches — keep in mind there may be some CR/LF differences. +13. Run minisign on the .zip to generate a signature file, and upload the signature file to the release assets. + +### Phase 5: NuGet Validation and Publishing + +14. Validate the NuGet packages with by pushing the NuGet packages to a local Packages Source folder, updating the NuGet packages from that folder, and then build the project. +15. Run the PowerShell script `build\promotenuget.ps1` with the `-Release` parameter to promote the version to the Release view on the project-scoped ADO feed. +16. Run the MSCodeHub pipeline to publish the NuGet packages to nuget.org. The pipeline will automatically push the most recent package promoted to the Release view to nuget.org. + +### Phase 6: VCPKG Port Update + +17. Git pull a local repository of VCPKG to `d:\vcpkg` in sync with the `main` branch of the VCPKG repository. +18. Run the PowerShell script `build\updatevcpkg.ps1` to update the DirectXMesh port in VCPKG with the new release version. This will edit the files in `ports\directxmesh`. +19. Test the VCPKG port using all appropriate triplets and features. +20. Run `.\vcpkg --x-add-version directxmesh` to update the VCPKG versioning history. +21. Submit a PR to the VCPKG repository to update the DirectXMesh port back to the main GitHub repo. The PR will be reviewed and merged by the VCPKG maintainers. + +### Phase 7: WinGet Manifests (Conditional) + +If relevant changes were made to the `meshconvert` tool: + +22. Git pull a local repository to `D:\winget-pkgs` in sync with the `master` branch of the WinGet repository. +23. Run the PowerShell script `build\updatewinget.ps1` to update the winget manifests for the tool with the new release version. +24. Submit a PR to the `winget` repository to update the manifests for the tool. + +### Phase 8: Finalize + +When fully completed, be sure to update the GitHub release with links to the matching NuGet packages, the VCPKG port, and the winget manifests for the tools. + +## Key Scripts + +| Script | Purpose | +| --- | --- | +| `build\preparerelease.ps1` | Creates topic branch, updates version numbers and changelog stub | +| `build\completerelease.ps1` | Sets tags, creates GitHub release from changelog | +| `build\downloadartifacts.ps1` | Downloads signed binaries from Azure DevOps | +| `build\promotenuget.ps1 -Release` | Promotes NuGet package to Release view on ADO feed | +| `build\updatevcpkg.ps1` | Updates DirectXTK VCPKG port files | +| `build\updatewinget.ps1` | Updates winget manifests for CLI tools | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d3c24a61..6df72deb 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -59,7 +59,7 @@ jobs: - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - name: Initialize CodeQL - uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v3.29.5 + uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4.36.1 with: languages: c-cpp build-mode: manual @@ -73,6 +73,6 @@ jobs: run: cmake --build out\build\x64-Debug - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v3.29.5 + uses: github/codeql-action/analyze@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4.36.1 with: category: "/language:c-cpp" diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 3562edf9..ebd728bf 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -65,6 +65,6 @@ jobs: # Upload SARIF file to GitHub Code Scanning Alerts - name: Upload SARIF to GitHub - uses: github/codeql-action/upload-sarif@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v3.29.5 + uses: github/codeql-action/upload-sarif@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4.36.1 with: sarif_file: ${{ steps.run-analysis.outputs.sarif }} diff --git a/.gitignore b/.gitignore index fc035cae..40e02554 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ x64 /CMakeUserPresets.json /build/vcpkg_installed /build/*.exe +!**/skills/** From 5b74f00cbafa190d2a29ae4d36b000189048a2b3 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 19:36:25 -0700 Subject: [PATCH 02/15] Pick markdown lint --- .github/skills/release/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/skills/release/SKILL.md b/.github/skills/release/SKILL.md index 499cc9e7..f5992540 100644 --- a/.github/skills/release/SKILL.md +++ b/.github/skills/release/SKILL.md @@ -14,6 +14,7 @@ description: Guide for performing the DirectXMesh release process. Use this skil - VCPKG at `d:\vcpkg` (synced with `main` branch) - WinGet at `D:\winget-pkgs` (synced with `master` branch, only if tool updates needed) + ## Steps ### Phase 1: Prepare Release From 580a968183f00390458f5c1f05fef3841c159d66 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 21:29:50 -0700 Subject: [PATCH 03/15] Code review --- .github/skills/release/SKILL.md | 22 ++- .github/skills/release/assets/vcpkgdxmesh.cmd | 153 ++++++++++++++++++ 2 files changed, 168 insertions(+), 7 deletions(-) create mode 100644 .github/skills/release/assets/vcpkgdxmesh.cmd diff --git a/.github/skills/release/SKILL.md b/.github/skills/release/SKILL.md index f5992540..e8a562fc 100644 --- a/.github/skills/release/SKILL.md +++ b/.github/skills/release/SKILL.md @@ -34,7 +34,7 @@ description: Guide for performing the DirectXMesh release process. Use this skil 7. Push the `main` branch to the MSCodeHub mirror repository. Be sure to include `--tags`. 8. Create a PR on MSCodeHub from the `main` branch to the `release` branch. 9. Merge the PR on MSCodeHub to update the release branch, which will trigger the Azure DevOps pipeline to build signed binaries and the NuGet packages. -10. Run the PowerShell script `build\downloadartifacts.ps1` to download the signed binaries from the Azure DevOps pipeline artifacts. +10. Run the PowerShell script `build\downloadbuild.ps1` to download the signed binaries from the Azure DevOps pipeline artifacts. 11. Edit the GitHub release and upload the signed binaries to the release assets. ### Phase 4: Source Archive Signing @@ -45,15 +45,23 @@ description: Guide for performing the DirectXMesh release process. Use this skil ### Phase 5: NuGet Validation and Publishing 14. Validate the NuGet packages with by pushing the NuGet packages to a local Packages Source folder, updating the NuGet packages from that folder, and then build the project. -15. Run the PowerShell script `build\promotenuget.ps1` with the `-Release` parameter to promote the version to the Release view on the project-scoped ADO feed. +15. Run the PowerShell script `build\promotenuget.ps1 -Version -Release` to promote the version to the Release view on the project-scoped ADO feed. The `-Version` parameter is required and should match the NuGet package version (e.g., `2026.6.2.1`). 16. Run the MSCodeHub pipeline to publish the NuGet packages to nuget.org. The pipeline will automatically push the most recent package promoted to the Release view to nuget.org. ### Phase 6: VCPKG Port Update 17. Git pull a local repository of VCPKG to `d:\vcpkg` in sync with the `main` branch of the VCPKG repository. 18. Run the PowerShell script `build\updatevcpkg.ps1` to update the DirectXMesh port in VCPKG with the new release version. This will edit the files in `ports\directxmesh`. -19. Test the VCPKG port using all appropriate triplets and features. -20. Run `.\vcpkg --x-add-version directxmesh` to update the VCPKG versioning history. +19. Test the VCPKG port using the script at `assets/vcpkgdxmesh.cmd` (in this skill folder). Copy it to `d:\vcpkg` and run from there. This tests the following triplets and features: + - **Windows desktop**: `x86-windows`, `x64-windows`, `arm64-windows`, `arm64ec-windows` (dynamic), plus `-static` and `-static-md` variants for x86/x64/arm64. + - **Features**: `[tools]`, `[dx12]`, `[spectre]` on desktop triplets. + - **UWP**: `x86-uwp`, `x64-uwp`, `arm64-uwp`. + - **MinGW** (if compilers available): `x64-mingw-dynamic`, `x64-mingw-static`, `x86-mingw-dynamic`, `x86-mingw-static` with `[dx12]` and `[tools]` features. + - **Xbox** (if GDKX available, or pass `xbox` argument): `x64-xbox-scarlett`, `x64-xbox-scarlett-static`, `x64-xbox-xboxone`, `x64-xbox-xboxone-static`. + - **Linux** (run separately on Linux): `x64-linux`, `arm64-linux` with default and `[dx12]` features. + + If the port includes patches, review them to determine if they should be removed or updated for the new release (the `updatevcpkg.ps1` script will warn about this). +20. Run `.\vcpkg x-add-version directxmesh` to update the VCPKG versioning history. 21. Submit a PR to the VCPKG repository to update the DirectXMesh port back to the main GitHub repo. The PR will be reviewed and merged by the VCPKG maintainers. ### Phase 7: WinGet Manifests (Conditional) @@ -74,7 +82,7 @@ When fully completed, be sure to update the GitHub release with links to the mat | --- | --- | | `build\preparerelease.ps1` | Creates topic branch, updates version numbers and changelog stub | | `build\completerelease.ps1` | Sets tags, creates GitHub release from changelog | -| `build\downloadartifacts.ps1` | Downloads signed binaries from Azure DevOps | -| `build\promotenuget.ps1 -Release` | Promotes NuGet package to Release view on ADO feed | -| `build\updatevcpkg.ps1` | Updates DirectXTK VCPKG port files | +| `build\downloadbuild.ps1` | Downloads signed binaries from Azure DevOps | +| `build\promotenuget.ps1 -Version -Release` | Promotes NuGet package to Release view on ADO feed | +| `build\updatevcpkg.ps1` | Updates DirectXMesh VCPKG port files | | `build\updatewinget.ps1` | Updates winget manifests for CLI tools | diff --git a/.github/skills/release/assets/vcpkgdxmesh.cmd b/.github/skills/release/assets/vcpkgdxmesh.cmd new file mode 100644 index 00000000..f73925b9 --- /dev/null +++ b/.github/skills/release/assets/vcpkgdxmesh.cmd @@ -0,0 +1,153 @@ +@set VCPKG_BINARY_SOURCES=clear +@set VCPKG_ROOT=%cd% +@if %1.==xbox. goto xbox +@if %1.==clang. goto clang +.\vcpkg install directxmesh:x86-windows +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x86-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x86-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[spectre]:x86-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x86-windows-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x86-windows-static-md +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-windows +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x64-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x64-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[spectre]:x64-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-windows-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-windows-static-md +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-windows +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:arm64-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[spectre]:arm64-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-windows-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-windows-static-md +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64ec-windows +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:arm64ec-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[spectre]:arm64ec-windows --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x86-uwp +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-uwp +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-uwp +@if errorlevel 1 goto error +@where /Q x86_64-w64-mingw32-g++.exe +@if errorlevel 1 goto skipgcc64 +.\vcpkg install directxmesh:x64-mingw-dynamic +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x64-mingw-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x64-mingw-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-mingw-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x64-mingw-static --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x64-mingw-static --recurse +@if errorlevel 1 goto error +:skipgcc64 +@where /Q i686-w64-mingw32-g++.exe +@if errorlevel 1 goto skipgcc32 +.\vcpkg install directxmesh:x86-mingw-dynamic +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x86-mingw-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x86-mingw-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x86-mingw-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x86-mingw-static --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x86-mingw-static --recurse +@if errorlevel 1 goto error +:skipgcc32 +@if "%GXDKLatest%."=="." goto finish +:xbox +.\vcpkg install directxmesh:x64-xbox-scarlett +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-xbox-scarlett-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-xbox-xboxone +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-xbox-xboxone-static +@if errorlevel 1 goto error +@goto finish +:clang +.\vcpkg install directxmesh:x64-clangcl-dynamic +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:x64-clangcl-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh[dx12]:x64-clangcl-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-clangcl-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-clangcl-dynamic +@if errorlevel 1 goto error +.\vcpkg install directxmesh[tools]:arm64-clangcl-dynamic --recurse +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-clangcl-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-clangcl-uwp +@if errorlevel 1 goto error +.\vcpkg install directxmesh:arm64-clangcl-uwp +@if errorlevel 1 goto error +@if "%GXDKLatest%."=="." goto finish +.\vcpkg install directxmesh:x64-clangcl-scarlett +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-clangcl-scarlett-static +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-clangcl-xboxone +@if errorlevel 1 goto error +.\vcpkg install directxmesh:x64-clangcl-xboxone-static +@if errorlevel 1 goto error +:finish +@echo SUCCEEDED +@if %1.==xbox. goto eof +@if %1.==clang. goto eof +@echo . +@echo . Run on x64-linux and arm64-linux +@echo . ./vcpkg install directxmesh +@echo . ./vcpkg install directxmesh[dx12] --recurse +@where /Q x86_64-w64-mingw32-g++.exe +@if NOT errorlevel 1 goto gcc64 +@echo . +@echo . Run for MinGW64 +@echo . .\vcpkg install directxmesh:x64-mingw-dynamic +@echo . .\vcpkg install directxmesh[dx12]:x64-mingw-dynamic --recurse +@echo . .\vcpkg install directxmesh[tools]:x64-mingw-dynamic --recurse +@echo . .\vcpkg install directxmesh:x64-mingw-static +@echo . .\vcpkg install directxmesh[dx12]:x64-mingw-static --recurse +@echo . .\vcpkg install directxmesh[tools]:x64-mingw-static --recurse +:gcc64 +@where /Q i686-w64-mingw32-g++.exe +@if NOT errorlevel 1 goto gcc32 +@echo . +@echo . Run for MinGW32 +@echo . .\vcpkg install directxmesh:x86-mingw-dynamic +@echo . .\vcpkg install directxmesh[dx12]:x86-mingw-dynamic --recurse +@echo . .\vcpkg install directxmesh[tools]:x86-mingw-dynamic --recurse +@echo . .\vcpkg install directxmesh:x86-mingw-dynamic +@echo . .\vcpkg install directxmesh[dx12]:x86-mingw-dynamic --recurse +@echo . .\vcpkg install directxmesh[tools]:x86-mingw-dynamic --recurse +:gcc32 +@goto eof +:error +@echo FAILED +:eof From 8b9ca0eea2cd3e3e6610de8969e85cf4cfa46c6b Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 21:33:11 -0700 Subject: [PATCH 04/15] add usage skill --- .github/skills/directxmesh-usage/SKILL.md | 140 ++++++++++++++++++ .../directxmesh-usage/reference/overview.md | 78 ++++++++++ 2 files changed, 218 insertions(+) create mode 100644 .github/skills/directxmesh-usage/SKILL.md create mode 100644 .github/skills/directxmesh-usage/reference/overview.md diff --git a/.github/skills/directxmesh-usage/SKILL.md b/.github/skills/directxmesh-usage/SKILL.md new file mode 100644 index 00000000..e07075ae --- /dev/null +++ b/.github/skills/directxmesh-usage/SKILL.md @@ -0,0 +1,140 @@ +--- +name: directxmesh-usage +description: Guide for integrating the DirectXMesh geometry processing library into a C++ project. +--- + +# Using DirectXMesh in Your Project + +This skill provides guidance for integrating the DirectXMesh geometry processing library into a C++ project. + +## When to Use + +Invoke this skill when: + +- Adding DirectXMesh as a dependency to a new or existing project. +- Writing code that processes mesh geometry (normals, tangents, optimization, meshlets). +- Needing to understand the typical DirectXMesh processing pipeline. + +## Integration Methods + +### vcpkg manifest-mode (Recommended) + +In your `vcpkg.json` file, add the following: + +```json +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "dependencies": [ + "directxmesh" + ] +} +``` + +### vcpkg (classic) + +```bash +vcpkg install directxmesh +``` + +Features: `dx12` (DirectX 12 input layout support). Triplets: `x64-windows`, `x64-linux`, `arm64-windows`, etc. + +For DLL usage (`x64-windows` default triplet), define `DIRECTX_MESH_IMPORT` in your consuming project. + +### CMake (FetchContent) + +```cmake +include(FetchContent) +FetchContent_Declare( + DirectXMesh + GIT_REPOSITORY https://github.com/microsoft/DirectXMesh.git + GIT_TAG main +) +FetchContent_MakeAvailable(DirectXMesh) +target_link_libraries(${PROJECT_NAME} PRIVATE DirectXMesh) +``` + +Key CMake options: `BUILD_DX12` (ON by default), `BUILD_SHARED_LIBS` (OFF by default). + +### NuGet + +- **directxmesh_desktop_win10** — Windows desktop (Win10/Win11), includes DX12 and ARM64. +- **directxmesh_uwp** — Universal Windows Platform apps. + +### Project Reference + +Add the appropriate `.vcxproj` from the `DirectXMesh/` folder to your solution and add a project reference. Add the `DirectXMesh` directory to your Additional Include Directories. + +## Header Usage + +```cpp +#include // or — include BEFORE DirectXMesh.h +#include "DirectXMesh.h" + +using namespace DirectX; +``` + +All functions reside in the `DirectX` namespace. Most functions have overloads for both 16-bit and 32-bit index buffers. + +## Typical Processing Pipeline + +``` +Load geometry (positions, indices, texcoords) + │ + ▼ +GenerateAdjacencyAndPointReps ──→ adjacency[], pointRep[] + │ + ▼ +Validate (optional diagnostics) + │ + ▼ +Clean (fix bowties, degenerate triangles) ──→ dupVerts[] + │ + ▼ +ComputeNormals / ComputeTangentFrame + │ + ▼ +AttributeSort ──→ faceRemap[] + │ + ▼ +OptimizeFaces ──→ faceRemap[] + │ + ▼ +ReorderIB (apply face remap) + │ + ▼ +OptimizeVertices ──→ vertexRemap[] + │ + ▼ +FinalizeIB + FinalizeVB (apply vertex remap and dupVerts) + │ + ▼ +CompactVB (optional, remove trailing unused vertices) + │ + ▼ +ComputeMeshlets ──→ meshlets[], uniqueVertexIB (uint8_t[]), primitiveIndices[] + │ + ▼ +ComputeCullData (for mesh shader GPU culling) + NOTE: uniqueVertexIB from ComputeMeshlets is a packed buffer of + uint16_t or uint32_t indices (matching the original IB format). + Reinterpret-cast it to the appropriate type for ComputeCullData. +``` + +## Error Handling + +- Most functions return `HRESULT`. Check with `SUCCEEDED(hr)` or `FAILED(hr)`. +- Functions marked `noexcept` never throw; they return `E_OUTOFMEMORY` or `E_INVALIDARG` on failure. +- Functions using `std::vector` or `std::function` may throw on allocation failure + +## Key References + +- **Public API header**: `DirectXMesh/DirectXMesh.h` — read this for exact signatures and SAL annotations. +- **API overview table**: See `reference/overview.md` in this skill folder. +- **Wiki documentation**: https://github.com/microsoft/DirectXMesh/wiki +- **Utility headers**: `Utilities/WaveFrontReader.h` (OBJ file loading), `Utilities/FlexibleVertexFormat.h` (legacy FVF conversion). + +## Platform Notes + +- Windows desktop (Win8.1+), UWP, Xbox (GDK), and Linux are supported. +- Non-Windows builds require the [DirectX-Headers](https://github.com/microsoft/DirectX-Headers) package and define `USING_DIRECTX_HEADERS`. +- The library requires C++17 to build but the public API is C++11 compatible. diff --git a/.github/skills/directxmesh-usage/reference/overview.md b/.github/skills/directxmesh-usage/reference/overview.md new file mode 100644 index 00000000..e8d1fa17 --- /dev/null +++ b/.github/skills/directxmesh-usage/reference/overview.md @@ -0,0 +1,78 @@ +# DirectXMesh API Overview + +All functions are in the `DirectX` namespace. Most have overloads for both `uint16_t` and `uint32_t` index buffers. See `DirectXMesh/DirectXMesh.h` for exact signatures. + +## Functions + +| Function | Category | Description | +| --- | --- | --- | +| `IsValidVB` | Format Utilities | Returns true if a DXGI_FORMAT is valid for use in a vertex buffer. | +| `IsValidIB` | Format Utilities | Returns true if a DXGI_FORMAT is valid for use in an index buffer (R16_UINT or R32_UINT). | +| `BytesPerElement` | Format Utilities | Returns the byte size of a single element for a given DXGI_FORMAT. | +| `IsValid` | Input Layout | Validates a D3D11 or D3D12 input layout descriptor. | +| `ComputeInputLayout` | Input Layout | Computes byte offsets and strides for each element in an input layout. | +| `ComputeSubsets` | Attributes | Returns a list of (offset, count) pairs for contiguous attribute groups in a sorted face list. | +| `ComputeVertexCacheMissRate` | Diagnostics | Computes ACMR and ATVR metrics for a given index buffer and cache size. | +| `GenerateAdjacencyAndPointReps` | Adjacency | Builds face adjacency and/or point representative arrays from positions. Epsilon=0 for topological, >0 for geometric. | +| `ConvertPointRepsToAdjacency` | Adjacency | Converts point representatives to face adjacency. | +| `GenerateGSAdjacency` | Adjacency | Produces a 6-index-per-face IB for use with geometry shader adjacency topology. | +| `ComputeNormals` | Geometry | Computes per-vertex normals from indexed triangle positions. Supports weight-by-angle, weight-by-area, or equal weight. | +| `ComputeTangentFrame` | Geometry | Computes per-vertex tangents and/or bitangents from positions, normals, and texcoords. Overload with XMFLOAT4 tangent stores handedness in .w. | +| `Validate` | Validation | Checks mesh for common problems (degenerate triangles, bowties, asymmetric adjacency). Returns S_OK if valid. | +| `Clean` | Cleanup | Repairs mesh issues by splitting vertices; outputs dupVerts array for later use with FinalizeVB. | +| `WeldVertices` | Utilities | Merges duplicate vertices using a caller-supplied comparison predicate. Produces a vertex remap. | +| `ConcatenateMesh` | Utilities | Computes face/vertex destination maps for merging multiple meshes into one. | +| `AttributeSort` | Optimization | Reorders faces by material/attribute ID; produces a face remap. | +| `OptimizeFaces` | Optimization | Reorders faces for post-transform vertex cache efficiency (Hoppe's algorithm). Requires adjacency. | +| `OptimizeFacesLRU` | Optimization | Reorders faces using an LRU vertex cache simulation. Does not require adjacency. | +| `OptimizeFacesEx` | Optimization | Per-attribute-group version of OptimizeFaces. | +| `OptimizeFacesLRUEx` | Optimization | Per-attribute-group version of OptimizeFacesLRU. | +| `OptimizeVertices` | Optimization | Reorders vertices in order of first use; produces a vertex remap. Optionally reports trailing unused count. | +| `ReorderIB` | Remap | Applies a face remap to an index buffer (in-place or copy). | +| `ReorderIBAndAdjacency` | Remap | Applies a face remap to both an index buffer and adjacency array. | +| `FinalizeIB` | Remap | Applies a vertex remap to an index buffer (in-place or copy). | +| `FinalizeVB` | Remap | Applies a vertex remap and/or vertex duplications to a vertex buffer. | +| `FinalizeVBAndPointReps` | Remap | Same as FinalizeVB but also remaps point representatives. | +| `CompactVB` | Remap | Copies a vertex buffer while removing trailing unused vertices. | +| `ComputeMeshlets` | Meshlets | Generates meshlets from indexed triangles. Optional adjacency improves locality. Subset overload available. | +| `ComputeCullData` | Meshlets | Computes per-meshlet bounding sphere and normal cone for GPU culling. | + +## Classes + +| Class | Description | +| --- | --- | +| `VBReader` | Reads individual vertex elements by semantic name from one or more vertex buffer streams. Initialize with input layout, add stream(s), then Read(). | +| `VBWriter` | Writes individual vertex elements by semantic name into one or more vertex buffer streams. Initialize with input layout, add stream(s), then Write(). | + +## Enums (Flags) + +| Enum | Values | Used By | +| --- | --- | --- | +| `CNORM_FLAGS` | `CNORM_DEFAULT`, `CNORM_WEIGHT_BY_AREA`, `CNORM_WEIGHT_EQUAL`, `CNORM_WIND_CW` | `ComputeNormals` | +| `VALIDATE_FLAGS` | `VALIDATE_DEFAULT`, `VALIDATE_BACKFACING`, `VALIDATE_BOWTIES`, `VALIDATE_DEGENERATE`, `VALIDATE_UNUSED`, `VALIDATE_ASYMMETRIC_ADJ` | `Validate` | +| `MESHLET_FLAGS` | `MESHLET_DEFAULT`, `MESHLET_WIND_CW` | `ComputeCullData` | +| `OPTFACES` | `OPTFACES_V_DEFAULT` (12), `OPTFACES_R_DEFAULT` (7), `OPTFACES_LRU_DEFAULT` (32), `OPTFACES_V_STRIPORDER` (0) | `OptimizeFaces`, `OptimizeFacesLRU` | + +## Structs + +| Struct | Fields | Used By | +| --- | --- | --- | +| `Meshlet` | `VertCount`, `VertOffset`, `PrimCount`, `PrimOffset` | `ComputeMeshlets`, `ComputeCullData` | +| `MeshletTriangle` | `i0:10`, `i1:10`, `i2:10` (packed uint32_t) | `ComputeMeshlets`, `ComputeCullData` | +| `CullData` | `BoundingSphere`, `NormalCone` (XMUBYTEN4), `ApexOffset` | `ComputeCullData` | + +## Constants + +| Constant | Value | Description | +| --- | --- | --- | +| `MESHLET_DEFAULT_MAX_VERTS` | 128 | Default maximum vertices per meshlet. | +| `MESHLET_DEFAULT_MAX_PRIMS` | 128 | Default maximum primitives per meshlet. | +| `MESHLET_MINIMUM_SIZE` | 32 | Minimum allowed meshlet size. | +| `MESHLET_MAXIMUM_SIZE` | 256 | Maximum allowed meshlet size. | + +## Utility Headers (in Utilities/) + +| Header | Description | +| --- | --- | +| `WaveFrontReader.h` | Template class `WaveFrontReader` for loading Wavefront .OBJ files into memory. Provides positions, normals, texcoords, indices, attributes, and material info. | +| `FlexibleVertexFormat.h` | Converts legacy Direct3D Fixed-Function Vertex formats (FVF codes) to D3D11 input element descriptions. | From 2bded520bf43ed054a5eec1c4a4231accc222d0f Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 21:38:51 -0700 Subject: [PATCH 05/15] Code review --- .github/skills/release/SKILL.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/skills/release/SKILL.md b/.github/skills/release/SKILL.md index e8a562fc..f3c8e301 100644 --- a/.github/skills/release/SKILL.md +++ b/.github/skills/release/SKILL.md @@ -52,15 +52,8 @@ description: Guide for performing the DirectXMesh release process. Use this skil 17. Git pull a local repository of VCPKG to `d:\vcpkg` in sync with the `main` branch of the VCPKG repository. 18. Run the PowerShell script `build\updatevcpkg.ps1` to update the DirectXMesh port in VCPKG with the new release version. This will edit the files in `ports\directxmesh`. -19. Test the VCPKG port using the script at `assets/vcpkgdxmesh.cmd` (in this skill folder). Copy it to `d:\vcpkg` and run from there. This tests the following triplets and features: - - **Windows desktop**: `x86-windows`, `x64-windows`, `arm64-windows`, `arm64ec-windows` (dynamic), plus `-static` and `-static-md` variants for x86/x64/arm64. - - **Features**: `[tools]`, `[dx12]`, `[spectre]` on desktop triplets. - - **UWP**: `x86-uwp`, `x64-uwp`, `arm64-uwp`. - - **MinGW** (if compilers available): `x64-mingw-dynamic`, `x64-mingw-static`, `x86-mingw-dynamic`, `x86-mingw-static` with `[dx12]` and `[tools]` features. - - **Xbox** (if GDKX available, or pass `xbox` argument): `x64-xbox-scarlett`, `x64-xbox-scarlett-static`, `x64-xbox-xboxone`, `x64-xbox-xboxone-static`. - - **Linux** (run separately on Linux): `x64-linux`, `arm64-linux` with default and `[dx12]` features. - If the port includes patches, review them to determine if they should be removed or updated for the new release (the `updatevcpkg.ps1` script will warn about this). +19. Test the VCPKG port using the script at `assets/vcpkgdxmesh.cmd` (in this skill folder). Copy it to `d:\vcpkg` and run from there after bootstrapping VCPKG. 20. Run `.\vcpkg x-add-version directxmesh` to update the VCPKG versioning history. 21. Submit a PR to the VCPKG repository to update the DirectXMesh port back to the main GitHub repo. The PR will be reviewed and merged by the VCPKG maintainers. From 7315046c0955543725c3310ab319bc46f412594a Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 21:52:00 -0700 Subject: [PATCH 06/15] More code review --- .github/skills/release/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/skills/release/SKILL.md b/.github/skills/release/SKILL.md index f3c8e301..01aa219e 100644 --- a/.github/skills/release/SKILL.md +++ b/.github/skills/release/SKILL.md @@ -13,6 +13,7 @@ description: Guide for performing the DirectXMesh release process. Use this skil - Local repositories: - VCPKG at `d:\vcpkg` (synced with `main` branch) - WinGet at `D:\winget-pkgs` (synced with `master` branch, only if tool updates needed) +- PATs will be needed for scripts that access GitHub and ADO. ## Steps From 09a87a9e2d3f2e5146ebe14d905d9670d2cfd5ae Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 22:00:48 -0700 Subject: [PATCH 07/15] Code review --- .github/skills/release/SKILL.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/skills/release/SKILL.md b/.github/skills/release/SKILL.md index 01aa219e..8437c772 100644 --- a/.github/skills/release/SKILL.md +++ b/.github/skills/release/SKILL.md @@ -77,6 +77,7 @@ When fully completed, be sure to update the GitHub release with links to the mat | `build\preparerelease.ps1` | Creates topic branch, updates version numbers and changelog stub | | `build\completerelease.ps1` | Sets tags, creates GitHub release from changelog | | `build\downloadbuild.ps1` | Downloads signed binaries from Azure DevOps | -| `build\promotenuget.ps1 -Version -Release` | Promotes NuGet package to Release view on ADO feed | +| `build\promotenuget.ps1` | Promotes NuGet package to Release view on ADO feed | | `build\updatevcpkg.ps1` | Updates DirectXMesh VCPKG port files | +| `assets\vcpkgdxmesh.cmd` | Tests VCPKG port across all triplets and features | | `build\updatewinget.ps1` | Updates winget manifests for CLI tools | From 659cde81fe84d14c97cf9ae68bd6463924cc1b4d Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 22:38:09 -0700 Subject: [PATCH 08/15] A few more refinements --- .github/skills/directxmesh-usage/SKILL.md | 38 +++++++++++++---------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/skills/directxmesh-usage/SKILL.md b/.github/skills/directxmesh-usage/SKILL.md index e07075ae..07631bd1 100644 --- a/.github/skills/directxmesh-usage/SKILL.md +++ b/.github/skills/directxmesh-usage/SKILL.md @@ -3,7 +3,7 @@ name: directxmesh-usage description: Guide for integrating the DirectXMesh geometry processing library into a C++ project. --- -# Using DirectXMesh in Your Project +# DirectXMesh Usage Guide This skill provides guidance for integrating the DirectXMesh geometry processing library into a C++ project. @@ -15,6 +15,15 @@ Invoke this skill when: - Writing code that processes mesh geometry (normals, tangents, optimization, meshlets). - Needing to understand the typical DirectXMesh processing pipeline. +## Overview + +DirectXMesh is a geometry processing library for Direct3D 11 and Direct3D 12 applications. It provides support for loading and saving mesh data, and performing various geometry processing operations including normal and tangent computation, adjacency generation, and mesh optimization. + +- **Repository**: +- **Documentation**: +- **NuGet Packages**: `directxmesh_desktop_win10`, `directxmesh_uwp` +- **vcpkg Port**: `directxmesh` + ## Integration Methods ### vcpkg manifest-mode (Recommended) @@ -36,29 +45,20 @@ In your `vcpkg.json` file, add the following: vcpkg install directxmesh ``` -Features: `dx12` (DirectX 12 input layout support). Triplets: `x64-windows`, `x64-linux`, `arm64-windows`, etc. +Features: `dx12` (DirectX 12 input layout support), `tools` (command-line tools). Triplets: `x64-windows`, `x64-linux`, `arm64-windows`, etc. -For DLL usage (`x64-windows` default triplet), define `DIRECTX_MESH_IMPORT` in your consuming project. +For DLL usage (`x64-windows` default triplet), define `DIRECTX_MESH_IMPORT` in your consuming project. For static library usage, use `-static-md` triplet variants. -### CMake (FetchContent) +CMakeLists.txt: ```cmake -include(FetchContent) -FetchContent_Declare( - DirectXMesh - GIT_REPOSITORY https://github.com/microsoft/DirectXMesh.git - GIT_TAG main -) -FetchContent_MakeAvailable(DirectXMesh) -target_link_libraries(${PROJECT_NAME} PRIVATE DirectXMesh) +find_package(directxmesh CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE Microsoft::DirectXMesh) ``` -Key CMake options: `BUILD_DX12` (ON by default), `BUILD_SHARED_LIBS` (OFF by default). - ### NuGet -- **directxmesh_desktop_win10** — Windows desktop (Win10/Win11), includes DX12 and ARM64. -- **directxmesh_uwp** — Universal Windows Platform apps. +Use `directxmesh_desktop_win10` for Win32 desktop applications or `directxmesh_uwp` for UWP apps. ### Project Reference @@ -138,3 +138,9 @@ ComputeCullData (for mesh shader GPU culling) - Windows desktop (Win8.1+), UWP, Xbox (GDK), and Linux are supported. - Non-Windows builds require the [DirectX-Headers](https://github.com/microsoft/DirectX-Headers) package and define `USING_DIRECTX_HEADERS`. - The library requires C++17 to build but the public API is C++11 compatible. + +## Further Reading + +- [Getting Started](https://github.com/microsoft/DirectXMesh/wiki/Getting-Started) +- [DirectXMesh Wiki](https://github.com/microsoft/DirectXMesh/wiki) +- [API Reference](reference/overview.md) From 636ce3ab4e1245eefcec52a2fc55976515a49563 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 23:12:22 -0700 Subject: [PATCH 09/15] Converted ascii art to mermaid --- .github/skills/directxmesh-usage/SKILL.md | 58 +++++++---------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/.github/skills/directxmesh-usage/SKILL.md b/.github/skills/directxmesh-usage/SKILL.md index 07631bd1..d6bf5c56 100644 --- a/.github/skills/directxmesh-usage/SKILL.md +++ b/.github/skills/directxmesh-usage/SKILL.md @@ -77,48 +77,24 @@ All functions reside in the `DirectX` namespace. Most functions have overloads f ## Typical Processing Pipeline +```mermaid +flowchart TD + A[Load geometry\npositions, indices, texcoords] --> B + B[GenerateAdjacencyAndPointReps] -->|adjacency, pointRep| C + C[Validate\noptional diagnostics] --> D + D[Clean\nfix bowties, degenerate triangles] -->|dupVerts| E + E[ComputeNormals / ComputeTangentFrame] --> F + F[AttributeSort] -->|faceRemap| G + G[OptimizeFaces] -->|faceRemap| H + H[ReorderIB\napply face remap] --> I + I[OptimizeVertices] -->|vertexRemap| J + J[FinalizeIB + FinalizeVB\napply vertex remap and dupVerts] --> K + K[CompactVB\noptional, remove trailing unused vertices] --> L + L[ComputeMeshlets] -->|"meshlets, uniqueVertexIB (uint8_t), primitiveIndices"| M + M[ComputeCullData\nfor mesh shader GPU culling] ``` -Load geometry (positions, indices, texcoords) - │ - ▼ -GenerateAdjacencyAndPointReps ──→ adjacency[], pointRep[] - │ - ▼ -Validate (optional diagnostics) - │ - ▼ -Clean (fix bowties, degenerate triangles) ──→ dupVerts[] - │ - ▼ -ComputeNormals / ComputeTangentFrame - │ - ▼ -AttributeSort ──→ faceRemap[] - │ - ▼ -OptimizeFaces ──→ faceRemap[] - │ - ▼ -ReorderIB (apply face remap) - │ - ▼ -OptimizeVertices ──→ vertexRemap[] - │ - ▼ -FinalizeIB + FinalizeVB (apply vertex remap and dupVerts) - │ - ▼ -CompactVB (optional, remove trailing unused vertices) - │ - ▼ -ComputeMeshlets ──→ meshlets[], uniqueVertexIB (uint8_t[]), primitiveIndices[] - │ - ▼ -ComputeCullData (for mesh shader GPU culling) - NOTE: uniqueVertexIB from ComputeMeshlets is a packed buffer of - uint16_t or uint32_t indices (matching the original IB format). - Reinterpret-cast it to the appropriate type for ComputeCullData. -``` + +> **Note:** `uniqueVertexIB` from `ComputeMeshlets` is a packed buffer of `uint16_t` or `uint32_t` indices (matching the original IB format). Reinterpret-cast it to the appropriate type for `ComputeCullData`. ## Error Handling From dedb1fd3786bc31f7d8e805cdde8f3f30b67073d Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 4 Jun 2026 11:13:10 -0700 Subject: [PATCH 10/15] Move usage skill to public location --- .github/copilot-instructions.md | 1 + README.md | 4 ++++ {.github/skills => skills}/directxmesh-usage/SKILL.md | 0 .../skills => skills}/directxmesh-usage/reference/overview.md | 0 4 files changed, 5 insertions(+) rename {.github/skills => skills}/directxmesh-usage/SKILL.md (100%) rename {.github/skills => skills}/directxmesh-usage/reference/overview.md (100%) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1b3410d5..3ed8d179 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -39,6 +39,7 @@ build/ # Miscellaneous build files and scripts. DirectXMesh/ # DirectXMesh implementation files. Utilities/ # Utility headers such as a WaveFront .obj file loader and a FVF converter. Meshconvert/ # CLI tool for importing WaveFront .obj files and converting to CMO, SDKMESH, or VBO formats. +skills/ # Published CoPilot skills for use by developers. Tests/ # Tests are designed to be cloned from a separate repository at this location. wiki/ # Local clone of the GitHub wiki documentation repository. ``` diff --git a/README.md b/README.md index 96189f1c..b0069edc 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ These components are designed to work without requiring any content from the leg * Contains miscellaneous build files and scripts. +* ``skills\`` + + * Contains published CoPilot skills for use by developers. + ## Documentation Documentation is available on the [GitHub wiki](https://github.com/Microsoft/DirectXMesh/wiki). diff --git a/.github/skills/directxmesh-usage/SKILL.md b/skills/directxmesh-usage/SKILL.md similarity index 100% rename from .github/skills/directxmesh-usage/SKILL.md rename to skills/directxmesh-usage/SKILL.md diff --git a/.github/skills/directxmesh-usage/reference/overview.md b/skills/directxmesh-usage/reference/overview.md similarity index 100% rename from .github/skills/directxmesh-usage/reference/overview.md rename to skills/directxmesh-usage/reference/overview.md From 05d874236d17a3bc93b6fb365e4b9d8e6d0395f6 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 4 Jun 2026 11:31:43 -0700 Subject: [PATCH 11/15] Update readme --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0069edc..8e1d2242 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,24 @@ These components are designed to work without requiring any content from the leg * ``skills\`` - * Contains published CoPilot skills for use by developers. + * Contains published CoPilot skills for use by developers. ## Documentation Documentation is available on the [GitHub wiki](https://github.com/Microsoft/DirectXMesh/wiki). +## CoPilot Usage + +For CoPilot CLI assistance with using DirectXMesh, try: + +```bash +winget install GitHub.Copilot +winget install GitHub.cli +gh skill install microsoft/directxmesh directxmesh-usage +copilot +/skills list +``` + ## Notices All content and source code for this package are subject to the terms of the [MIT License](https://github.com/microsoft/DirectXMesh/blob/main/LICENSE). From 465574abe1c945ef20dd96997bb4c39ae2eb5e30 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 4 Jun 2026 11:40:13 -0700 Subject: [PATCH 12/15] review --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e1d2242..1dae1db7 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ For CoPilot CLI assistance with using DirectXMesh, try: ```bash winget install GitHub.Copilot winget install GitHub.cli -gh skill install microsoft/directxmesh directxmesh-usage +gh skill install microsoft/directxmesh copilot /skills list ``` From a1e107013133eb8c32ae7457278add23947461fe Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 4 Jun 2026 21:21:46 -0700 Subject: [PATCH 13/15] Add copilot skill --- skills/mesh-converter/SKILL.md | 161 +++++++++++++++++++++ skills/mesh-converter/reference/options.md | 67 +++++++++ 2 files changed, 228 insertions(+) create mode 100644 skills/mesh-converter/SKILL.md create mode 100644 skills/mesh-converter/reference/options.md diff --git a/skills/mesh-converter/SKILL.md b/skills/mesh-converter/SKILL.md new file mode 100644 index 00000000..8c6b0803 --- /dev/null +++ b/skills/mesh-converter/SKILL.md @@ -0,0 +1,161 @@ +--- +name: mesh-converter +description: Guide for using the meshconvert command-line tool to convert Wavefront OBJ files to DirectX runtime formats (CMO, SDKMESH, VBO). +--- + +# Mesh Converter Skill + +This skill provides guidance for using the `meshconvert` command-line tool to convert Wavefront OBJ geometry files into runtime formats consumed by DirectX Tool Kit. + +## When to Use + +Invoke this skill when: + +- Converting Wavefront OBJ files to SDKMESH, CMO, or VBO format. +- Preparing mesh geometry for use with DirectX Tool Kit (DirectXTK). +- Generating normals, tangents, or performing vertex-cache optimization on mesh data. +- Understanding the available output formats and their requirements. + +## Overview + +The `meshconvert` tool imports geometry from Wavefront Object (OBJ) or VBO files and prepares it for runtime use. It can generate normals and tangent frames, perform vertex-cache optimization, and write to formats suited for DirectX applications. + +- **Repository**: +- **Documentation**: +- **Installation**: `winget install Microsoft.DirectX.Mesh` + +## Installation + +### winget (Recommended) + +```bash +winget install Microsoft.DirectX.Mesh +``` + +### vcpkg + +```bash +vcpkg install directxmesh[tools] +``` + +## Basic Syntax + +``` +meshconvert [options] [--file-list ] +``` + +The tool uses Windows-style `-` or `/` for options, and also supports GNU long options with `--`. + +## Output Formats + +| Format | Switch | Description | Requirements | +| --- | --- | --- | --- | +| SDKMESH | `-ft sdkmesh` | Default output format for DirectX Tool Kit `Model` class | None | +| SDKMESH (PBR) | `-ft sdkmesh2` | SDKMESH with PBR materials | None | +| CMO | `-ft cmo` | Visual Studio CMO format for DirectX Tool Kit `Model` class | Normals, tangents, and texture coordinates | +| VBO | `-ft vbo` | Simple vertex buffer object format for DirectX Tool Kit | Normals and texture coordinates | +| OBJ | `-ft obj` | Re-export as Wavefront OBJ | None | + +## Common Workflows + +### Basic Conversion to SDKMESH (Default) + +```bash +meshconvert model.obj +``` + +Produces `model.sdkmesh` with no additional processing. + +### Convert with Normals and Optimization + +```bash +meshconvert model.obj -n -op +``` + +Generates normals (weight by angle) and performs vertex-cache optimization using the Hoppe algorithm. + +### Convert to CMO Format + +CMO format requires normals, tangents, and texture coordinates: + +```bash +meshconvert model.obj -ft cmo -n -tb +``` + +### Convert to VBO Format + +VBO format requires normals and texture coordinates: + +```bash +meshconvert model.obj -ft vbo -n +``` + +### Convert with Full Processing Pipeline + +```bash +meshconvert model.obj -n -tb -op -y +``` + +Generates normals, tangent frames (tangents and bi-tangents), optimizes the vertex cache, and overwrites any existing output file. + +### Convert for Direct3D Coordinate System + +OBJ files from tools using OpenGL conventions may need coordinate adjustments: + +```bash +meshconvert model.obj -n -op --flip-v --flip-z +``` + +Flips the V texture coordinate and negates Z for right-hand to left-hand conversion. + +### Batch Conversion + +```bash +meshconvert -r *.obj -n -op -y +``` + +Recursively processes all OBJ files in the current directory and subdirectories. + +Or use a file list: + +```bash +meshconvert --file-list models.txt -n -op -y +``` + +Where `models.txt` contains one filename per line (lines starting with `#` are comments). + +## Option Reference + +See [reference/options.md](reference/options.md) for the complete command-line options reference. + +## Format-Specific Notes + +### SDKMESH + +- Default output format. +- Supports 16-bit and 32-bit index buffers (auto-selects 16-bit when possible). +- Supports configurable vertex formats for normals, UVs, and colors. +- Used by DirectX Tool Kit's `Model` class via `Model::CreateFromSDKMESH`. + +### CMO + +- Visual Studio's mesh format. +- **Requires** normals, tangents, and texture coordinates — use `-n -tb` switches. +- Fixed vertex format (no `-fn`, `-fuv`, `-fc`, or `-ib32` options). +- Used by DirectX Tool Kit's `Model` class via `Model::CreateFromCMO`. + +### VBO + +- Simple binary format with position, normal, and texture coordinates. +- **Requires** normals and texture coordinates — use `-n` switch. +- Fixed vertex format (no `-fn`, `-fuv`, `-fc`, or `-ib32` options). +- Limited to 65535 vertices (16-bit indices only). +- Used by DirectX Tool Kit's `Model` class via `Model::CreateFromVBO`. + +## Key References + +- [Meshconvert Wiki Page](https://github.com/microsoft/DirectXMesh/wiki/Meshconvert) +- [Geometry Formats](https://github.com/microsoft/DirectXMesh/wiki/Geometry-formats) +- [VBO Format](https://github.com/microsoft/DirectXMesh/wiki/VBO) +- [DirectX Tool Kit Model Class](https://github.com/microsoft/DirectXTK/wiki/Model) +- [DirectX Tool Kit 12 Model Class](https://github.com/microsoft/DirectXTK12/wiki/Model) diff --git a/skills/mesh-converter/reference/options.md b/skills/mesh-converter/reference/options.md new file mode 100644 index 00000000..b9b55888 --- /dev/null +++ b/skills/mesh-converter/reference/options.md @@ -0,0 +1,67 @@ +# Meshconvert Options Reference + +Complete reference for all `meshconvert` command-line options. + +## File Options + +| Option | Long Form | Description | +| --- | --- | --- | +| `-r` | | Recursive wildcard search in subdirectories | +| `-flist ` | `--file-list ` | Read input filenames from a text file | +| `-o ` | | Specify output filename (single input only) | +| `-l` | `--to-lowercase` | Force output path and filename to lowercase | +| `-y` | `--overwrite` | Overwrite existing output files | + +## Normal and Tangent Options + +| Option | Long Form | Description | +| --- | --- | --- | +| `-n` | `--normal-by-angle` | Generate normals weighted by angle | +| `-na` | `--normal-by-area` | Generate normals weighted by area | +| `-ne` | `--normal-by-equal` | Generate normals with equal weights | +| `-t` | `--tangents` | Generate tangents | +| `-tb` | `--tangent-frame` | Generate tangents and bi-tangents | +| `-fn ` | `--normal-format ` | Normal format: `float3`, `float16_4`, `r11g11b10` (SDKMESH only) | +| `-cw` | `--clockwise` | Faces are clockwise (default is counter-clockwise) | + +## Coordinate and Winding Options + +| Option | Long Form | Description | +| --- | --- | --- | +| `-flip` | `--flip-face-winding` | Reverse face winding | +| | `--flip-u` | Invert U texture coordinate | +| | `--flip-v` | Invert V texture coordinate | +| | `--flip-z` | Negate Z component (RH to LH conversion) | + +## Vertex and Index Options + +| Option | Long Form | Description | +| --- | --- | --- | +| `-ib32` | `--index-buffer-32-bit` | Force 32-bit indices (SDKMESH only) | +| `-fuv ` | `--uv-format ` | UV format: `float2`, `float16_2` (SDKMESH only) | +| `-fc ` | `--color-format ` | Color format: `bgra`, `rgba`, `float4`, `float16_4`, `rgba_10`, `r11g11b10` (SDKMESH only) | + +## Optimization Options + +| Option | Long Form | Description | +| --- | --- | --- | +| `-op` | `--optimize` | Vertex cache optimize using Hoppe algorithm (implies `-c`) | +| `-oplru` | `--optimize-lru` | Vertex cache optimize using Forsyth algorithm (implies `-c`) | +| `-c` | `--clean` | Clean mesh (vertex duplication for attribute sets) | +| `-ta` | `--topological-adjacency` | Use topological adjacency (default) | +| `-ga` | `--geometric-adjacency` | Use geometric adjacency (epsilon 1e-5f) | + +## Output Format Options + +| Option | Long Form | Description | +| --- | --- | --- | +| `-ft ` | `--file-type ` | Output format: `sdkmesh`, `sdkmesh2`, `cmo`, `vbo`, `obj` | +| `-nodds` | | Prevent renaming texture extensions to .dds in materials | + +## Miscellaneous + +| Option | Description | +| --- | --- | +| `-nologo` | Suppress copyright message | +| `--version` | Display version information | +| `--help` | Display help | From 07b5fb2faa88cbcb4d2f3bc336337da667cf5dab Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 4 Jun 2026 21:49:42 -0700 Subject: [PATCH 14/15] Add more YAML front matter --- skills/directxmesh-usage/SKILL.md | 7 ++++++- skills/mesh-converter/SKILL.md | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/skills/directxmesh-usage/SKILL.md b/skills/directxmesh-usage/SKILL.md index d6bf5c56..3c276a86 100644 --- a/skills/directxmesh-usage/SKILL.md +++ b/skills/directxmesh-usage/SKILL.md @@ -1,6 +1,11 @@ --- name: directxmesh-usage -description: Guide for integrating the DirectXMesh geometry processing library into a C++ project. +description: >- + Guide for integrating the DirectXMesh geometry processing library into a C++ project. +license: MIT +metadata: + author: chuckw + version: "1.0" --- # DirectXMesh Usage Guide diff --git a/skills/mesh-converter/SKILL.md b/skills/mesh-converter/SKILL.md index 8c6b0803..db94c91c 100644 --- a/skills/mesh-converter/SKILL.md +++ b/skills/mesh-converter/SKILL.md @@ -1,6 +1,11 @@ --- name: mesh-converter -description: Guide for using the meshconvert command-line tool to convert Wavefront OBJ files to DirectX runtime formats (CMO, SDKMESH, VBO). +description: >- + Guide for using the meshconvert command-line tool to convert Wavefront OBJ files to DirectX runtime formats (CMO, SDKMESH, VBO). +license: MIT +metadata: + author: chuckw + version: "1.0" --- # Mesh Converter Skill From 9fad5282155e94842b63075b6286538baeaa4e0a Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 4 Jun 2026 21:51:44 -0700 Subject: [PATCH 15/15] Pick markdown lint --- .github/copilot-instructions.md | 2 +- skills/mesh-converter/SKILL.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 3ed8d179..b387f232 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -31,7 +31,7 @@ These instructions define how GitHub Copilot should assist with this project. Th ## File Structure -```txt +```plaintext .azuredevops/ # Azure DevOps pipeline configuration and policy files. .github/ # GitHub Actions workflow files and linter configuration files. .nuget/ # NuGet package configuration files. diff --git a/skills/mesh-converter/SKILL.md b/skills/mesh-converter/SKILL.md index db94c91c..d3d8466e 100644 --- a/skills/mesh-converter/SKILL.md +++ b/skills/mesh-converter/SKILL.md @@ -45,7 +45,7 @@ vcpkg install directxmesh[tools] ## Basic Syntax -``` +```plaintext meshconvert [options] [--file-list ] ```