test(webgpu-rt): RayQueryPick example exercising the rayQuery TLAS shim (#25)
Adds an 8^3 = 512-instance TLAS pick test that shoots one analytically determined ray through a rayQuery=true PlainComputeShader and checks the read-back committed hit (customIndex 484, t 40.75). 512 instances sit in the < 8193 regime that the hardcoded 16384-leaf start used to miss, so the example fails fast if the shim regresses. Verified in Firefox/WebGPU: "[RayQueryPick] PASS". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
8f6a52a460
commit
b645746c8c
9 changed files with 471 additions and 0 deletions
35
examples/RayQueryPick/raygen.wgsl
Normal file
35
examples/RayQueryPick/raygen.wgsl
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// RTStress raygen (runs in GENERATE). Host-driven pinhole camera at
|
||||
// @group(3) (groups 0..2 are reserved by the wavefront pipeline:
|
||||
// 0 = WfParams, 1 = data heaps, 2 = indirect args).
|
||||
struct Camera {
|
||||
origin: vec3<f32>,
|
||||
pad0: f32,
|
||||
right: vec3<f32>,
|
||||
tanHalf: f32,
|
||||
up: vec3<f32>,
|
||||
aspect: f32,
|
||||
forward: vec3<f32>,
|
||||
pad1: f32,
|
||||
};
|
||||
@group(3) @binding(0) var<storage, read> camera : Camera;
|
||||
|
||||
fn raygen_main(gid: vec3<u32>) {
|
||||
if (gid.x >= wfParams.surfaceW || gid.y >= wfParams.surfaceH) { return; }
|
||||
|
||||
let pixelf = vec2<f32>(f32(gid.x), f32(gid.y));
|
||||
let res = vec2<f32>(f32(wfParams.surfaceW), f32(wfParams.surfaceH));
|
||||
let uv = (pixelf + vec2<f32>(0.5)) / res;
|
||||
let ndc = uv * 2.0 - vec2<f32>(1.0);
|
||||
|
||||
let direction = normalize(
|
||||
camera.right * (ndc.x * camera.aspect * camera.tanHalf) +
|
||||
camera.up * (-ndc.y * camera.tanHalf) +
|
||||
camera.forward);
|
||||
|
||||
var p: Payload;
|
||||
p.color = vec3<f32>(0.0);
|
||||
p.shadowRay = 0u;
|
||||
|
||||
rtEmitPrimaryRay(camera.origin, 0.01, direction, 100000.0,
|
||||
0u, 0xFFu, 0u, 0u, p);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue