Skip to content

Cover ClosestHit ray system values: barycentrics, PrimitiveIndex, WorldRay#1278

Merged
EmilioLaiso merged 1 commit into
llvm:mainfrom
Traverse-Research:rt-pso-tests-closest-hit-rsvs
Jun 26, 2026
Merged

Cover ClosestHit ray system values: barycentrics, PrimitiveIndex, WorldRay#1278
EmilioLaiso merged 1 commit into
llvm:mainfrom
Traverse-Research:rt-pso-tests-closest-hit-rsvs

Conversation

@MarijnS95

@MarijnS95 MarijnS95 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Depends on #1281

Summary

Three small PSO raytracing tests stacked on #1275, each isolating one shader-observable closest-hit system value from #1268's 👍 list. Same shape as the prior batch in #1277 — one .test file per behavior, single-purpose shader, exact buffer comparison.

  • closest-hit-barycentrics.test — 3-lane dispatch, each lane fires at a clearly-interior point of the single triangle so the closest-hit shader reports a known BuiltInTriangleIntersectionAttributes::barycentrics (u, v). Points are picked from the inside of the triangle to avoid the watertight-traversal edge-rule lottery you hit at edge midpoints / vertices (the first cut of this test used midpoint(v0, v1) and one lane silently missed on both backends).
  • closest-hit-primitive-index.test — three triangles tiled at x = -3, 0, +3 in a single BLAS. 3-lane dispatch fires straight down at each triangle's centroid; the closest-hit reports PrimitiveIndex() and must match the lane index 0..2.
  • closest-hit-world-ray.test — 2-lane dispatch with rays from different z heights (1.0 and 2.0). Closest-hit packs WorldRayOrigin().z, WorldRayDirection().z, and RayTCurrent() through the payload; raygen flattens the float3 into a 6-element Float32 buffer. Verifies the system values match the raygen-side RayDesc and that t is correctly computed by the traversal.

All three are # REQUIRES: raytracing-pipeline with # XFAIL: Clangclang-dxc doesn't yet lower [shader("…")] entry points. With the Metal RT bring-up in #1281 rebased underneath this branch, all three pass natively on Apple Silicon and Metal is dropped from the XFAIL list.

Test plan

Local on an NVIDIA RTX 3060:

  • Linux Vulkan (native offloader)
  • Linux D3D12 (Wine + vkd3d-proton + cross-compiled offloader.exe)
  • Windows Vulkan (native offloader.exe)
  • Windows D3D12 (native offloader.exe)

CI (RT-capable runners):

  • windows-nvidia D3D12 (RaytracingTier 1.2)
  • windows-intel VK (VK_KHR_ray_tracing_pipeline)
  • macOS Metal (supportsRaytracing)

…ldRay

Three small PSO RT tests stacked on llvm#1275, each isolating one shader-
observable closest-hit system value from llvm#1268's 👍 list. Same shape as
the prior batch in llvm#1277 — one .test file per behavior, single-purpose
shader, exact buffer comparison.

  - `closest-hit-barycentrics.test` — 3-lane dispatch, each lane fires
    at a clearly-interior point of the single triangle so the closest-
    hit shader reports a known `BuiltInTriangleIntersectionAttributes
    ::barycentrics` (u, v). Points are picked from the inside of the
    triangle to avoid the watertight-traversal edge-rule lottery you
    hit at edge midpoints / vertices (the first cut of this test used
    midpoint(v0, v1) and one lane silently missed on both backends).
  - `closest-hit-primitive-index.test` — three triangles tiled at x =
    -3, 0, +3 in a single BLAS. 3-lane dispatch fires straight down at
    each triangle's centroid; the closest-hit reports `PrimitiveIndex()`
    and must match the lane index 0..2.
  - `closest-hit-world-ray.test` — 2-lane dispatch with rays from
    different z heights (1.0 and 2.0). Closest-hit packs
    `WorldRayOrigin().z`, `WorldRayDirection().z`, and `RayTCurrent()`
    through the payload; raygen flattens the float3 into a 6-element
    Float32 buffer. Verifies the system values match the raygen-side
    `RayDesc` and that t is correctly computed by the traversal.

All three are `# REQUIRES: raytracing-pipeline` with `# XFAIL: Clang` —
`clang-dxc` doesn't yet lower `[shader(…)]` entry points. With the Metal
RT bring-up rebased on top, all three pass natively on Apple Silicon
and Metal is dropped from the XFAIL list.

Locally verified end-to-end on the user's Linux box: all three pass on
Vulkan via the native offloader, and on D3D12 via Wine + vkd3d-proton +
the cross-compiled `offloader.exe`, against an NVIDIA RTX 3060. And on
macOS 15 / metal-irconverter 3.1.1 via the native offloader: all three
PASS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@EmilioLaiso EmilioLaiso force-pushed the rt-pso-tests-closest-hit-rsvs branch from 382b5ca to 046c7c3 Compare June 26, 2026 09:03
@EmilioLaiso EmilioLaiso merged commit 9a21776 into llvm:main Jun 26, 2026
23 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants