跳到主要内容
asset-pipeline · 代码
查看代码目录
Graphics Learning Lab Asset Pipeline / Source

Observe · Change · Recompute · Explain

从资产契约读到回滚边界

Read-only · exact teaching model

代码页只保留可验证的因果:检查如何影响 QA,变体如何影响内存,依赖如何影响加载,schema 如何决定回滚。

这一课怎么学

  1. 观察
  2. 预测
  3. 改一个量
  4. 看证据
  5. 再读代码
01 / CONTRACT

Import is a schema boundary

Validate normals, names, UVs and schema before the runtime sees the asset.

// Asset Pipeline Simulator — executable teaching model
const qaScore = 100 - missingChecks - schemaDrift - variantPenalty;
const syncRisk = schemaDrift + dependencyDepth * 0.018 + cacheMisses * 0.1;
const rollbackReady = applyMode !== "apply" && schemaVersion === requiredSchema;
02 / MATERIAL

Variants multiply memory and submissions

Shared materials and atlases are quality-budget decisions.

const textureFactor = (textureResolution / 1024) ** 2;
const peakMemoryMb = textureFactor * 4 * materialSlots * (sharedMaterial ? 1 : variants);
const drawCalls = sharedMaterial ? ceil(materialSlots / 4) : materialSlots * variants;
03 / STREAMING

Loading is a dependency graph

Cache misses and depth explain why a small bundle can still be slow.

const loadMs = base + bundles * 4 + dependencyDepth * 3 + cacheMisses * 40;
const reportId = stableHash({ schemaVersion, qaScore, loadMs, rollbackReady });