diff options
| author | Yong He <yonghe@outlook.com> | 2021-07-08 13:55:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-08 13:55:21 -0700 |
| commit | aba2731f0427a04a119a59567e6715ba4034920a (patch) | |
| tree | b5b127f776db65c7154c31a41f1e91eaeb738503 /tests | |
| parent | 09950676b3f73bb9967aea183d27a30d63098475 (diff) | |
Allow render-test to run inline ray tracing tests. (#1903)
* Update VS projects to 2019.
* Empty commit to trigger build
* Implement gfx inline ray tracing on D3D12.
* Allow render-test to run inline ray tracing tests.
Co-authored-by: Yong He <yhe@nvidia.com>
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 |
