test(webgpu-rt): RTMultiShadow example exercising N shadow rays/pixel/bounce (#30)
Five pillars, four colored point lights; closest-hit emits one shadow ray per light from the same invocation (raysPerPixel = 4, maxDepth = 2), so up to four rays per pixel rtAccumulate in a single SHADE pass — the contention case #30 exists for. Each pillar casts four separable colored shadows; an accumulator race or capacity drop shows as flickering dark noise or a missing shadow color. Two frames a second apart diff at 2 px / 1.85 M (last-ulp CAS ordering), confirming no lost updates. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
27d7e84cb3
commit
f7fc441253
7 changed files with 406 additions and 0 deletions
14
examples/RTMultiShadow/miss.wgsl
Normal file
14
examples/RTMultiShadow/miss.wgsl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// RTMultiShadow miss (runs in SHADE). Shadow miss → that light is visible
|
||||
// from the surface, so add its pending contribution; up to LIGHT_COUNT of
|
||||
// these resolve for the same pixel in one pass (atomic rtAccumulate, #30).
|
||||
// Primary miss → near-black night sky so the colored lighting carries the
|
||||
// frame.
|
||||
fn miss_main(ray: RayDesc, payload: ptr<function, Payload>) {
|
||||
if ((*payload).shadowRay == 1u) {
|
||||
rtAccumulate((*payload).color);
|
||||
return;
|
||||
}
|
||||
let t = clamp(ray.direction.y * 0.5 + 0.5, 0.0, 1.0);
|
||||
rtAccumulate(mix(vec3<f32>(0.010, 0.012, 0.022),
|
||||
vec3<f32>(0.030, 0.040, 0.075), t));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue