ScrappyCocco / DirectX-DXR-Tutorials

Personal repository of tutorials and examples to understand the basics of DirectX 12 Raytracing (DXR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Projects 01, 02, 03 have a runtime warning

ScrappyCocco opened this issue · comments

Project 3 (Per Instance Data) throws the following warnign at runtime:

D3D12 ERROR: ID3D12CommandList::DispatchRays: pDesc->HitGroupTable.StartAddress must be aligned to 64 bytes (D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT) and .StrideInBytes must be aligned to 32 bytes (D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT). [ EXECUTION ERROR #1161: DISPATCH_RAYS_INVALID]

Update: The same error appear in tutorial 01 and 02 when using the DXR pipeline instead of the rasterizer

That error tho doesn't appear in tutorial 04 and 05, maybe with the introduction of shadows(?)

The problem is most likely in this section here, that has broken sizes: D3D12HelloTriangle.cpp#L396

But fixing the alignment there doesn't work, as the shader table probably is mis-aligned too

image

it's not a warning, it's an error. and it's not fixed by adding padding as such

struct HitInfo {
  float4 colorAndDistance;
  float4 padding__;
};

adding a table for the miss shader fixed it. I put a dummy float4 as CBV. it's a pain because it requires a full fledged desc heap.
weird choice from DX spec this alignment that can't be obtained with simplistic shaders.

adding a table for the miss shader fixed it. I put a dummy float4 as CBV. it's a pain because it requires a full fledged desc heap.
weird choice from DX spec this alignment that can't be obtained with simplistic shaders.

This is good to know, but is not important anymore...(?)
As you can see from the log, the issue has been fixed and closed with a commit, that problem is no longer present in my code