DirectX 12 Headers for Freepascal
Tested and compatible with latest FPC snapshot compiler 3.3.1 in 2025. Based on Microsoft SDK headers from Oct 2018
The files are available under Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
These headers are a fork of the headers at CMCHTPC/DelphiDX12.
Specifically, I'm focused on:
- Perfect compatibility with current Freepascal (3.3.1) compiler
This means no Errors, Hints, Warnings, or Notes generated by FPC 3.3.1.
Unfortunately some of Microsoft's C++ headers cannot be perfectly mapped to FPC's capabilities (for example, enumerations which have aliased values with the same ordinal value - like D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST and D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST).
In cases like these, I've deliberately changed the enumerations, removing the duplicate values.
- Fixed errors in interface definitions in the CMCHTPC library
Some intefaces - especially ID3D11InfoQueue, had incorrectly defined "out" parameters; the API requires users to pass NIL to some of these interfaces to retrieve information, but this isn't possible in FPC when they're defined as an 'out' parameter - I fixed the interfaces.
- Focused on Direct3D11 support
I haven't tested any of the Direct3D12-specific code; I'm only interested in Direct3D11. If anyone else is interested in updating the D3D12 code to work properly with FPC, you should be able to easily do this by looking at the changes made to D3D11 code here.