Differences with lib_6_1 vs lib_6_3 when compiling the same CHS
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).
Lib_6_1 doesn't even exist anymore. This was an artifact of DXR development that has long been resolved.
@zigguratvertigo I understand this is quite old. But where exactly do you switch it from lib_6_1 to lib_6_3?