DirectXShaderCompiler/lib/DxrFallback
Tex Riddell f4965b71dd Integrate dxcapi v2 and other changes from internal (#2575)
* Integrate changes from internal.

- dxcapi v2
- new dxc options
- DxilValueCache
- PDB and NoOpt improvements
- noop / llvm::donothing() support

* Update dxrfallbacklayer for dxcapi internal changes

* Reorder diag block based on whether pDiag is set first.

* llvm::donothing() requires dxil 1.6 / SM 6.6 for now, lib as well.

* Fixes for spir-v, non-VC compiler and non-Windows builds

- DEFINE_CROSS_PLATFORM_UUIDOF for new interfaces
- add SAL annotations
- turn output argument validation for -P into warning
- handle warnings without concatenating them to main output
- update spirv preprocessing and compilation paths
- return E_NOTIMPL from IDxcUtils::CreateReflection
- cleanup: DxcContainerBuilder back to uft8, DxcTestUtils: remove comment

* Fix some warnings from clang/gcc.

* Fix unicode conversion problems on linux, where sizeof(wchar_t) == 4

Note this is an intermediate fix.
On linux, what we are calling utf16 is actually a wide string
that's probably utf32.  This change fixes issues introduced by
the new interface changes so things are consistent and pass tests.

A future fix should correct the encodings so they are correctly labeled
on platforms where wchar_t doesn't mean UTF16.

* Return false for IsBufferNullTerminated when CP_ACP.

One test for Disassembler was crashing because it created a pinned blob
with a size of 1 << 31 + 1 without actual memory backing this.  The
IsBufferNullTerminated would attempt to see if this was null terminated,
causing AV.

This change also removes CP_UTF8 from this test when it was creating
binary blobs, not UTF8 text blobs.
2019-11-13 16:16:45 -08:00
..
runtime Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
CMakeLists.txt Fix dependencies for DxrFallback. (#1582) 2018-10-04 17:34:47 -04:00
DxrFallbackCompiler.cpp Move DxilModule into DXIL directory. (#1599) 2018-10-16 00:28:35 -07:00
FunctionBuilder.h Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
LLVMBuild.txt Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
LLVMUtils.cpp Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
LLVMUtils.h Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
LiveValues.cpp Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
LiveValues.h Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
Reducibility.cpp Revert "Fix various Clang compiler warnings (#1558)" 2018-09-21 14:18:28 -04:00
Reducibility.h Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
StateFunctionTransform.cpp Integrate dxcapi v2 and other changes from internal (#2575) 2019-11-13 16:16:45 -08:00
StateFunctionTransform.h Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
readme.md Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00
runtime.h Merged PR 98: Adding a DxrFallbackCompiler.dll containing IDxcDxrFallbackCompiler implementation + tests 2018-06-29 23:43:40 +00:00

readme.md

DXR Fallback Compiler

The DXR Fallback Compiler is a specialized compiler that's a part of the D3D12 Raytracing Fallback Layer. The purpose of the DXR Fallback Compiler is to take input DXR shader libs and link them into a single compute shader that is runnable DX12 hardware (even without DXR driver support).

Building the DXR Fallback Compiler

In order to build the DXR Fallback Compiler in Visual Studio, simply build the dxrfallbackcompiler project in the Clang Libraries folder.

Using with the D3D12 Raytracing Fallback Layer

To use the DXR Fallback Compiler with the DirectX Graphics Samples, build a dxrfallbackcompiler.dll using the Build instructions and place the output dll in Samples/Desktop/D3D12Raytracing/tools/x64.

If you're incorporating the Fallback Layer into your own personal project, you need to ensure that the dll is either alongside your executable or in the working directory.

Overview

Note that the below overview and all proceeding documentation assumes familiarity with the DirectX Raytracing API.

The DXR Fallback Compiler addresses several challenges that native DX12 compute shaders are not normally capable of handling:

  • Combining multiple orthogonal shaders into a single large compute shader
  • Uses of all new DXR HLSL intrinsics
  • Invocation of another shader in the middle of shader code - i.e. TraceRay and CallShader
  • Recursive invocations of shader calls

These challenges are handled by abstractly viewing GPU execution of a DXR pipeline as State Machine traversal, where each shader is transformed into one or more state functions. further technical details are described in the header of StateFunctionTransform.h.

Building runtime.h

Download LLVM 3.7: http://releases.llvm.org/3.7.0/LLVM-3.7.0-win64.exe You may need to adjust BINPATH in script.cmd to point to your llvm binaries Run script.cmd and it should output a patched runtime.h