98 lines · plain
1=================================2User Guide for the DirectX Target3=================================4 5.. warning::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 or8 demonstration contexts.9 10.. contents::11 :local:12 13.. toctree::14 :hidden:15 16 DirectX/DXContainer17 DirectX/DXILArchitecture18 DirectX/DXILOpTableGenDesign19 DirectX/DXILResources20 DirectX/RootSignatures21 22Introduction23============24 25The DirectX target implements the DirectX programmability interfaces. These26interfaces are documented in the `DirectX Specifications. <https://github.com/Microsoft/DirectX-Specs>`_27 28Initially the backend is aimed at supporting DirectX 12, and support for DirectX2911 is planned at a later date.30 31The DirectX backend is currently experimental and is not shipped with any32release builds of LLVM tools. To build the DirectX backend locally, add33``DirectX`` to the ``LLVM_EXPERIMENTAL_TARGETS_TO_BUILD`` CMake option. For more34information on building LLVM see the :doc:`CMake` documentation.35 36.. _dx-target-triples:37 38Target Triples39==============40 41At present, the DirectX target only supports the ``dxil`` architecture, which42generates code for the43`DirectX Intermediate Language. <https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst>`_44 45In addition to target architecture, the DirectX backend also needs to know the46target runtime version and pipeline stage. These are expressed using the OS and47Environment triple component.48 49Presently, the DirectX backend requires targeting the ``shadermodel`` OS, and50supports versions 6.0+ (as of writing, the latest announced version is 6.7).51 52.. table:: DirectX Environments53 54 ================== ========================================================55 Environment Description56 ================== ========================================================57 ``pixel`` Pixel shader58 ``vertex`` Vertex shader59 ``geometry`` Geometry shader60 ``hull`` Hull shader (tesselation)61 ``domain`` Domain shader (tesselation)62 ``compute`` Compute kernel63 ``library`` Linkable ``dxil`` library64 ``raygeneration`` Ray generation (ray tracing)65 ``intersection`` Ray intersection (ray tracing)66 ``anyhit`` Ray any collision (ray tracing)67 ``closesthit`` Ray closest collision (ray tracing)68 ``miss`` Ray miss (ray tracing)69 ``callable`` Callable shader (ray tracing)70 ``mesh`` Mesh shader71 ``amplification`` Amplification shader72 ================== ========================================================73 74Output Binaries75===============76 77The DirectX runtime APIs read a file format based on the78`DirectX Specification. <https://github.com/Microsoft/DirectX-Specs>`_. In79different codebases the file format is referred to by different names80(specifically ``DXBC`` and ``DXILContainer``). Since the format is used to store81both ``DXBC`` and ``DXIL`` outputs, and the ultimate goal is to support both as82code generation targets in LLVM, the LLVM codebase uses a more neutral name,83``DXContainer``.84 85The ``DXContainer`` format is sparsely documented in the functional86specification, but a reference implementation exists in the87`DirectXShaderCompiler. <https://github.com/microsoft/DirectXShaderCompiler>`_.88The format is documented in the LLVM project docs as well (see89:doc:`DirectX/DXContainer`).90 91Support for generating ``DXContainer`` files in LLVM, is being added to the LLVM92MC layer for object streamers and writers, and to the Object and ObjectYAML93libraries for testing and object file tooling.94 95For ``dxil`` targeting, bitcode emission into ``DXContainer`` files follows a96similar model to the ``-fembed-bitcode`` flag supported by clang for other97targets.98