DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

Differences with lib_6_1 vs lib_6_3 when compiling the same CHS

Open zigguratvertigo opened this issue 8 years ago • 2 comments

During our transition from RS4 to RS5, we've switched from lib_6_1 to lib_6_3 for DXR shaders.

On RS5, shader compilation with lib_6_1 passes (no compilation errors), but at load time you get this error: D3D12 ERROR: ID3D12Device::CreateStateObject: Hash check failed for DXILibrary.pShaderBytecode

The only way to fix the hash check issue was to switch to lib_6_3. An error now appears during compilation, related to using .Sample(...) in a closest hit shader:

Failed compiling shader: error: validation errors
at 0x2a6d0ed8e60 inside block #0 of function ?translucencyHit@@YAXUHitData@@UBuiltInTriangleIntersectionAttributes@@@Z Opcode Sample not valid in shader model lib_6_3(closesthit)

This error is correct, since .Sample(...) doesn't make sense because of lack of derivatives. This can be fixed by .SampleLevel(..., 0);

I would assume the same error should appear in lib_6_1 since this call is not valid, unless in 6_1 the compiler automaticall converts a .Sample(...) call in a closest hit shader to a .SampleLevel(..., 0).

zigguratvertigo avatar Nov 22 '18 23:11 zigguratvertigo

Lib_6_1 doesn't even exist anymore. This was an artifact of DXR development that has long been resolved.

pow2clk avatar Sep 11 '20 21:09 pow2clk

@zigguratvertigo I understand this is quite old. But where exactly do you switch it from lib_6_1 to lib_6_3?

VigneshMohan1698 avatar Aug 12 '22 18:08 VigneshMohan1698