Skip to content

Commit 52240c7

Browse files
committed
Add CoPilot instructions
1 parent d829a98 commit 52240c7

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/copilot-instructions.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# GitHub Copilot Instructions
2+
3+
These instructions define how GitHub Copilot should assist with this project. The goal is to ensure consistent, high-quality code generation aligned with our conventions, stack, and best practices.
4+
5+
## Context
6+
7+
- **Project Type**: Graphics Library / DirectX / Direct3D 11 / Direct3D 12 / Geometry Processing
8+
- **Project Name**: DirectXMesh Geometry Processing Library
9+
- **Language**: C++
10+
- **Framework / Libraries**: STL / CMake / CTest
11+
- **Architecture**: Modular / RAII / OOP
12+
13+
## Getting Started
14+
15+
- See the tutorial at [Getting Started](https://github.com/microsoft/DirectXMesh/wiki/Getting-Started).
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**.
18+
- You can also use the library source code directly in your project or as a git submodule.
19+
20+
## General Guidelines
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 code requires C++11/C++14 features.
23+
- **Documentation**: The project provides documentation in the form of wiki pages available at [Documentation](https://github.com/microsoft/DirectXMesh/wiki/).
24+
- **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.
25+
- **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+
- **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 testing to ensure they are secure against malformed files.
27+
- **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.
28+
- **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.
29+
- **Code of Conduct**: The project adheres to the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). All contributors are expected to follow this code of conduct in all interactions related to the project.
30+
31+
## File Structure
32+
33+
```txt
34+
.azuredevops/ # Azure DevOps pipeline configuration and policy files.
35+
.github/ # GitHub Actions workflow files and linter configuration files.
36+
build/ # Miscellaneous build files and scripts.
37+
DirectXMesh/ # DirectXMesh implementation files.
38+
Utilities/ # Utility headers such as a WaveFront .obj file loader and a FVF converter.
39+
Meshconvert/ # CLI tool for importing WaveFront .obj files and converting to CMO, SDKMESH, or VBO formats.
40+
Tests/ # Tests are designed to be cloned from a separate repository at this location.
41+
```
42+
## Patterns
43+
44+
### Patterns to Follow
45+
46+
- Use RAII for all resource ownership (memory, file handles, etc.).
47+
- Many classes utilize the pImpl idiom to hide implementation details, and to enable optimized memory alignment in the implementation.
48+
- Use `std::unique_ptr` for exclusive ownership and `std::shared_ptr` for shared ownership.
49+
- Use `Microsoft::WRL::ComPtr` for COM object management.
50+
- Make use of anonymous namespaces to limit scope of functions and variables.
51+
- Make use of `assert` for debugging checks, but be sure to validate input parameters in release builds.
52+
53+
### Patterns to Avoid
54+
55+
- Don’t use raw pointers for ownership.
56+
- Avoid macros for constants—prefer `constexpr` or `inline` `const`.
57+
- Don’t put implementation logic in header files unless using templates, although the SimpleMath library does use an .inl file for performance.
58+
- Avoid using `using namespace` in header files to prevent polluting the global namespace.
59+
60+
## References
61+
62+
- [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)
63+
- [Microsoft Secure Coding Guidelines](https://learn.microsoft.com/en-us/security/develop/secure-coding-guidelines)
64+
- [CMake Documentation](https://cmake.org/documentation/)
65+
- [VCPK Documentation](https://learn.microsoft.com/vcpkg/)
66+
- [DirectXMesh Wiki](https://github.com/microsoft/DirectXMesh/wiki/)
67+
- [Games for Windows and the DirectX SDK blog - June 2014](https://walbourn.github.io/directxmesh/)
68+
- [Games for Windows and the DirectX SDK blog - April 2025](https://walbourn.github.io/github-project-updates-2025/)
69+
70+
## No speculation
71+
72+
When creating documentation:
73+
74+
### Document Only What Exists
75+
76+
* Only document features, patterns, and decisions that are explicitly present in the source code.
77+
* Only include configurations and requirements that are clearly specified.
78+
* Do not make assumptions about implementation details.
79+
80+
### Handle Missing Information
81+
82+
* Ask the user questions to gather missing information.
83+
* Document gaps in current implementation or specifications.
84+
* List open questions that need to be addressed.
85+
86+
### Source Material
87+
88+
* Always cite the specific source file and line numbers for documented features.
89+
* Link directly to relevant source code when possible.
90+
* Indicate when information comes from requirements vs. implementation.
91+
92+
### Verification Process
93+
94+
* Review each documented item against source code whenever related to the task.
95+
* Remove any speculative content.
96+
* Ensure all documentation is verifiable against the current state of the codebase.

0 commit comments

Comments
 (0)