-
Notifications
You must be signed in to change notification settings - Fork 808
Description
Description
query.CommittedRayT() is defined to be initialized to RayDesc::TMax, however, DXC converts this call directly to OpRayQueryGetIntersectionTKHR with an intersection type of RayQueryCommittedIntersectionKHR about which the extension specification states
If Intersection is RayQueryCommittedIntersectionKHR, behavior is undefined if there is no current committed intersection
In a case such as
RaytracingAccelerationStructure g_AS;
[numthreads(1, 1, 1)]
void CSMain()
{
RayQuery<RAY_FLAG_NONE> query;
RayDesc desc = (RayDesc)0;
query.TraceRayInline(g_AS, 0, 0, desc);
float unused = query.CommittedRayT();
}this will always be undefined behavior in spirv, when what is returned should be TMax (zero in this case).
This could be a problem in the spirv specification, because the Vulkan spec in one case assumes that this is defined too. Alternatively, I could have missed something somewhere that makes this defined (but I can't find any in the Vulkan environment for spirv or in the extension spec itself).
Steps to Reproduce
See https://godbolt.org/z/xGxb8GPf8
Actual Behavior
OpRayQueryInitializeKHR %18 %19 %uint_0 %uint_0 %15 %16 %15 %16
%20 = OpRayQueryGetIntersectionTKHR %float %18 %uint_1
is outputted, which according to the spirv specification has undefined behavior if hit.
Environment
- DXC version libdxcompiler.so: 1.9(dev;1-9efbb6c3); libdxil.so: 1.9 (version from godbolt)
- Host Operating System N/A
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status