|
| 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**: Math Library / DirectX / Direct3D |
| 8 | +- **Project Name**: DirectXMath SIMD C++ linear algebra library |
| 9 | +- **Language**: C++ |
| 10 | +- **Framework / Libraries**: STL / CMake / CTest |
| 11 | + |
| 12 | +## Getting Started |
| 13 | + |
| 14 | +- See the Getting Started guide on [Microsoft Learn](https://learn.microsoft.com/windows/win32/dxmath/pg-xnamath-getting-started). |
| 15 | +- The recommended way to integrate *DirectXMath* into your project is by using the *vcpkg* Package Manager. |
| 16 | +- You can make use of the nuget.org package **directxmath**. |
| 17 | +- You can also use the library source code directly in your project or as a git submodule. |
| 18 | +- The Windows SDK includes the DirectXMath library, although that version is not as up-to-date as other integration methods. |
| 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/DirectXMath/wiki/Implementation). The code requires C++11/C++14 features. |
| 23 | +- **Documentation**: The project provides documentation on [Microsoft Learn](https://learn.microsoft.com/windows/win32/dxmath/directxmath-portal) with additional wiki pages available on [GitHub](https://github.com/microsoft/DirectXMath/wiki/). |
| 24 | +- **Error Handling**: The majority of functions have no error conditions and do not throw C++ exceptions which is why they are marked `noexcept`. A few functions have `bool` results to indicate success or failure. |
| 25 | +- **Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxmathtest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxmathtest/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. |
| 27 | +- **Dependencies**: The project has minimal dependencies, primarily relying on compiler intrinsics. It is designed to be self-contained and portable across different platforms and toolsets. |
| 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 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 | +.nuget/ # NuGet package configuration files. |
| 37 | +build/ # Miscellaneous build files and scripts. |
| 38 | +Inc/ # DirectXMath public and implementation files. The library is header-only, so all files are in this directory. |
| 39 | +Extensions/ # Extensions to the DirectXMath library with standalone SSE-level specific functions for runtime selection of SIMD instruction set. |
| 40 | +MatrixStack/ # D3DX9-like matrix stack implementation for DirectXMath. |
| 41 | +SHMath/ # Spherical harmonic functions using DirectXMath. |
| 42 | +Stereo3D/ # Stereo 3D projection matrix functions using DirectXMath created for HoloLens. |
| 43 | +XDSP/ # Digital Signal Processing (DSP) functions using DirectXMath. |
| 44 | +Tests/ # Tests are designed to be cloned from a separate repository at this location. |
| 45 | +``` |
| 46 | + |
| 47 | +> The `Extensions` are not needed if building the library using `/arch:AVX` or `/arch:AVX2` which causes the DirectXMath library to build utilizing the additional SIMD instructions. |
| 48 | +
|
| 49 | +## References |
| 50 | + |
| 51 | +- [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) |
| 52 | +- [Microsoft Secure Coding Guidelines](https://learn.microsoft.com/en-us/security/develop/secure-coding-guidelines) |
| 53 | +- [CMake Documentation](https://cmake.org/documentation/) |
| 54 | +- [VCPK Documentation](https://learn.microsoft.com/vcpkg/) |
| 55 | +- [DirectXMath Documentation](https://learn.microsoft.com/windows/win32/dxmath/directxmath-portal) |
| 56 | +- [DirectXMath Wiki](https://github.com/microsoft/DirectXMath/wiki/) |
| 57 | +- [Games for Windows and the DirectX SDK blog - March 2012](https://walbourn.github.io/introducing-directxmath/) |
| 58 | + |
| 59 | +## No speculation |
| 60 | + |
| 61 | +When creating documentation: |
| 62 | + |
| 63 | +### Document Only What Exists |
| 64 | + |
| 65 | +- Only document features, patterns, and decisions that are explicitly present in the source code. |
| 66 | +- Only include configurations and requirements that are clearly specified. |
| 67 | +- Do not make assumptions about implementation details. |
| 68 | + |
| 69 | +### Handle Missing Information |
| 70 | + |
| 71 | +- Ask the user questions to gather missing information. |
| 72 | +- Document gaps in current implementation or specifications. |
| 73 | +- List open questions that need to be addressed. |
| 74 | + |
| 75 | +### Source Material |
| 76 | + |
| 77 | +- Always cite the specific source file and line numbers for documented features. |
| 78 | +- Link directly to relevant source code when possible. |
| 79 | +- Indicate when information comes from requirements vs. implementation. |
| 80 | + |
| 81 | +### Verification Process |
| 82 | + |
| 83 | +- Review each documented item against source code whenever related to the task. |
| 84 | +- Remove any speculative content. |
| 85 | +- Ensure all documentation is verifiable against the current state of the codebase. |
0 commit comments