commit | b2b6d5a2b61501e62f3edec1df4b8892e6b2e91a | [log] [tgz] |
---|---|---|
author | Xiang Li <xiagli@microsoft.com> | Thu Aug 17 19:25:46 2017 |
committer | Xiang Li <python3kgae@outlook.com> | Fri Aug 18 22:13:17 2017 |
tree | aa5f95f4e6349d84f41b6b9975202868aae8a258 | |
parent | 0d11e1674a8bf8be57dd705bde40297b76e24b31 [diff] |
Support findInjectedSource (#573)
The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation. Applications that make use of DirectX for graphics, games, and computation can use it to generate shader programs.
For more information, see the Wiki.
The starting point of the project is a fork of the LLVM and Clang projects, modified to accept HLSL and emit a validated container that can be consumed by GPU drivers.
At the moment, the DirectX HLSL Compiler provides the following components:
dxc.exe, a command-line tool that can compile shader model 6 HLSL programs
dxcompiler.dll, a DLL providing a componentized compiler, assembler, disassembler, and validator
various other tools based on the above components
The DirectX Shader Compiler is currently in preview stage but is expected to be finalized in the next few months. The Microsoft Windows SDK releases will include a supported version of the compiler and validator.
The goal of the project is to allow the broader community of shader developers to contribute to the language and representation of shader programs, maintaining the principles of compatibility and supportability for the platform. It's currently in active development across two axes: language evolution (with no impact to DXIL representation), and surfacing hardware capabilities (with impact to DXIL, and thus requiring coordination with GPU implementations).
Before you build, you will need to have some additional software installed.
utils\hct\hctgettaef.py
from your build environment before you start building to download and unzip them as an external dependency. Alternatively, install the Windows Driver Kit. No need to download and install tests. This is used to build and run tests.To setup the build environment run the utils\hct\hctstart.cmd
script passing the path to the source and build directories from a regular command prompt window. For example:
git clone https://github.com/Microsoft/DirectXShaderCompiler.git C:\DirectXShaderCompiler cd C:\DirectXShaderCompiler utils\hct\hctstart.cmd C:\DirectXShaderCompiler C:\DirectXShaderCompiler.bin
To create a shortcut to the build environment with the default build directory, double-click on the utils\hct\hctshortcut.js
file.
To build, open the HLSL Console and run this command.
hctbuild
You can also clean, build and run tests with this command.
hctcheckin
To see a list of additional commands available, run hcthelp
You can build with vs2017 either on the command line or using the new integrated CMake support.
To build from the command line follow the normal build steps, but pass -vs2017
as a parameter to hctbuild
.
To build using the integrated cmake support, simply start Visual Studio and open the folder where you have the source. From the CMake menu select “Build CMakeLists.txt”
By default the binaries will be built in %LOCALAPPDATA%\CMakeBuild\DirectXShaderCompiler\build{build-flavor}. The build location can be changed by editing the CMakeSettings.json
file.
You can then use the build directory in the hctstart
script to test the build. For example,
hctstart C:\source\DirectXShaderCompiler %LOCALAPPDATA%\CMakeBuild\DirectXShaderCompiler\build\x64-Debug
To build with Ninja, please make sure that you have ninja
and cl
in your %PATH%
. ninja
can be installed from here; cl
should already be installed together with Visual Studio and can be exported to %PATH%
via the vcvars*.bat
script in Visual Studio's VC build directory.
To configure cmake with Ninja generator,
hctbuild -s -ninja
To build with Ninja, go to the binary directory and run ninja
directly or
hctbuild -b -ninja
To run tests, open the HLSL Console and run this command after a successful build.
hcttest
Some tests will run shaders and verify their behavior. These tests also involve a driver that can run these execute these shaders. See the next section on how this should be currently set up.
If you use Ninja to build the project, please make sure to supply -ninja
to hcttest
for testing.
To run shaders compiled as DXIL, you will need support from the operating system as well as from the driver for your graphics adapter.
At the moment, the Windows 10 Insider Preview Build 15007 is able to run DXIL shaders.
Drivers indicate they can run DXIL by reporting support for Shader Model 6, possibly in experimental mode. To enable support in these cases, the Developer mode setting must be enabled.
Hardware GPU support for DXIL is provided by the following vendors:
NVIDIA's new r381 drivers (r381.65 and later) provide experimental mode support for DXIL 1.0 and Shader Model 6.0. Here are the release notes, and a download link.
AMD's latest driver with support for DXIL 1.0 and Shader Model 6 in experimental mode is Radeon Software Crimson ReLive Edition 17.4.2.
In the absence of hardware support, tests will run using the Windows Advanced Rasterization Platform (WARP) adapter. To get the correct version of WARP working, in addition to setting Developer mode, you should install the ‘Graphics Tools’ optional feature via the Settings app (click the ‘Apps’ icon, then the ‘Manage optional features’ link, then ‘Add a feature’, and select ‘Graphics Tools’ from the list).
For more information, see this Wiki page.
To make contributions, see the CONTRIBUTING.md file in this project.
You can find documentation for this project in the docs
directory. These contain the original LLVM documentation files, as well as two new files worth nothing:
DirectX Shader Compiler is distributed under the terms of the University of Illinois Open Source License.
See LICENSE.txt and ThirdPartyNotices.txt for details.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.