You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+23-18Lines changed: 23 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,16 +14,16 @@ These instructions define how GitHub Copilot should assist with this project. Th
14
14
15
15
- See the tutorial at [Getting Started](https://github.com/microsoft/DirectXMesh/wiki/Getting-Started).
16
16
- The recommended way to integrate *DirectXMesh* into your project is by using the *vcpkg* Package Manager.
17
-
- You can make use of the nuget.org packages **directxmesh_desktop_2019**, **directxmesh_desktop_win10**, or **directxmesh_uwp**.
17
+
- You can make use of the nuget.org packages **directxmesh_desktop_win10** or **directxmesh_uwp**.
18
18
- You can also use the library source code directly in your project or as a git submodule.
19
19
20
20
## General Guidelines
21
21
22
-
-**Code Style**: The project uses an .editorconfig file to enforce coding standards. Follow the rules defined in `.editorconfig` for indentation, line endings, and other formatting. Additional information can be found on the wiki at [Implementation](https://github.com/microsoft/DirectXTK/wiki/Implementation). The library implementation is written to be compatible with C++14 features, but C++17 is required to build the project for the command-line tools which utilize C++17filesystem for long file path support.
23
-
> Notable `.editorconfig` rules: C/C++ files use 4-space indentation, `crlf` line endings, and `latin1` charset — avoid non-ASCII characters in source files. HLSL files have separate indent/spacing rules defined in `.editorconfig`.
22
+
-**Code Style**: The project uses an .editorconfig file to enforce coding standards. Follow the rules defined in `.editorconfig` for indentation, line endings, and other formatting. Additional information can be found on the wiki at [Implementation](https://github.com/microsoft/DirectXTK/wiki/Implementation). The library's public API requires C++11, and the project builds with C++17 (`CMAKE_CXX_STANDARD 17`). The command-line tools also use C++17, including `<filesystem>` for long file path support. This code is designed to build with Visual Studio 2022, Visual Studio 2026, clang for Windows v12 or later, or MinGW 12.2.
23
+
> Notable `.editorconfig` rules: C/C++ files use 4-space indentation, `crlf` line endings, and `latin1` charset — avoid non-ASCII characters in source files.
24
24
-**Documentation**: The project provides documentation in the form of wiki pages available at [Documentation](https://github.com/microsoft/DirectXMesh/wiki/).
25
25
-**Error Handling**: Use C++ exceptions for error handling and uses RAII smart pointers to ensure resources are properly managed. For some functions that return HRESULT error codes, they are marked `noexcept`, use `std::nothrow` for memory allocation, and should not throw exceptions.
26
-
-**Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxmeshtest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxmeshtest/wiki).
26
+
-**Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxmeshtest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxmeshtest/wiki). See [test copilot instructions](https://github.com/walbourn/directxmeshtest/blob/main/.github/copilot-instructions.md) for additional information on the tests.
27
27
-**Security**: This project uses secure coding practices from the Microsoft Secure Coding Guidelines, and is subject to the `SECURITY.md` file in the root of the repository. Functions that read input from geometry files are subject to OneFuzz fuzz testing to ensure they are secure against malformed files.
28
28
-**Dependencies**: The project uses CMake and VCPKG for managing dependencies, making optional use of DirectXMath and DirectX-Headers. The project can be built without these dependencies, relying on the Windows SDK for core functionality.
29
29
-**Continuous Integration**: This project implements GitHub Actions for continuous integration, ensuring that all code changes are tested and validated before merging. This includes building the project for a number of configurations and toolsets, running a subset of unit tests, and static code analysis including GitHub super-linter, CodeQL, and MSVC Code Analysis.
@@ -49,14 +49,14 @@ wiki/ # Local clone of the GitHub wiki documentation repository.
49
49
50
50
- Use RAII for all resource ownership (memory, file handles, etc.).
51
51
- Many classes utilize the pImpl idiom to hide implementation details, and to enable optimized memory alignment in the implementation.
52
-
- Use `std::unique_ptr` for exclusive ownership and `std::shared_ptr` for shared ownership.
53
-
- Use `Microsoft::WRL::ComPtr` for COM object management.
52
+
- Use `std::unique_ptr` for exclusive ownership.
54
53
- Make use of anonymous namespaces to limit scope of functions and variables.
55
54
- Make use of `assert` for debugging checks, but be sure to validate input parameters in release builds.
56
55
- Explicitly `= delete` copy constructors and copy-assignment operators on all classes that use the pImpl idiom.
57
56
- Explicitly utilize `= default` or `=delete` for copy constructors, assignment operators, move constructors and move-assignment operators where appropriate.
58
57
- Use 16-byte alignment (`_aligned_malloc` / `_aligned_free`) to support SIMD operations in the implementation, but do not expose this requirement in public APIs.
59
58
> For non-Windows support, the implementation uses C++17 `aligned_alloc` instead of `_aligned_malloc`.
59
+
- All implementation `.cpp` files include `DirectXMeshP.h` as their first include (precompiled header). MinGW builds skip precompiled headers.
- All query and utility functions that cannot fail (e.g., `IsValidVB`, `IsValidIB`) are marked `noexcept`.
113
-
- All HRESULT-returning I/O and processing functions are also `noexcept` — errors are communicated via return code, never via exceptions.
113
+
- HRESULT-returning functions that do not perform heap allocation or use Standard C++ containers are `noexcept` — errors are communicated via return code, never via exceptions (e.g., `ComputeNormals`, `ReorderIB`, `FinalizeIB`, `FinalizeVB`, `CompactVB`, `OptimizeVertices`, `ComputeCullData`).
114
+
- HRESULT-returning functions that use `std::vector`, `std::function`, or other potentially throwing types are *not* marked `noexcept` — they may throw on allocation failure (e.g., `GenerateAdjacencyAndPointReps`, `Validate`, `Clean`, `WeldVertices`, `ComputeMeshlets`, `OptimizeFaces`).
114
115
- Constructors and functions that perform heap allocation or utilize Standard C++ containers that may throw are marked `noexcept(false)`.
115
116
116
117
#### Enum Flags Pattern
117
118
118
-
Flags enums follow this pattern — a `uint32_t`-based unscoped enum with a `_NONE = 0x0` base case, followed by a call to `DEFINE_ENUM_FLAG_OPERATORS` (defined in `DirectXMesh.inl`) to enable `|`, `&`, and `~` operators:
119
+
Flags enums follow this pattern — a `uint32_t`-based unscoped enum with a `_DEFAULT = 0` base case, followed by a call to `DEFINE_ENUM_FLAG_OPERATORS` (invoked in `DirectXMesh.inl`) to enable `|`, `&`, and `~` operators:
119
120
120
121
```cpp
121
122
enum CNORM_FLAGS : uint32_t
122
123
{
123
-
CNORM_DEFAULT = 0x0,
124
+
CNORM_DEFAULT = 0,
124
125
// Default is to compute normals using weight-by-angle
125
126
126
127
CNORM_WEIGHT_BY_AREA = 0x1,
@@ -142,7 +143,7 @@ See [this blog post](https://walbourn.github.io/modern-c++-bitmask-types/) for m
142
143
143
144
- Don’t use raw pointers for ownership.
144
145
- Avoid macros for constants—prefer `constexpr` or `inline``const`.
145
-
- Don’t put implementation logic in header files unless using templates, although the SimpleMath library does use an .inl file for performance.
146
+
- Don't put implementation logic in header files unless using templates, although the DirectXMesh library does use an .inl file for performance for a few specific utility functions that are called in tight loops (e.g., `IsValidIB`, `IsValidVB`).
146
147
- Avoid using `using namespace` in header files to prevent polluting the global namespace.
147
148
148
149
## Naming Conventions
@@ -174,16 +175,16 @@ Every source file (`.cpp`, `.h`, etc.) must begin with this block:
174
175
```
175
176
176
177
Section separators within files use:
177
-
- Major sections: `//-------------------------------------------------------------------------------------`
- The code supports building for Windows and Linux.
225
+
- The code targets Win32 desktop applications for Windows 8.1 or later, Xbox One, Xbox Series X\|S, Universal Windows Platform (UWP) apps for Windows 10 and Windows 11, and Linux.
225
226
- Portability and conformance of the code is validated by building with Visual C++, clang/LLVM for Windows, MinGW, and GCC for Linux compilers.
227
+
- The project ships MSBuild projects for Visual Studio 2022 (`.sln` / `.vcxproj`) and Visual Studio 2026 (`.slnx` / `.vcxproj`). VS 2019 projects have been retired.
226
228
227
229
### Platform and Compiler `#ifdef` Guards
228
230
@@ -231,10 +233,12 @@ Use these established guards — do not invent new ones:
231
233
| Guard | Purpose |
232
234
| --- | --- |
233
235
|`_WIN32`| Windows platform (desktop, UWP, Xbox) |
234
-
|`_GAMING_XBOX`| Xbox One or Xbox Series X\|S |
235
-
|`_GAMING_XBOX_SCARLETT`| Xbox Series X\|S |
236
+
|`_GAMING_XBOX`| Xbox platform (GDK - covers both Xbox One and Xbox Series X\|S) |
237
+
|`_GAMING_XBOX_SCARLETT`| Xbox Series X\|S (GDK with Xbox Extensions) |
238
+
|`_GAMING_XBOX_XBOXONE`| Xbox One (GDK with Xbox Extensions) |
236
239
|`_XBOX_ONE && _TITLE`| Legacy Xbox One XDK — **no longer supported**; triggers a `#error` at compile time |
237
240
|`_MSC_VER`| MSVC-specific (and MSVC-like clang-cl) pragmas and warning suppression |
241
+
|`__INTEL_COMPILER`| Intel C++ Compiler classic warning suppression |
@@ -245,17 +249,18 @@ Use these established guards — do not invent new ones:
245
249
246
250
> `_M_ARM`/ `__arm__` is legacy 32-bit ARM which is deprecated.
247
251
248
-
Non-Windows builds (Linux/WSL) omit WIC entirely and use `<directx/dxgiformat.h>` and `<wsl/winadapter.h>` from the DirectX-Headers package instead of the Windows SDK.
252
+
Non-Windows builds (Linux/WSL) use `<directx/dxgiformat.h>` and `<wsl/winadapter.h>` from the DirectX-Headers package instead of the Windows SDK.
249
253
250
254
### Error Codes
251
255
252
-
The following symbols are not custom error codes, but aliases for `HRESULT_FROM_WIN32` error values.
256
+
The following symbols are not custom error codes, but aliases for `HRESULT_FROM_WIN32` error codes.
0 commit comments