Add per-geometry Transform on TriangleGeometryDesc#1288
Open
MarijnS95 wants to merge 2 commits into
Open
Conversation
5e2b0bf to
abd68af
Compare
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>
abd68af to
0c258a2
Compare
manon-traverse
approved these changes
Jun 12, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC.Transform3x4GPU VAVkAccelerationStructureGeometryTrianglesDataKHR.transformDatadevice addressMTLAccelerationStructureTriangleGeometryDescriptor.transformationMatrixBuffer+MatrixLayoutRowMajorso the same upload buffer is reused without a CPU-side transposeThe 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:
offloader)offloader.exe)offloader.exe)offloader.exe)CI (RT-capable runners):
RaytracingTier 1.2)VK_KHR_ray_tracing_pipeline)supportsRaytracing)