1 =================================
2 User Guide for the DirectX Target
3 =================================
6 Disclaimer: The DirectX backend is experimental and under active development.
7 It is not yet feature complete or ready to be used outside of experimental or
8 demonstration contexts.
19 The DirectX target implements the DirectX programmability interfaces. These
20 interfaces are documented in the `DirectX Specifications. <https://github.com/Microsoft/DirectX-Specs>`_
22 Initially the backend is aimed at supporting DirectX 12, and support for DirectX
23 11 is planned at a later date.
25 The DirectX backend is currently experimental and is not shipped with any
26 release builds of LLVM tools. To enable building the DirectX backend locally add
27 ``DirectX`` to the ``LLVM_EXPERIMENTAL_TARGETS_TO_BUILD`` CMake option. For more
28 information on building LLVM see the :doc:`CMake` documentation.
30 .. _dx-target-triples:
35 At present the DirectX target only supports the ``dxil`` architecture, which
36 generates code for the
37 `DirectX Intermediate Language. <https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst>`_
39 In addition to target architecture, the DirectX backend also needs to know the
40 target runtime version and pipeline stage. These are expressed using the OS and
41 Environment triple component.
43 Presently the DirectX backend requires targeting the ``shadermodel`` OS, and
44 supports versions 6.0+ (at time of writing the latest announced version is 6.7).
46 .. table:: DirectX Environments
48 ================== ========================================================
49 Environment Description
50 ================== ========================================================
51 ``pixel`` Pixel shader
52 ``vertex`` Vertex shader
53 ``geometry`` Geometry shader
54 ``hull`` Hull shader (tesselation)
55 ``domain`` Domain shader (tesselation)
56 ``compute`` Compute kernel
57 ``library`` Linkable ``dxil`` library
58 ``raygeneration`` Ray generation (ray tracing)
59 ``intersection`` Ray intersection (ray tracing)
60 ``anyhit`` Ray any collision (ray tracing)
61 ``closesthit`` Ray closest collision (ray tracing)
62 ``miss`` Ray miss (ray tracing)
63 ``callable`` Callable shader (ray tracing)
65 ``amplification`` Amplification shader
66 ================== ========================================================
71 The DirectX runtime APIs read a file format based on the
72 `DirectX Specification. <https://github.com/Microsoft/DirectX-Specs>`_. In
73 different codebases the file format is referred to by different names
74 (specifically ``DXBC`` and ``DXILContainer``). Since the format is used to store
75 both ``DXBC`` and ``DXIL`` outputs, and the ultimate goal is to support both as
76 code generation targets in LLVM, the LLVM codebase uses a more neutral name,
79 The ``DXContainer`` format is sparsely documented in the functional
80 specification, but a reference implementation exists in the
81 `DirectXShaderCompiler. <https://github.com/microsoft/DirectXShaderCompiler>`_.
83 Support for generating ``DXContainer`` files in LLVM, is being added to the LLVM
84 MC layer for object streamers and writers, and to the Object and ObjectYAML
85 libraries for testing and object file tooling.
87 For ``dxil`` targeting, bitcode emission into ``DXContainer`` files follows a
88 similar model to the ``-fembed-bitcode`` flag supported by clang for other