Lighting on the GPU in the WebGPU path (t88 phase 2b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 20:01:15 -04:00
co-authored by Claude Opus 5.5
parent fc05146887
commit 31e3005816
11 changed files with 247 additions and 16 deletions
+5 -2
View File
@@ -41,10 +41,13 @@ async function perfRender(lighting, overlays) {
draw += perfLast.drawWorld / n;
for (const [key, value] of Object.entries(perfMarks)) marks[key] = (marks[key] || 0) + value / n;
}
let light = 0;
if (!R.gpuOn) {
for (let k = 0; k < 5; k++) computeLight();
const l0 = performance.now();
for (let k = 0; k < n; k++) computeLight();
const light = (performance.now() - l0) / n;
light = (performance.now() - l0) / n;
}
// Exercise the actual overlay calls and their arguments/conditions in frame().
PERF_MARKS = false;
for (let k = 0; k < 5; k++) frame(lastT + 1000 / 60);
@@ -58,7 +61,7 @@ async function perfRender(lighting, overlays) {
await GPU.timingPromise;
PERF_MARKS = true; drawWorld();
await GPU.timingPromise;
PERF_MARKS = false; gpu_ms = GPU.gpuMs; marks.gpu = gpu_ms;
PERF_MARKS = false; gpu_ms = GPU.gpuMs; marks.gpu = gpu_ms; marks.gpuLight = GPU.lightMs;
}
return { frame_ms, drawWorld_ms: draw, computeLight_ms: light, marks_ms: marks,
overlays: Object.fromEntries(Object.entries(data).map(([key, d]) => [key, { ms_per_frame: d.ms / n, calls: d.calls }])),