Investigating DIXL error in Raytracing CreateStateObject

Hi there. A crashing error appeared today as I’m trying to get raytracing working in a game that’s on 4.25-Plus, with some modifications pulled from Nvidia’s NVRTX github. Thus it’s probably something specific to my code. So I’m mostly looking for tips on how to investigate, rather than someone just knowing what the issue is. It happens when trying to load some of the D3D12 raytracing shaders.

The default error is E_INVALIDARG.

The -dxdebug error is:

“ID3D12Device::CreateStateObject: Hash check failed for DXILibrary.pShaderBytecode: 0x0000022A07928700. A typical cause of this is unsigned bytecode. To enable signing by the compiler, ensure DXIL.dll is next to DxCompiler.dll.”

The callstack is:

UE4Editor-D3D12RHI.dll!CreateRayTracingStateObject(ID3D12Device5 * RayTracingDevice, const TArrayView<FDXILLibrary const *> & ShaderLibraries, const TArrayView<wchar_t const *> & Exports, unsigned int MaxPayloadSizeInBytes, const TArrayView<D3D12_HIT_GROUP_DESC const> & HitGroups, const ID3D12RootSignature * GlobalRootSignature, const TArrayView<ID3D12RootSignature *> & LocalRootSignatures, const TArrayView<unsigned int> & LocalRootSignatureAssociations, const TArrayView<D3D12_EXISTING_COLLECTION_DESC> & ExistingCollections, D3D12_STATE_OBJECT_TYPE StateObjectType) Line 370	C++
UE4Editor-D3D12RHI.dll!FD3D12RayTracingPipelineCache::FShaderCompileTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 622	C++
UE4Editor-D3D12RHI.dll!TGraphTask<FD3D12RayTracingPipelineCache::FShaderCompileTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread) Line 849	C++
[Inline Frame] UE4Editor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 516	C++
UE4Editor-Core.dll!FTaskThreadAnyThread::ProcessTasks() Line 1039	C++
UE4Editor-Core.dll!FTaskThreadAnyThread::ProcessTasksUntilQuit(int QueueIndex) Line 863	C++
[Inline Frame] UE4Editor-Core.dll!FTaskThreadBase::Run() Line 528	C++

Any tips on how to investigate this? I confirmed that I have DXIL.dll next to each DxCompiler.dll on my machine. I deleted all of my DerivedDataCache folders to trigger a rebuild of all the shaders, to no avail. I had everything running last week, and didn’t change anything significant that I can recall since then. The shader being compiled is MaterialCHS.

Did you find an answer for this?

You can get a more verbose D3D log if you add the command line d3debug
Go to your project Properties->Debugging and add a command argument -d3debug
Make sure the configuration on top is set on those that are active

Also, make sure to remove it afterwards because it will reduce the FPS (though only when running from solution)

I have the same issue BTW and I got the following error

D3D12 ERROR: ID3D12Device::CreateStateObject: Resource bindings for function "RayGen_cd39b89c977a639d" not compatible with associated root signatures (if any): local root signature object: 0x0000021AF52AA730:'Unnamed ID3D12RootSignature Object', global root signature object: 0x0000021A8932F420:'Unnamed ID3D12RootSignature Object'. Error detail: Shader CBV descriptor range (BaseShaderRegister=0, NumDescriptors=1, RegisterSpace=0) is not fully bound in a root signature. If the intent is this will be resolved later when this state object is combined with other state object(s), use a D3D12_STATE_OBJECT_CONFIG subobject with D3D12_STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS set in Flags. [ STATE_CREATION ERROR #1194: CREATE_STATE_OBJECT_ERROR]
D3D12: **BREAK** enabled for the previous message, which was: [ ERROR STATE_CREATION #1194: CREATE_STATE_OBJECT_ERROR ]
Exception thrown at 0x00007FFA646ECB69 (KernelBase.dll) in UnrealEditor.exe: 0x0000087A (parameters: 0x0000000000000001, 0x00000035733FBD50, 0x00000035733FDB10).
[2023.04.20-07.53.39:465][167]LogD3D12RHI: Error: ID3D12Device::CreateStateObject: Resource bindings for function "RayGen_cd39b89c977a639d" not compatible with associated root signatures (if any): local root signature object: 0x0000021AF52AA730:'Unnamed ID3D12RootSignature Object', global root signature object: 0x0000021A8932F420:'Unnamed ID3D12RootSignature Object'. Error detail: Shader CBV descriptor range (BaseShaderRegister=0, NumDescriptors=1, RegisterSpace=0) is not fully bound in a root signature. If the intent is this will be resolved later when this state object is combined with other state object(s), use a D3D12_STATE_OBJECT_CONFIG subobject with D3D12_STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS set in Flags.
UnrealEditor.exe has triggered a breakpoint.

I managed to solve my issue
I made a tutorial on how make a custom RT as a plugin, maybe you could find a solution there