Skip to content

Add per-geometry Transform on TriangleGeometryDesc#1288

Open
MarijnS95 wants to merge 2 commits into
llvm:mainfrom
Traverse-Research:inlinert-geom-transform
Open

Add per-geometry Transform on TriangleGeometryDesc#1288
MarijnS95 wants to merge 2 commits into
llvm:mainfrom
Traverse-Research:inlinert-geom-transform

Conversation

@MarijnS95

@MarijnS95 MarijnS95 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Depends on #1245

Summary

Adds an optional 3x4 row-major affine transform on triangle BLAS geometries; vertices are baked through it at AS-build time, so Object* shader queries report the transformed positions. Plumbed via:

  • DX: D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC.Transform3x4 GPU VA
  • Vulkan: VkAccelerationStructureGeometryTrianglesDataKHR.transformData device address
  • Metal: MTLAccelerationStructureTriangleGeometryDescriptor.transformationMatrixBuffer + MatrixLayoutRowMajor so the same upload buffer is reused without a CPU-side transpose

The covering test (Feature/InlineRT/geometry-transform.test) bakes a translate-x-by-5 into a single-triangle BLAS and verifies the same world-space rays hit/miss accordingly with an identity TLAS instance.

Part of the inline-RT test coverage epic (#1258).

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)

@MarijnS95 MarijnS95 marked this pull request as draft June 4, 2026 16:11
@MarijnS95 MarijnS95 force-pushed the inlinert-geom-transform branch 3 times, most recently from 5e2b0bf to abd68af Compare June 11, 2026 13:38
Adds an optional 3x4 row-major affine transform on triangle BLAS
geometries; vertices are baked through it at AS-build time, so Object*
shader queries report the transformed positions. Plumbed via DX's
Transform3x4 GPU VA, VK's transformData device address, and Metal's
transformationMatrixBuffer + MatrixLayoutRowMajor (matches the DX/VK
row-major byte layout, so the same upload buffer is reused). The
covering test bakes a translate-x-by-5 into a single-triangle BLAS and
verifies the same world-space rays hit/miss accordingly with an
identity TLAS instance.

Part of the inline-RT test coverage epic
(llvm#1258).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MarijnS95 MarijnS95 marked this pull request as ready for review June 11, 2026 16:57
@MarijnS95 MarijnS95 force-pushed the inlinert-geom-transform branch from abd68af to 0c258a2 Compare June 11, 2026 16:57
The per-geometry transform path referenced a nonexistent
`KeepAliveMTLBuffers` member and allocated the buffer via a raw
`newBuffer` with `ResourceStorageModeShared`, breaking the Metal build.

Route the transform upload through `createBufferWithData` with
`MemoryLocation::CpuToGpu` (matching the adjacent TLAS-Instances path):
this yields the correct `Managed` storage mode for a CPU-written,
GPU-read buffer, performs the proper `didModifyRange` on unmap, and
returns an `offloadtest::Buffer` that lives in the existing
`KeepAliveOwned` keep-alive vector.
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.

4 participants