diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Dev17.yml b/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Dev17.yml index 7e929db..43d67fb 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Dev17.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-CMake-Dev17.yml @@ -73,7 +73,7 @@ variables: - name: WIN10_SDK value: '10.0.19041.0' - name: WIN11_SDK - value: '10.0.22000.0' + value: '10.0.26100.0' pool: vmImage: windows-2022 diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml b/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml index c80cd1f..c9701a4 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-CMake.yml @@ -73,7 +73,7 @@ variables: - name: WIN10_SDK value: '10.0.19041.0' - name: WIN11_SDK - value: '10.0.22000.0' + value: '10.0.26100.0' pool: vmImage: windows-2022 diff --git a/.azuredevops/pipelines/DirectXTex-GitHub-MinGW.yml b/.azuredevops/pipelines/DirectXTex-GitHub-MinGW.yml index e396795..73ab826 100644 --- a/.azuredevops/pipelines/DirectXTex-GitHub-MinGW.yml +++ b/.azuredevops/pipelines/DirectXTex-GitHub-MinGW.yml @@ -77,7 +77,7 @@ variables: - name: VCPKG_MANIFEST_DIR value: '$(Build.SourcesDirectory)/build' - name: WIN11_SDK - value: '10.0.22000.0' + value: '10.0.26100.0' - name: BASE_URL value: https://github.com/brechtsanders/winlibs_mingw/releases/download - name: URL_MINGW32 diff --git a/.azuredevops/pipelines/DirectXTex-OneFuzz.yml b/.azuredevops/pipelines/DirectXTex-OneFuzz.yml index f519fe4..84063fe 100644 --- a/.azuredevops/pipelines/DirectXTex-OneFuzz.yml +++ b/.azuredevops/pipelines/DirectXTex-OneFuzz.yml @@ -32,7 +32,7 @@ name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) variables: Codeql.Enabled: false VS_GENERATOR: 'Visual Studio 17 2022' - WIN11_SDK: '10.0.22000.0' + WIN11_SDK: '10.0.26100.0' pool: vmImage: windows-2022 diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 7d56407..af4daff 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -23,7 +23,7 @@ These instructions define how GitHub Copilot should assist with this project. Th - **Documentation**: The project provides documentation in the form of wiki pages available at [Documentation](https://github.com/microsoft/DirectXTex/wiki/). - **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. - **Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxtextest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxtextest/wiki). -- **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. +- **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. - **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. - **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. - **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. @@ -70,11 +70,13 @@ Tests/ # Tests are designed to be cloned from a separate repository a ## References +- [Source git repository on GitHub](https://github.com/microsoft/DirectXTex.git) +- [DirectXTex documentation git repository on GitHub](https://github.com/microsoft/DirectXTex.wiki.git) +- [DirectXTex test suite git repository on GitHub](https://github.com/walbourn/directxtextest.wiki.git). - [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) - [Microsoft Secure Coding Guidelines](https://learn.microsoft.com/en-us/security/develop/secure-coding-guidelines) - [CMake Documentation](https://cmake.org/documentation/) -- [VCPK Documentation](https://learn.microsoft.com/vcpkg/) -- [DirectXTex Wiki](https://github.com/microsoft/DirectXTex/wiki/) +- [VCPKG Documentation](https://learn.microsoft.com/vcpkg/) - [Games for Windows and the DirectX SDK blog - October 2021](https://walbourn.github.io/directxtex/) - [Games for Windows and the DirectX SDK blog - April 2025](https://walbourn.github.io/github-project-updates-2025/) @@ -105,3 +107,49 @@ When creating documentation: - Review each documented item against source code whenever related to the task. - Remove any speculative content. - Ensure all documentation is verifiable against the current state of the codebase. + +## Cross-platform Support Notes + +- The code supports building for Windows and Linux. +- Portability and conformance of the code is validated by building with Visual C++, clang/LLVM for Windows, MinGW, and GCC for Linux. + +The following symbols are not custom error codes, but aliases for `HRESULT_FROM_WIN32` error codes. + +| Symbol | Standard Win32 HRESULT | +|--------|-------------| +| `HRESULT_ERROR_FILE_NOT_FOUND` | `HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)` | +| `HRESULT_E_ARITHMETIC_OVERFLOW` | `HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)` | +| `HRESULT_E_NOT_SUPPORTED` | `HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)` | +| `HRESULT_E_HANDLE_EOF` | `HRESULT_FROM_WIN32(ERROR_HANDLE_EOF)` | +| `HRESULT_E_INVALID_DATA` | `HRESULT_FROM_WIN32(ERROR_INVALID_DATA)` | +| `HRESULT_E_FILE_TOO_LARGE` | `HRESULT_FROM_WIN32(ERROR_FILE_TOO_LARGE)` | +| `HRESULT_E_CANNOT_MAKE` | `HRESULT_FROM_WIN32(ERROR_CANNOT_MAKE)`| + +## Code Review Instructions + +When reviewing code, focus on the following aspects: + +- Adherence to coding standards defined in `.editorconfig` and on the [wiki](https://github.com/microsoft/DirectXTK/wiki/Implementation). +- Make coding recommendations based on the *C++ Core Guidelines*. +- Proper use of RAII and smart pointers. +- Correct error handling practices and C++ Exception safety. +- Clarity and maintainability of the code. +- Adequate comments where necessary. +- Public interfaces located in `DirectXTex.h` should be clearly defined and documented on the GitHub wiki. +- Optional functions are located in `DirectXTexEXR.h`, `DirectXTexJPEG.h`, `DirectXTexPNG.h`, and `DirectXTexXbox.h` in the `Auxiliary` folder. +- Standalone modules for loading textures from DDS Files are located in `DDSTextureLoader9.h`, `DDSTextureLoader11.h`, and `DDSTextureLoader12.h` in the `DDSTextureLoader` folder. +- Standalone modules are loading textures using WIC are located in `WICTextureLoader9.h`, `WICTextureLoader11.h`, and `WICTextureLoader12.h` in the `WICTextureLoader` folder. +- Standalone modules for capturing screenshots are located in `ScreenGrab9.h`, `ScreenGrab11.h`, and `ScreenGrab12.h` in the `ScreenGrab` folder. +- Compliance with the project's architecture and design patterns. +- Ensure that all public functions and classes are covered by unit tests located on [GitHub](https://github.com/walbourn/directxtextest.git) where applicable. Report any gaps in test coverage. +- Check for performance implications, especially in geometry processing algorithms. +- Provide brutally honest feedback on code quality, design, and potential improvements as needed. + +## Documentation Review Instructions + +When reviewing documentation, do the following: + +- Read the code located in [this git repository](https://github.com/microsoft/DirectXTex.git) in the main branch. +- Review the public interface defined in `DirectXTex.h`. +- Read the documentation on the wiki located in [this git repository](https://github.com/microsoft/DirectXTex.wiki.git). +- Report any specific gaps in the documentation compared to the public interface diff --git a/.gitignore b/.gitignore index 19338fe..30b8368 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ *.VC.db *.nupkg .vs +.vscode [Bb]in packages /DDSView/Shaders/*.inc diff --git a/CMakeLists.txt b/CMakeLists.txt index c211d9c..89592d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,8 @@ option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" OFF) option(ENABLE_CODE_COVERAGE "Build with code-coverage" OFF) +option(ENABLE_CODE_PROFILING "Build for profiling" OFF) + option(USE_PREBUILT_SHADERS "Use externally built HLSL shaders" OFF) option(NO_WCHAR_T "Use legacy wide-character as unsigned short" OFF) @@ -616,6 +618,13 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") endforeach() endif() + if(ENABLE_CODE_PROFILING) + message(STATUS "Building with /PROFILE") + foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) + target_link_options(${t} PRIVATE /profile) + endforeach() + endif() + if(ENABLE_SPECTRE_MITIGATION AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.13) AND (NOT ENABLE_OPENEXR_SUPPORT)