12 / 12 · Integrate, measure, ship集成、测量、交付
Prove it works, then ship and explain it验证、交付,并把它讲明白
Produce repeatable evidence, a reviewable deployment and a concise engineering explanation.形成可复现证据、可审阅部署以及清楚的工程讲解。
Hero is not “I can orbit a model.” It is “I know which numbers produce these pixels, can isolate a wrong result, and can state exactly which platforms I verified.” This final chapter turns the milestones into evidence.Hero 不只是“我能绕着模型看”,而是“我知道哪些数生成这些像素,能定位错误,并准确说出验证过哪些平台”。最后一章把里程碑变成证据。
1. Check contracts before screenshots1. 截图前先检查约定
Run Rust unit tests for parsing, layout and ordering, then compile native examples and the WASM target. Run the site checks to catch broken links, missing bilingual content and formula rendering failures. These checks are complementary: successful compilation does not prove the shader produces the intended pixels.先运行 Rust 单测,检查解析、布局及排序,再编译桌面示例与 WASM 目标。运行网站检查,捕捉断链、缺少双语内容和公式渲染失败。这些检查互补,编译成功不证明 shader 生成了正确像素。
2. Read back pixels for focused claims2. 用像素回读验证具体结论
workshop_pixels renders stages to an offscreen GPU target. It checks a black clear, triangle coverage, solid quad, Gaussian falloff, order-dependent center color, camera change and time change. It saves PNGs and a JSON report. native_smoke separately tests the real model under known cameras/times; the hidden-window workshop smoke exercises acquire, submit and present.workshop_pixels 把各阶段渲染到离屏 GPU 目标,检查黑色清屏、三角形覆盖、实心 quad、高斯衰减、中心颜色随排序变化、相机变化与时间变化,并保存 PNG 和 JSON 报告。native_smoke 单独验证真实模型的已知相机和时间;隐藏窗口 workshop smoke 验证获取纹理、提交和显示。
Offscreen output checks do not prove resize, keyboard, touch or readability. Open the browser lab, change stages, reverse alpha order, scrub time, orbit, change language and inspect a narrow screen. A device/backend should be marked tested only when actual runtime evidence exists for it.离屏检查不能证明 resize、键盘、触摸或可读性。还要打开浏览器实验,切换阶段、反转 alpha 顺序、拖动时间、绕转、切换语言并检查窄屏。只有实际运行证据,才把某设备或后端标为已验证。
3. Ship code and assets as one compatible version3. 将代码与资产作为兼容版本发布
Build the WASM binary after Rust/WGSL changes, generate the blog and code snapshots, run checks, inspect the deployment bundle, then deploy. The JS glue and WASM binary must use the same versioned URL suffix because the package directory is cached. A stale glue module can make a correct new binary fail to load.Rust/WGSL 修改后先构建 WASM,再生成博客及源码快照、运行检查、检查部署包,然后发布。JS 胶水与 WASM 二进制要用相同版本 URL 后缀,因为 package 目录有缓存。旧胶水模块可能导致正确的新二进制无法加载。
After deployment, open the public build series and lab, not just the deployment log. Preserve the commit identifier and validation report so another person can reproduce the exact state. Deploying a page is not evidence that macOS or Linux has been tested.部署后要打开公开工程系列和实验,不只看部署日志。保存提交编号与验证报告,让他人能够复现准确状态。页面部署成功不代表已经测试过 macOS 或 Linux。
4. Give a five-minute engineering walkthrough4. 做一次五分钟工程讲解
Minute 1: draw browser/native → shared pass → pixels. Minute 2: decode one model record and explain activations. Minute 3: project one Gaussian and compose two overlaps. Minute 4: explain normalized time, sorting and the training/runtime boundary. Minute 5: show a failure you can diagnose, a measured bottleneck and a platform still unverified.第 1 分钟:画出浏览器/桌面 → 共享 pass → 像素。第 2 分钟:解码一条模型记录,解释激活。第 3 分钟:投影一个 Gaussian、合成两个重叠点。第 4 分钟:讲归一化时间、排序与训练/运行时边界。第 5 分钟:展示能诊断的错误、测出的瓶颈,以及还没验证的平台。
For the final exercise, integrate StgPass into your engine’s existing frame graph. Document coordinate and color conventions, show mesh occlusion with depth writes disabled for splats, and produce the same camera/time screenshot in browser and native. Treat unsupported models and device loss as explicit follow-up work.最终练习是把 StgPass 接入自研引擎现有帧图。记录坐标和色彩约定,展示关闭 splat 深度写入后的 mesh 遮挡,并在浏览器和桌面生成同相机、同时间截图。未支持的模型与设备丢失恢复应明确列为后续工作。
RUN → OBSERVE运行 → 观察
Make this step concrete把这一步运行起来
A reproducible set of pixel reports and images, a working browser/native demo, and an honest list of validated platforms and remaining integration work.一组可复现的像素报告与图像、能运行的浏览器/桌面演示,以及准确的已验证平台和剩余集成工作清单。
Open GPU milestone 7 →打开 GPU 里程碑 7 →npm run check
cargo check --locked --examples
cargo run --locked --example workshop_pixels
cargo run --locked --example workshop -- --smoke
cargo run --locked --example native_smoke
cargo run --locked --example mini_compute
npx wrangler deploy --config wrangler.jsonc --dry-run
# Deploy to your configured account/domain only after reviewing the bundle.
npm run deployCommands use the reference repository. Rust/WGSL changes need a native rebuild or npm run build:wasm, followed by a browser reload.命令以参考仓库为基础。修改 Rust/WGSL 后需重新编译桌面程序,或运行 npm run build:wasm 后刷新浏览器。
IDEA → IMPLEMENTATION想法 → 实现
Follow the running code沿着真实代码看
Excerpts are extracted from the repository at site build time. Expand only the part you are studying; full files include context and line numbers.片段在网站构建时直接从仓库提取。只展开正在研究的部分,完整文件包含上下文与行号。
src/workshop_surface.rs · L84–128
You can now explain every operation in the frame that seemed opaque in chapter 1.现在你应该能解释第一章里还陌生的每个帧操作。
pub fn render(&mut self, input: Frame) -> Result<Option<u32>, String> {
let frame = match self.surface.get_current_texture() {
wgpu::CurrentSurfaceTexture::Success(frame)
| wgpu::CurrentSurfaceTexture::Suboptimal(frame) => frame,
wgpu::CurrentSurfaceTexture::Outdated | wgpu::CurrentSurfaceTexture::Lost => {
self.surface.configure(&self.device, &self.config);
return Ok(None);
}
wgpu::CurrentSurfaceTexture::Timeout | wgpu::CurrentSurfaceTexture::Occluded => {
return Ok(None)
}
wgpu::CurrentSurfaceTexture::Validation => {
return Err(
"Surface validation failed; reload to recreate the GPU resources".into(),
)
}
};
let count =
self.pass
.prepare(&self.queue, input, [self.config.width, self.config.height])?;
let target = frame.texture.create_view(&Default::default());
let mut encoder = self.device.create_command_encoder(&Default::default());
{
let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("workshop-frame"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &target,
resolve_target: None,
depth_slice: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),
store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});
self.pass.draw(&mut pass);
}
self.queue.submit([encoder.finish()]);
self.queue.present(frame);
Ok(Some(count))
}Open full source with line numbers ↗打开带行号的完整源码 ↗Real-model render pass ↗真实模型渲染 pass ↗ · Real-model shader ↗真实模型 shader ↗
Predict it, change it, explain it先预测,再修改,再解释
Explain why a successful WASM compilation, a native pixel test and a mobile browser interaction test are three different pieces of evidence.解释为什么 WASM 编译成功、桌面像素测试通过和手机浏览器交互测试通过,是三种不同证据。
Check your reasoning核对推理
Compilation checks APIs and types; the native GPU test checks one backend’s rendered values; browser interaction checks hosting and user behavior in that environment. None alone establishes all-platform correctness or production performance.编译检查 API 与类型,桌面 GPU 测试检查某后端的渲染数值,浏览器交互检查该环境中的宿主与操作行为。任何一项都不能单独证明所有平台正确或达到生产性能。
Keep the theory beside the code把原理放在代码旁边
Open the related derivation or lab ↗打开对应推导或实验 ↗