Skip to content

Latest commit

 

History

History
96 lines (76 loc) · 3.82 KB

DirectXUsage.rst

File metadata and controls

96 lines (76 loc) · 3.82 KB

User Guide for the DirectX Target

Warning

Disclaimer: The DirectX backend is experimental and under active development. It is not yet feature complete or ready to be used outside of experimental or demonstration contexts.

.. toctree:: :hidden: DirectX/DXContainer DirectX/DXILArchitecture DirectX/DXILOpTableGenDesign DirectX/DXILResources 

The DirectX target implements the DirectX programmability interfaces. These interfaces are documented in the DirectX Specifications.

Initially the backend is aimed at supporting DirectX 12, and support for DirectX 11 is planned at a later date.

The DirectX backend is currently experimental and is not shipped with any release builds of LLVM tools. To enable building the DirectX backend locally add DirectX to the LLVM_EXPERIMENTAL_TARGETS_TO_BUILD CMake option. For more information on building LLVM see the :doc:`CMake` documentation.

At present the DirectX target only supports the dxil architecture, which generates code for the DirectX Intermediate Language.

In addition to target architecture, the DirectX backend also needs to know the target runtime version and pipeline stage. These are expressed using the OS and Environment triple component.

Presently the DirectX backend requires targeting the shadermodel OS, and supports versions 6.0+ (at time of writing the latest announced version is 6.7).

DirectX Environments
EnvironmentDescription
pixelPixel shader
vertexVertex shader
geometryGeometry shader
hullHull shader (tesselation)
domainDomain shader (tesselation)
computeCompute kernel
libraryLinkable dxil library
raygenerationRay generation (ray tracing)
intersectionRay intersection (ray tracing)
anyhitRay any collision (ray tracing)
closesthitRay closest collision (ray tracing)
missRay miss (ray tracing)
callableCallable shader (ray tracing)
meshMesh shader
amplificationAmplification shader

The DirectX runtime APIs read a file format based on the DirectX Specification.. In different codebases the file format is referred to by different names (specifically DXBC and DXILContainer). Since the format is used to store both DXBC and DXIL outputs, and the ultimate goal is to support both as code generation targets in LLVM, the LLVM codebase uses a more neutral name, DXContainer.

The DXContainer format is sparsely documented in the functional specification, but a reference implementation exists in the DirectXShaderCompiler.. The format is documented in the LLVM project docs as well (see :doc:`DirectX/DXContainer`).

Support for generating DXContainer files in LLVM, is being added to the LLVM MC layer for object streamers and writers, and to the Object and ObjectYAML libraries for testing and object file tooling.

For dxil targeting, bitcode emission into DXContainer files follows a similar model to the -fembed-bitcode flag supported by clang for other targets.

close