diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/ray-tracing-inline.slang | 47 | ||||
| -rw-r--r-- | tests/compute/ray-tracing-inline.slang.expected.txt | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/compute/ray-tracing-inline.slang b/tests/compute/ray-tracing-inline.slang new file mode 100644 index 000000000..94e0a4f87 --- /dev/null +++ b/tests/compute/ray-tracing-inline.slang @@ -0,0 +1,47 @@ +//TEST(compute):COMPARE_COMPUTE:-d3d12 -output-using-type -use-dxil -profile sm_6_5 -render-feature ray-tracing +//TEST(compute):COMPARE_COMPUTE:-vk -output-using-type -render-feature ray-tracing + +//TEST_INPUT: set scene = AccelerationStructure +uniform RaytracingAccelerationStructure scene; + +//TEST_INPUT:set outputBuffer = out ubuffer(data=[0], stride=4) +RWStructuredBuffer<float> outputBuffer; + +bool traceRayClosestHit( + float3 rayOrigin, + float3 rayDir, + out float t) +{ + RayDesc ray; + ray.Origin = rayOrigin; + ray.TMin = 0.01f; + ray.Direction = rayDir; + ray.TMax = 1e4f; + RayQuery<RAY_FLAG_NONE> q; + let rayFlags = RAY_FLAG_NONE; + + q.TraceRayInline( + scene, + rayFlags, + 0xff, + ray); + + q.Proceed(); + if(q.CommittedStatus() == COMMITTED_TRIANGLE_HIT) + { + t = q.CommittedRayT(); + //primitiveIndex = q.CommittedPrimitiveIndex(); + return true; + } + return false; +} + +[shader("compute")] +[numthreads(1,1,1)] +void computeMain( + uint3 threadIdx : SV_DispatchThreadID) +{ + float t = 0.0; + traceRayClosestHit(float3(0.1, 0.1, 0.0), float3(0,0,1), t); + outputBuffer[threadIdx.x] = t; +}
\ No newline at end of file diff --git a/tests/compute/ray-tracing-inline.slang.expected.txt b/tests/compute/ray-tracing-inline.slang.expected.txt new file mode 100644 index 000000000..26a60c923 --- /dev/null +++ b/tests/compute/ray-tracing-inline.slang.expected.txt @@ -0,0 +1,2 @@ +type: float +0.5 |
