Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add experimental temporal AA modes to Telos
Yuechen Liac77e0b4fbd7
diff --git a/Aetheris.Web.Runtime/telos/README.md b/Aetheris.Web.Runtime/telos/README.mdindex d5a47639..4255a331 100644--- a/Aetheris.Web.Runtime/telos/README.md+++ b/Aetheris.Web.Runtime/telos/README.md@@ -13,3 +13,11 @@ World-space meshes and lines accept explicit `depthMode`: `depth-tested`, `depth`setDynamicLines` updates a bounded set of world-space lines identified by stable IDs. An unchanged ID, segment count and depth state retain vertex and uniform buffers. Call it within `beforeFrame`, or request `invalidate()` after an external update. Removing an ID releases its resources. `setScene` similarly retains unchanged draw/proxy resources across selection and filter updates. Immutable geometry arrays remain the definition identity contract.`overlayId` carries product-owned pick identity. DOM buttons receive their own DOM events; GPU picking prioritizes always-on-top authoring meshes, dynamic overlay leaders, construction lines/surfaces and then model geometry. Hidden or depth-occluded overlays do not steal geometry picks. This supplies graphics interaction identity, not CAD selector authority.++## Experimental temporal AA++`host.setAA("TAA")` enables a fixed-weight, depth-rejected, neighborhood-clamped baseline; `host.setAA("TAAUtility")` enables the generated Copeland utility policy. `None`/`SpatialOnly` retain local primitive/line coverage without temporal jitter or resolve. Spatial AA is still the default: X0's supersampled witness found both temporal modes worse than spatial-only at silhouettes. See `docs/release/TELOS-TAA-X0.md` for the exact bounded blocker and evidence.++Optional debug values are `policy`, `confidence`, `motion` and `depth`; seed a color view first. Debug reads frozen color history and never accumulates its visualization. The shared host owns eight bounded physical-pixel Halton samples, surface color/depth history, reprojection and invalidation. Picking, PMI and overlay projection use the logical camera. Scene/appearance/occurrence updates through `setScene` reset history; object-transform reprojection is not claimed. Topology and authoring overlays render after resolve. Temporal textures remain allocated after switching back to spatial mode until resize/disposal.++The actual decision source is `fixtures/three-telos/temporal-policy.v.ts`. Regenerate the packaged policy using `scripts/prepare-telos-temporal-policy.ps1` with an explicit Copeland checkout; this compiler is an offline build input, not a browser dependency. Missing optional temporal assets or pipeline support preserve spatial startup. Timestamp-query timing is optional. Qualification must submit `readPixels()` immediately after `render()` before yielding a browser frame, because the canvas swap texture can expire.diff --git a/Aetheris.Web.Runtime/telos/src/device.ts b/Aetheris.Web.Runtime/telos/src/device.tsindex c13b637f..2ddbe0a1 100644--- a/Aetheris.Web.Runtime/telos/src/device.ts+++ b/Aetheris.Web.Runtime/telos/src/device.ts@@ -82,7 +82,14 @@ export class TelosDevice {const adapter = await navigator.gpu.requestAdapter();if (!adapter) throw new Error("telos-adapter-unavailable");const shaders = await loadTelosShaders();- const device = await adapter.requestDevice();+ // Timing is optional; neither viewport nor temporal startup depends on it.+ let device: GPUDevice;+ if (adapter.features.has("timestamp-query")) {+ device = await adapter.requestDevice({ requiredFeatures: ["timestamp-query"] })+ .catch(() => adapter.requestDevice());+ } else {+ device = await adapter.requestDevice();+ }const context = canvas.getContext("webgpu");if (!context) {device.destroy();@@ -171,14 +178,14 @@ export class TelosFrame {label: "Telos authoritative depth",size: [w, h],format: "depth32float",- usage: GPUTextureUsage.RENDER_ATTACHMENT,+ usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC,});this.depthView = this.depth.createView();this.generation++;}- begin(background: GPUColor) {+ begin(background: GPUColor, source?: GPUTexture) {this.target = this.owner.context.getCurrentTexture();- this.colorView = this.target.createView();+ this.colorView = (source ?? this.target).createView();this.encoder = this.owner.device.createCommandEncoder();const pass = this.pass("Background", true, background);pass.end();diff --git a/Aetheris.Web.Runtime/telos/src/host.ts b/Aetheris.Web.Runtime/telos/src/host.tsindex b2c965fb..3bacbb44 100644--- a/Aetheris.Web.Runtime/telos/src/host.ts+++ b/Aetheris.Web.Runtime/telos/src/host.ts@@ -3,6 +3,7 @@ import { TelosCamera } from "./camera.js";import { TelosDevice, TelosFrame } from "./device.js";import { TelosPick } from "./pick.js";import { attachNavigation } from "./navigation.js";+import { TelosTemporal, type TelosAAMode, type TelosAADebug } from "./temporal.js";import { telosPipeline } from "./pipelines.js";import type {TelosScene,@@ -46,6 +47,25 @@ export class TelosHost {scene = emptyScene();background: GPUColor = [0.08, 0.1, 0.09, 1];grid = false;+ temporal?: TelosTemporal;+ aaMode: TelosAAMode = "SpatialOnly";+ aaDebug: TelosAADebug = "color";+ setAA(mode: TelosAAMode, debug: TelosAADebug = "color") {+ if ((mode === "TAA" || mode === "TAAUtility") && !this.temporal) {+ this.owner.diagnostic("telos-temporal-unavailable: retaining spatial AA");+ mode = "SpatialOnly";+ }+ if (mode !== this.aaMode) this.temporal?.reset("mode");+ this.aaMode = mode;+ this.aaDebug = debug;+ this.invalidate();+ }+ private get temporalActive() {+ return this.temporal && (this.aaMode === "TAA" || this.aaMode === "TAAUtility");+ }+ private get renderProjection() {+ return this.temporalActive ? this.temporal!.renderProjection : this.camera.viewProjection;+ }gridPlane: "xy" | "xz" = "xz";readonly geometry = new Map<string, GeometryBuffers>();private meshes: Draw<TelosMesh>[] = [];@@ -131,7 +151,9 @@ export class TelosHost {diagnostic?: (message: string) => void,) {const owner = await TelosDevice.create(canvas, diagnostic);- return new TelosHost(owner);+ const host = new TelosHost(owner);+ host.temporal = await TelosTemporal.create(owner);+ return host;}constructor(readonly owner: TelosDevice) {this.frame = new TelosFrame(owner);@@ -191,6 +213,8 @@ export class TelosHost {return { item, pipeline, uniform, binding, count };}setScene(scene: TelosScene) {+ // No prior per-occurrence transforms are retained yet. Reset instead of assuming camera-only motion.+ this.temporal?.reset("scene/appearance/occurrence");const previous = [...this.meshes, ...this.lines, ...this.fields];const retained = new Set<Draw<TelosMesh> | Draw<TelosLine> | Draw<TelosField>@@ -382,7 +406,7 @@ export class TelosHost {private updateMesh(draw: Draw<TelosMesh>) {const model = matrix(draw.item.transform);const data = new Float32Array(56);- data.set(this.camera.viewProjection.elements);+ data.set(draw.item.overlay ? this.camera.viewProjection.elements : this.renderProjection.elements);data.set(model.elements, 16);data.set(model.clone().invert().transpose().elements, 32);const material = draw.item.material;@@ -425,7 +449,7 @@ export class TelosHost {}private updateField(draw: Draw<TelosField>) {const inverse = matrix(draw.item.transform).invert(),- localVP = this.camera.viewProjection+ localVP = this.renderProjection.clone().multiply(matrix(draw.item.transform));const m = localVP.elements,@@ -445,8 +469,13 @@ export class TelosHost {];const vertices = new Float32Array(corners.flatMap((pixel) => {- const origin = this.camera.unproject(pixel, 0).applyMatrix4(inverse),- far = this.camera.unproject(pixel, 1).applyMatrix4(inverse);+ const unproject = (depth: number) => new Vector3(+ (pixel[0] / this.camera.width) * 2 - 1,+ 1 - (pixel[1] / this.camera.height) * 2,+ depth,+ ).applyMatrix4(this.temporalActive ? this.temporal!.inverseRenderProjection : this.camera.inverseViewProjection);+ const origin = unproject(0).applyMatrix4(inverse),+ far = unproject(1).applyMatrix4(inverse);return [(pixel[0] / this.camera.width) * 2 - 1,1 - (pixel[1] / this.camera.height) * 2,@@ -567,9 +596,12 @@ export class TelosHost {for (const listener of this.frameListeners) listener();this.metrics.overlayUpdateMs = performance.now() - overlayStart;this.updateGrid();- this.frame.begin(this.background);+ const temporal = this.temporalActive ? this.temporal : undefined;+ const source = temporal?.prepare(this.frame, this.camera, this.aaMode, this.aaDebug);+ this.frame.begin(this.background, source);this.metrics.draws = 0;- if (this.gridDraw) {+ const drawGrid = () => {+ if (!this.gridDraw) return;const grid = this.frame.pass("ReferenceGrid");this.updateLine(this.gridDraw);grid.setPipeline(this.gridDraw.pipeline);@@ -577,7 +609,7 @@ export class TelosHost {grid.setVertexBuffer(0, this.gridDraw.vertices!);grid.draw(6, this.gridDraw.count);grid.end();- }+ };const drawMesh = (pass: GPURenderPassEncoder, draw: Draw<TelosMesh>) => {if (draw.item.visible === false) return;this.updateMesh(draw);@@ -603,6 +635,8 @@ export class TelosHost {this.metrics.draws++;}pass.end();+ temporal?.resolve(this.frame);+ drawGrid();pass = this.frame.pass("Topology");for (const draw of this.lines.filter((draw) => !draw.item.overlay)) {if (draw.item.visible === false) continue;@@ -633,6 +667,7 @@ export class TelosHost {this.frame.end();this.metrics.frames++;this.metrics.frameMs = performance.now() - started;+ if (temporal?.needsFrame) this.invalidate();}/** Qualification readback uses the authoritative presented texture. */async readPixels(): Promise<Uint8Array> {@@ -689,6 +724,7 @@ export class TelosHost {this.frameListeners.clear();this.releaseDraws();this.geometry.clear();+ this.temporal?.dispose();this.frame.dispose();this.owner.dispose();}diff --git a/Aetheris.Web.Runtime/telos/src/index.ts b/Aetheris.Web.Runtime/telos/src/index.tsindex 8d16a242..ac0e46e9 100644--- a/Aetheris.Web.Runtime/telos/src/index.ts+++ b/Aetheris.Web.Runtime/telos/src/index.ts@@ -5,3 +5,5 @@ export * from "./device.js";export * from "./pick.js";export * from "./host.js";export * from "./adapters.js";++export * from "./temporal.js";diff --git a/Aetheris.Web.Runtime/telos/src/pipelines.ts b/Aetheris.Web.Runtime/telos/src/pipelines.tsindex 3c00bab8..ad671e25 100644--- a/Aetheris.Web.Runtime/telos/src/pipelines.ts+++ b/Aetheris.Web.Runtime/telos/src/pipelines.ts@@ -23,7 +23,7 @@ export function telosPipeline(: "depth-tested");const id =artifact?.shaderId ??- "telos-" + (kind.includes("mesh") ? "mesh" : "line") + "/1";+ "telos-" + (kind.includes("mesh") ? "mesh/1" : "line/2");const key = JSON.stringify([id,kind,diff --git a/Aetheris.Web.Runtime/telos/src/shaderSources.ts b/Aetheris.Web.Runtime/telos/src/shaderSources.tsindex 16b3ee58..3e8f94fe 100644--- a/Aetheris.Web.Runtime/telos/src/shaderSources.ts+++ b/Aetheris.Web.Runtime/telos/src/shaderSources.ts@@ -1,6 +1,7 @@export interface TelosShaderSources {mesh: string;line: string;+ temporal?: string;}async function loadShader(url: URL): Promise<string> {@@ -19,5 +20,10 @@ export async function loadTelosShaders(): Promise<TelosShaderSources> {loadShader(new URL("./shaders/mesh.wgsl", import.meta.url)),loadShader(new URL("./shaders/line.wgsl", import.meta.url)),]);- return { mesh, line };+ // Optional temporal assets never gate the existing viewport path.+ const temporal = await Promise.all([+ loadShader(new URL("./shaders/temporal-policy.wgsl", import.meta.url)),+ loadShader(new URL("./shaders/temporal-resolve.wgsl", import.meta.url)),+ ]).then(parts => parts.join("\n")).catch(() => undefined);+ return { mesh, line, temporal };}diff --git a/Aetheris.Web.Runtime/telos/src/shaders/line.wgsl b/Aetheris.Web.Runtime/telos/src/shaders/line.wgslindex 3194f7de..ef7528dd 100644--- a/Aetheris.Web.Runtime/telos/src/shaders/line.wgsl+++ b/Aetheris.Web.Runtime/telos/src/shaders/line.wgsl@@ -1,17 +1,27 @@struct State { vp: mat4x4<f32>, model: mat4x4<f32>, color: vec4<f32>, viewport: vec4<f32> }@group(0) @binding(0) var<uniform> state: State;-@vertex fn vertex(@builtin(vertex_index) vertex: u32, @location(0) start: vec3<f32>, @location(1) end: vec3<f32>) -> @builtin(position) vec4<f32> {+struct LineOutput {+ @builtin(position) position: vec4<f32>,+ @location(0) lateral: f32,+}+@vertex fn vertex(@builtin(vertex_index) vertex: u32, @location(0) start: vec3<f32>, @location(1) end: vec3<f32>) -> LineOutput {var a = state.vp * state.model * vec4(start,1); var b = state.vp * state.model * vec4(end,1);// Clip before dividing by w: segments crossing the near plane remain finite.if (a.z < 0 && b.z >= 0) { a = mix(a,b, -a.z / (b.z-a.z)); }if (b.z < 0 && a.z >= 0) { b = mix(b,a, -b.z / (a.z-b.z)); }- if (a.z < 0 && b.z < 0) { return vec4<f32>(2,2,2,1); }+ if (a.z < 0 && b.z < 0) { return LineOutput(vec4<f32>(2,2,2,1), 0.0); }let delta = (b.xy/b.w-a.xy/a.w) * state.viewport.xy;let direction = delta / max(length(delta), 0.00001);let perpendicular = vec2(-direction.y, direction.x);let corners = array<vec2<f32>,6>(vec2(0,-1),vec2(1,-1),vec2(0,1),vec2(0,1),vec2(1,-1),vec2(1,1));let corner = corners[vertex]; var p = mix(a,b,corner.x);- p = vec4(p.xy + perpendicular * corner.y * state.viewport.z / state.viewport.xy * p.w, p.z - state.viewport.w * p.w, p.w);- return p;+ let paddedHalfWidth = state.viewport.z * 0.5 + 1.0;+ p = vec4(p.xy + perpendicular * corner.y * (2.0 * paddedHalfWidth) / state.viewport.xy * p.w, p.z - state.viewport.w * p.w, p.w);+ return LineOutput(p, corner.y * paddedHalfWidth);+}+@fragment fn fragment(input: LineOutput) -> @location(0) vec4<f32> {+ let halfWidth = state.viewport.z * 0.5;+ let filterWidth = max(fwidth(input.lateral), 0.0001);+ let coverage = 1.0 - smoothstep(halfWidth - filterWidth * 0.5, halfWidth + filterWidth * 0.5, abs(input.lateral));+ return vec4<f32>(state.color.rgb, state.color.a * coverage);}-@fragment fn fragment() -> @location(0) vec4<f32> { return state.color; }diff --git a/Aetheris.Web.Runtime/telos/src/shaders/temporal-policy.wgsl b/Aetheris.Web.Runtime/telos/src/shaders/temporal-policy.wgslnew file mode 100644index 00000000..c5f5abd3--- /dev/null+++ b/Aetheris.Web.Runtime/telos/src/shaders/temporal-policy.wgsl@@ -0,0 +1,148 @@+// Generated by vd-wgsl/1. Do not edit.+struct vd_s0 {+ m0: vec3<f32>,+}++struct vd_s1 {+ m0: vec4<f32>,+}++struct vd_s2 {+ m0: vec4<f32>,+ m1: vec4<f32>,+}++struct vd_io3 {+ @location(0) m0: vec3<f32>,+}++struct vd_io4 {+ @builtin(position) m0: vec4<f32>,+ @location(0) @interpolate(perspective) m1: vec4<f32>,+}++struct vd_io5 {+ @builtin(position) m0: vec4<f32>,+ @location(0) @interpolate(perspective) m1: vec4<f32>,+}++struct vd_io6 {+ @location(0) m0: vec4<f32>,+}+++fn vd_f0(vd_l0: f32) -> vec3<f32> {+ return vec3<f32>(2f, 0.25f, vd_l0);+}++fn vd_f1(vd_l1: f32) -> vec3<f32> {+ return vec3<f32>(3f, 0.12f, vd_l1);+}++fn vd_f2(vd_l2: vd_s2) -> vd_s1 {+ return vd_s1(vec4<f32>(vd_f6(vd_l2.m1.x, vd_l2.m1.y, vd_l2.m1.z, vd_l2.m1.w), 1f));+}++fn vd_f3() -> vec3<f32> {+ return vec3<f32>(0f, 0f, 0f);+}++fn vd_f4(vd_l3: f32) -> u32 {+ if ((vd_l3 >= 0.9f)) {+ return 100u;+ }+ if ((vd_l3 >= 0.7f)) {+ return 80u;+ }+ if ((vd_l3 >= 0.5f)) {+ return 60u;+ }+ if ((vd_l3 >= 0.3f)) {+ return 40u;+ }+ if ((vd_l3 >= 0.1f)) {+ return 20u;+ }+ return 0u;+}++fn vd_f5(vd_l4: f32) -> vec3<f32> {+ return vec3<f32>(1f, 0.5f, vd_l4);+}++fn vd_f6(vd_l5: f32, vd_l6: f32, vd_l7: f32, vd_l8: f32) -> vec3<f32> {+ let vd_l9: f32 = (((vd_l5 * vd_l6) * vd_l7) * (1f - vd_l8));+ let vd_l10: f32 = (((vd_l5 * vd_l6) * (1f - vd_l7)) * (1f - vd_l8));+ let vd_l11: f32 = max((1f - vd_l5), max((1f - vd_l6), (vd_l8 * (1f - vd_l7))));+ return vd_f7(vd_l5, vd_l6, vd_l7, vd_l8, vd_l9, vd_l10, vd_l11);+}++fn vd_f7(vd_l12: f32, vd_l13: f32, vd_l14: f32, vd_l15: f32, vd_l16: f32, vd_l17: f32, vd_l18: f32) -> vec3<f32> {+ var vd_l19: u32 = 0u;+ var vd_l20: u32 = 0u;+ if (true) {+ let vd_l21: u32 = vd_f4(vd_l18);+ if (((vd_l19 == 0u) || (vd_l21 > vd_l20))) {+ vd_l20 = vd_l21;+ vd_l19 = 1u;+ }+ }+ if ((((vd_l12 > 0.8f) && (vd_l13 > 0.7f)) && (vd_l15 < 0.2f))) {+ let vd_l22: u32 = vd_f4(vd_l16);+ if (((vd_l19 == 0u) || (vd_l22 > vd_l20))) {+ vd_l20 = vd_l22;+ vd_l19 = 2u;+ }+ }+ if ((((vd_l12 > 0.8f) && (vd_l13 > 0.5f)) && (vd_l15 < 0.2f))) {+ let vd_l23: u32 = vd_f4(vd_l17);+ if (((vd_l19 == 0u) || (vd_l23 > vd_l20))) {+ vd_l20 = vd_l23;+ vd_l19 = 3u;+ }+ }+ if (((((vd_l12 > 0.8f) && (vd_l13 > 0.8f)) && (vd_l14 > 0.8f)) && (vd_l15 >= 0.2f))) {+ let vd_l24: u32 = vd_f4(((vd_l12 * vd_l13) * vd_l14));+ if (((vd_l19 == 0u) || (vd_l24 > vd_l20))) {+ vd_l20 = vd_l24;+ vd_l19 = 4u;+ }+ }+ if ((vd_l19 == 1u)) {+ return vd_f3();+ }+ if ((vd_l19 == 2u)) {+ return vd_f5(vd_l16);+ }+ if ((vd_l19 == 3u)) {+ return vd_f0(vd_l17);+ }+ if ((vd_l19 == 4u)) {+ return vd_f1(((vd_l12 * vd_l13) * vd_l14));+ }+ return vd_f3();+}++fn vd_f8(vd_l25: vd_s0) -> vd_s2 {+ return vd_s2(vec4<f32>(vd_l25.m0, 1f), vec4<f32>(1f, 1f, 1f, 0f));+}++@vertex+fn vd_vertex(vd_l26: vd_io3) -> vd_io4 {+ let vd_l27: vd_s2 = vd_f8(vd_s0(vd_l26.m0));+ return vd_io4(vd_l27.m0, vd_l27.m1);+}++@fragment+fn vd_fragment(vd_l28: vd_io5) -> vd_io6 {+ let vd_l29: vd_s1 = vd_f2(vd_s2(vd_l28.m0, vd_l28.m1));+ return vd_io6(vd_l29.m0);+}+++// Source: fixtures/three-telos/temporal-policy.v.ts+// Semantic hash: 140e888b696dcf0d8ec8de3a53a74e265517c8b2ff6319596a3c05f3fba57984+// Static linkage from compiler-owned FunctionNames.+fn telosPolicy(depth: f32, motion: f32, color: f32, edge: f32) -> vec3<f32> {+ return vd_f6(depth, motion, color, edge);+}diff --git a/Aetheris.Web.Runtime/telos/src/shaders/temporal-resolve.wgsl b/Aetheris.Web.Runtime/telos/src/shaders/temporal-resolve.wgslnew file mode 100644index 00000000..543b15d9--- /dev/null+++ b/Aetheris.Web.Runtime/telos/src/shaders/temporal-resolve.wgsl@@ -0,0 +1,93 @@+struct TemporalFrame {+ inverseCurrent: mat4x4<f32>,+ previous: mat4x4<f32>,+ inversePrevious: mat4x4<f32>,+ // width, height, history valid, baseline=1 / utility=2+ state: vec4<f32>,+ // debug: 0 color, 1 policy, 2 confidence, 3 motion, 4 depth+ debug: vec4<f32>,+}+@group(0) @binding(0) var currentColor: texture_2d<f32>;+@group(0) @binding(1) var currentDepth: texture_depth_2d;+@group(0) @binding(2) var historyColor: texture_2d<f32>;+@group(0) @binding(3) var historyDepth: texture_depth_2d;+@group(0) @binding(4) var historySampler: sampler;+@group(0) @binding(5) var<uniform> temporal: TemporalFrame;++@vertex fn resolveVertex(@builtin(vertex_index) index: u32) -> @builtin(position) vec4<f32> {+ let positions = array<vec2<f32>, 3>(vec2<f32>(-1.0, -1.0), vec2<f32>(3.0, -1.0), vec2<f32>(-1.0, 3.0));+ return vec4<f32>(positions[index], 0.0, 1.0);+}+fn worldAt(uv: vec2<f32>, depth: f32, inverse: mat4x4<f32>) -> vec3<f32> {+ let homogeneous = inverse * vec4<f32>(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);+ return homogeneous.xyz / homogeneous.w;+}+fn luminance(color: vec3<f32>) -> f32 {+ return dot(color, vec3<f32>(0.2126, 0.7152, 0.0722));+}+@fragment fn resolveFragment(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {+ let size = temporal.state.xy;+ let pixel = vec2<i32>(position.xy);+ let uv = position.xy / size;+ let depth = textureLoad(currentDepth, pixel, 0);+ let current = textureLoad(currentColor, pixel, 0);+ let world = worldAt(uv, depth, temporal.inverseCurrent);+ let pixelWorld = max(length(worldAt(uv + vec2<f32>(1.0 / size.x, 0.0), depth, temporal.inverseCurrent) - world), 0.0000001);+ var low = current.rgb;+ var high = current.rgb;+ var edgeRisk = 0.0;+ // Nine bounded samples. RGB min/max protects hard CAD color boundaries.+ for (var y = -1; y <= 1; y++) {+ for (var x = -1; x <= 1; x++) {+ let neighbor = clamp(pixel + vec2<i32>(x, y), vec2<i32>(0), vec2<i32>(size) - vec2<i32>(1));+ let color = textureLoad(currentColor, neighbor, 0).rgb;+ low = min(low, color);+ high = max(high, color);+ let nd = textureLoad(currentDepth, neighbor, 0);+ let nuv = (vec2<f32>(neighbor) + vec2<f32>(0.5)) / size;+ // Compare at the same ray to distinguish a depth jump from pixel spacing.+ let separation = length(worldAt(nuv, nd, temporal.inverseCurrent) - worldAt(nuv, depth, temporal.inverseCurrent));+ edgeRisk = max(edgeRisk, clamp(separation / (pixelWorld * 4.0), 0.0, 1.0));+ }+ }+ let previousClip = temporal.previous * vec4<f32>(world, 1.0);+ let previousNdc = previousClip.xyz / previousClip.w;+ let previousUv = vec2<f32>(previousNdc.x * 0.5 + 0.5, 0.5 - previousNdc.y * 0.5);+ let valid = temporal.state.z > 0.5 && depth < 1.0 && previousClip.w > 0.0+ && all(previousUv >= vec2<f32>(0.0)) && all(previousUv < vec2<f32>(1.0))+ && previousNdc.z >= 0.0 && previousNdc.z <= 1.0;+ // Unconditional sampling keeps derivatives uniform. Invalid correspondence is never trusted.+ let history = textureSampleLevel(historyColor, historySampler, previousUv, 0.0);+ let previousPixel = clamp(vec2<i32>(previousUv * size), vec2<i32>(0), vec2<i32>(size) - vec2<i32>(1));+ let oldDepth = textureLoad(historyDepth, previousPixel, 0);+ let oldUv = (vec2<f32>(previousPixel) + vec2<f32>(0.5)) / size;+ let oldWorld = worldAt(oldUv, oldDepth, temporal.inversePrevious);+ let expectedWorld = worldAt(oldUv, previousNdc.z, temporal.inversePrevious);+ let depthError = length(oldWorld - expectedWorld) / pixelWorld;+ var depthConfidence = 0.0;+ if (valid && oldDepth < 1.0) { depthConfidence = 1.0 - clamp(depthError / 2.0, 0.0, 1.0); }+ let motionPixels = length((previousUv - uv) * size);+ // Allow sample jitter (<1 px); trust drops to zero by 8 px/frame.+ let motionConfidence = 1.0 - clamp((motionPixels - 1.0) / 7.0, 0.0, 1.0);+ let colorConfidence = 1.0 - clamp(abs(luminance(history.rgb) - luminance(current.rgb)) / 0.15, 0.0, 1.0);+ var decision = vec3<f32>(0.0);+ if (temporal.state.w == 1.0) {+ // Deliberately conventional baseline: fixed weight, depth rejection, same clamp.+ if (depthConfidence > 0.8) { decision = vec3<f32>(2.0, 0.5, depthConfidence); }+ } else {+ decision = telosPolicy(depthConfidence, motionConfidence, colorConfidence, edgeRisk);+ }+ let clipped = clamp(history.rgb, low, high);+ // Clamp all accepted policies; stable history is never allowed outside the local color range.+ var resolved = mix(current.rgb, clipped, decision.y);+ if (temporal.debug.x == 1.0) {+ resolved = vec3<f32>(1.0, 0.0, 0.0);+ if (decision.x == 1.0) { resolved = vec3<f32>(0.0, 1.0, 0.0); }+ if (decision.x == 2.0) { resolved = vec3<f32>(1.0, 1.0, 0.0); }+ if (decision.x == 3.0) { resolved = vec3<f32>(0.0, 0.4, 1.0); }+ }+ if (temporal.debug.x == 2.0) { resolved = vec3<f32>(decision.z); }+ if (temporal.debug.x == 3.0) { resolved = vec3<f32>(1.0 - motionConfidence); }+ if (temporal.debug.x == 4.0) { resolved = vec3<f32>(1.0 - depthConfidence); }+ return vec4<f32>(resolved, current.a);+}diff --git a/Aetheris.Web.Runtime/telos/src/temporal.ts b/Aetheris.Web.Runtime/telos/src/temporal.tsnew file mode 100644index 00000000..1b33cfff--- /dev/null+++ b/Aetheris.Web.Runtime/telos/src/temporal.ts@@ -0,0 +1,302 @@+import { Matrix4 } from "three";+import type { TelosDevice, TelosFrame } from "./device.js";+import type { TelosCamera } from "./camera.js";++export type TelosAAMode = "None" | "SpatialOnly" | "TAA" | "TAAUtility";+export type TelosAADebug =+ | "color"+ | "policy"+ | "confidence"+ | "motion"+ | "depth";+const debugNames: TelosAADebug[] = [+ "color",+ "policy",+ "confidence",+ "motion",+ "depth",+];+const halton = (index: number, base: number) => {+ let value = 0;+ let fraction = 1;+ while (index > 0) {+ fraction /= base;+ value += fraction * (index % base);+ index = Math.floor(index / base);+ }+ return value - 0.5;+};+/** Eight deterministic physical-pixel samples. Picking never consumes these matrices. */+export function temporalJitter(index: number): [number, number] {+ return [halton((index % 8) + 1, 2), halton((index % 8) + 1, 3)];+}+export function temporalProjection(+ camera: TelosCamera,+ width: number,+ height: number,+ index: number,+ output = new Matrix4(),+) {+ const [x, y] = temporalJitter(index);+ return output+ .makeTranslation((2 * x) / width, (-2 * y) / height, 0)+ .multiply(camera.viewProjection);+}+export function temporalMemoryBytes(width: number, height: number) {+ return width * height * 12;+}++/** Optional shared resolve owner. One source color, one history color and one previous depth. */+export class TelosTemporal {+ private source?: GPUTexture;+ private history?: GPUTexture;+ private previousDepth?: GPUTexture;+ private binding?: GPUBindGroup;+ private generation = -1;+ private valid = false;+ private samples = 0;+ private sequence = 0;+ private logical = new Matrix4();+ private projectionKey = "";+ private readonly previous = new Matrix4();+ private readonly inversePrevious = new Matrix4();+ private readonly data = new Float32Array(56);+ private readonly uniform: GPUBuffer;+ private readonly sampler: GPUSampler;+ private readonly query?: GPUQuerySet;+ private readonly queryResolve?: GPUBuffer;+ private readonly queryRead?: GPUBuffer;+ private debug: TelosAADebug = "color";+ private mode: TelosAAMode = "SpatialOnly";+ readonly renderProjection = new Matrix4();+ readonly inverseRenderProjection = new Matrix4();+ lastResetReason = "initial";+ resolveEncodeMs = 0;+ reprojectionCpuMs = 0;+ static async create(owner: TelosDevice): Promise<TelosTemporal | undefined> {+ if (!owner.shaders.temporal) return;+ owner.device.pushErrorScope("validation");+ let scopeOpen = true;+ try {+ const module = owner.device.createShaderModule({+ label: "Telos temporal resolve",+ code: owner.shaders.temporal,+ });+ const pipeline = await owner.device.createRenderPipelineAsync({+ label: "Telos light temporal resolve",+ layout: "auto",+ vertex: { module, entryPoint: "resolveVertex" },+ fragment: {+ module,+ entryPoint: "resolveFragment",+ targets: [{ format: owner.format }],+ },+ primitive: { topology: "triangle-list" },+ });+ const error = await owner.device.popErrorScope();+ scopeOpen = false;+ if (error) throw new Error(error.message);+ return new TelosTemporal(owner, pipeline);+ } catch (error) {+ // Pipeline failure must preserve viewport startup and the existing spatial path.+ if (scopeOpen) await owner.device.popErrorScope().catch(() => undefined);+ owner.diagnostic("telos-temporal-unavailable: " + String(error));+ return;+ }+ }+ private constructor(+ private readonly owner: TelosDevice,+ private readonly pipeline: GPURenderPipeline,+ ) {+ this.uniform = owner.resources.buffer(this.data, GPUBufferUsage.UNIFORM);+ this.sampler = owner.device.createSampler({+ magFilter: "linear",+ minFilter: "linear",+ });+ if (owner.device.features.has("timestamp-query")) {+ this.query = owner.device.createQuerySet({ type: "timestamp", count: 2 });+ this.queryResolve = owner.resources.buffer(+ new Uint32Array(4),+ GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC,+ );+ this.queryRead = owner.device.createBuffer({+ size: 16,+ usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ,+ });+ owner.resources.buffers.add(this.queryRead);+ }+ }+ reset(reason: string) {+ this.valid = false;+ this.samples = 0;+ this.sequence = 0;+ this.lastResetReason = reason;+ }+ get needsFrame() {+ return this.samples < 8;+ }+ get historyValid() {+ return this.valid;+ }+ prepare(+ frame: TelosFrame,+ camera: TelosCamera,+ mode: TelosAAMode,+ debug: TelosAADebug,+ ) {+ const start = performance.now();+ if (mode !== this.mode) this.reset("mode");+ this.mode = mode;+ this.debug = debug;+ if (frame.generation !== this.generation) {+ this.releaseTextures();+ const size = [frame.width, frame.height];+ this.source = this.owner.resources.texture({+ label: "Telos temporal source",+ size,+ format: this.owner.format,+ usage:+ GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,+ });+ this.history = this.owner.resources.texture({+ label: "Telos temporal history",+ size,+ format: this.owner.format,+ usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,+ });+ this.previousDepth = this.owner.resources.texture({+ label: "Telos previous depth",+ size,+ format: "depth32float",+ usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,+ });+ this.binding = this.owner.device.createBindGroup({+ layout: this.pipeline.getBindGroupLayout(0),+ entries: [+ { binding: 0, resource: this.source.createView() },+ { binding: 1, resource: frame.depthView },+ { binding: 2, resource: this.history.createView() },+ { binding: 3, resource: this.previousDepth.createView() },+ { binding: 4, resource: this.sampler },+ { binding: 5, resource: { buffer: this.uniform } },+ ],+ });+ this.generation = frame.generation;+ this.reset("viewport/DPR");+ }+ const key = [+ camera.mode,+ camera.fov,+ camera.span,+ camera.near,+ camera.far,+ frame.dpr,+ ].join(":");+ if (key !== this.projectionKey) this.reset("projection/DPR");+ this.projectionKey = key;+ if (!this.logical.equals(camera.viewProjection)) this.samples = 0;+ this.logical.copy(camera.viewProjection);+ temporalProjection(+ camera,+ frame.width,+ frame.height,+ this.sequence,+ this.renderProjection,+ );+ this.inverseRenderProjection.copy(this.renderProjection).invert();+ this.reprojectionCpuMs = performance.now() - start;+ return this.source!;+ }+ resolve(frame: TelosFrame) {+ const start = performance.now();+ this.data.set(this.inverseRenderProjection.elements, 0);+ this.data.set(this.previous.elements, 16);+ this.data.set(this.inversePrevious.elements, 32);+ this.data.set(+ [+ frame.width,+ frame.height,+ this.valid ? 1 : 0,+ this.mode === "TAA" ? 1 : 2,+ ],+ 48,+ );+ this.data.set([debugNames.indexOf(this.debug), 0, 0, 0], 52);+ this.owner.device.queue.writeBuffer(this.uniform, 0, this.data);+ frame.colorView = frame.target.createView();+ const pass = frame.encoder.beginRenderPass({+ label: "TemporalResolve",+ timestampWrites: this.query+ ? {+ querySet: this.query,+ beginningOfPassWriteIndex: 0,+ endOfPassWriteIndex: 1,+ }+ : undefined,+ colorAttachments: [+ {+ view: frame.colorView,+ loadOp: "clear",+ clearValue: [0, 0, 0, 1],+ storeOp: "store",+ },+ ],+ });+ pass.setPipeline(this.pipeline);+ pass.setBindGroup(0, this.binding!);+ pass.draw(3);+ pass.end();+ if (this.query) {+ frame.encoder.resolveQuerySet(this.query, 0, 2, this.queryResolve!, 0);+ frame.encoder.copyBufferToBuffer(+ this.queryResolve!,+ 0,+ this.queryRead!,+ 0,+ 16,+ );+ }+ // Capture surface history before crisp grid, topology, authoring and DOM overlays.+ // Debug pixels must never contaminate color history.+ if (this.debug === "color") {+ frame.encoder.copyTextureToTexture(+ { texture: frame.target },+ { texture: this.history! },+ [frame.width, frame.height],+ );+ frame.encoder.copyTextureToTexture(+ { texture: frame.depth!, aspect: "depth-only" },+ { texture: this.previousDepth!, aspect: "depth-only" },+ [frame.width, frame.height],+ );+ this.valid = true;+ this.previous.copy(this.renderProjection);+ this.inversePrevious.copy(this.inverseRenderProjection);+ }+ this.samples++;+ this.sequence = (this.sequence + 1) % 8;+ this.resolveEncodeMs = performance.now() - start;+ }+ /** Explicit qualification readback. Await it before submitting the next frame. */+ async readGpuMilliseconds(): Promise<number | null> {+ if (!this.queryRead) return null;+ await this.queryRead.mapAsync(GPUMapMode.READ);+ const stamps = new BigUint64Array(this.queryRead.getMappedRange());+ const milliseconds = Number(stamps[1] - stamps[0]) / 1e6;+ this.queryRead.unmap();+ return milliseconds;+ }+ private releaseTextures() {+ for (const texture of [this.source, this.history, this.previousDepth])+ if (texture) this.owner.resources.release(texture);+ this.source = this.history = this.previousDepth = undefined;+ this.binding = undefined;+ }+ dispose() {+ this.releaseTextures();+ this.owner.resources.release(this.uniform);+ this.query?.destroy();+ if (this.queryResolve) this.owner.resources.release(this.queryResolve);+ if (this.queryRead) this.owner.resources.release(this.queryRead);+ }+}diff --git a/Aetheris.Web.Runtime/telos/tests/taa-browser.html b/Aetheris.Web.Runtime/telos/tests/taa-browser.htmlnew file mode 100644index 00000000..dd5bb74a--- /dev/null+++ b/Aetheris.Web.Runtime/telos/tests/taa-browser.html@@ -0,0 +1,5 @@+<!doctype html><html lang="en"><meta charset="utf-8"><title>Telos TAA X0 qualification</title>+<style>body{background:#18201c;color:#eee;font:16px system-ui}canvas{width:512px;height:512px}#reference{display:none}pre{white-space:pre-wrap}</style>+<h1>Light temporal AA / shared CIR and mesh</h1><div id="label"></div><canvas id="view"></canvas><canvas id="reference"></canvas><pre></pre>+<script type="importmap">{"imports":{"three":"/Aetheris.Web.Runtime/telos/node_modules/three/build/three.module.js"}}</script>+<script type="module" src="/artifacts/local/three-telos/browser/tests/taa-witness.js"></script></html>diff --git a/Aetheris.Web.Runtime/telos/tests/taa-witness.ts b/Aetheris.Web.Runtime/telos/tests/taa-witness.tsnew file mode 100644index 00000000..03554180--- /dev/null+++ b/Aetheris.Web.Runtime/telos/tests/taa-witness.ts@@ -0,0 +1,288 @@+import { Matrix4 } from "three";+import {+ TelosHost,+ materialFromAppearance,+ type TelosAAMode,+ type TelosScene,+ type TelosField,+ type TelosShaderArtifact,+} from "../src/index.js";+const errors: string[] = [];+const host = await TelosHost.create(+ document.querySelector<HTMLCanvasElement>("#view")!,+ (error) => errors.push(error),+);+const reference = await TelosHost.create(+ document.querySelector<HTMLCanvasElement>("#reference")!,+ (error) => errors.push(error),+);+if (!host.temporal)+ throw new Error("temporal pipeline unavailable: " + errors.join("; "));+// Explicit frame stepping, no browser RAF may add unrecorded samples to the experiment.+host.invalidate = () => {};+reference.invalidate = () => {};+for (const viewport of [host, reference]) {+ viewport.resize(512, 512, 1);+ viewport.camera.position.set(0, 0, 5);+ viewport.camera.target.set(0, 0, 0);+ viewport.camera.near = 0.1;+ viewport.camera.far = 30;+ viewport.camera.mode = "orthographic";+ viewport.camera.span = 4;+ viewport.camera.update();+ viewport.background = [0.02, 0.02, 0.02, 1];+}+const artifact = (await (+ await fetch("/artifacts/local/three-telos/cir/cylinder.json")+).json()) as TelosShaderArtifact;+const field: TelosField = {+ artifact,+ identity: { occurrenceId: "curved-cylinder" },+ bounds: { minimum: [-0.8, -0.8, -1], maximum: [0.8, 0.8, 1] },+ material: materialFromAppearance({+ baseColor: [0.95, 0.95, 0.95],+ metallic: 0,+ }),+};+const scene: TelosScene = {+ fields: [field],+ meshes: [+ {+ definition: {+ id: "dark-foreground",+ positions: [+ -1.5, -1.3, 1.2, -0.1, -1.3, 1.2, -1.5, 1.3, 1.2, -0.1, 1.3, 1.2,+ ],+ normals: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],+ indices: [0, 1, 2, 2, 1, 3],+ },+ identity: { occurrenceId: "foreground-mesh" },+ material: materialFromAppearance({ baseColor: [0.08, 0.18, 0.12] }),+ },+ ],+ lines: [+ {+ id: "topology",+ points: [-1.5, -1.3, 1.2, -0.1, -1.3, 1.2, -0.1, 1.3, 1.2],+ widthPixels: 1,+ identity: { occurrenceId: "foreground-mesh", edgeId: "sharp-boundary" },+ color: [1, 0.5, 0.05, 1],+ },+ ],+};+for (const viewport of [host, reference]) viewport.setScene(scene);+const results: Record<string, unknown>[] = [];+let previous: Uint8Array | undefined;+let mode: TelosAAMode = "None";+const api = {+ host,+ reference,+ errors,+ results,+ async start(next: TelosAAMode) {+ mode = next;+ host.setAA(next);+ host.temporal!.reset("controlled-witness");+ previous = undefined;+ host.camera.mode = "orthographic";+ host.camera.position.set(0, 0, 5);+ host.camera.target.set(0, 0, 0);+ host.camera.span = 4;+ host.camera.update();+ field.transform = new Matrix4().elements;+ host.setScene(scene);+ reference.setScene(scene);+ },+ async frame(scenario: string, index: number) {+ const angle =+ scenario === "orbit"+ ? index * 0.012+ : scenario === "fast"+ ? index * 0.13+ : 0;+ if (scenario === "disocclusion") {+ host.camera.position.set(index * 0.018, 0, 5);+ host.camera.target.set(index * 0.018, 0, 0);+ } else {+ host.camera.position.set(Math.sin(angle) * 5, 0, Math.cos(angle) * 5);+ host.camera.target.set(0, 0, 0);+ }+ if (scenario === "moving-occurrence") {+ field.transform = new Matrix4().makeTranslation(+ index * 0.035,+ 0,+ 0,+ ).elements;+ host.setScene(scene);+ reference.setScene(scene);+ }+ host.camera.update();+ reference.camera.position.copy(host.camera.position);+ reference.camera.target.copy(host.camera.target);+ reference.camera.update();+ const ray = host.camera.worldRay([256, 256]);+ const start = performance.now();+ host.render();+ const readback = host.readPixels();+ await host.owner.device.queue.onSubmittedWorkDone();+ const completedMs = performance.now() - start;+ const pixels = await readback;+ const resolveGpuMs =+ mode === "TAA" || mode === "TAAUtility"+ ? await host.temporal!.readGpuMilliseconds()+ : null;+ reference.render();+ const expected = await reference.readPixels();+ let ghost = 0;+ let backgroundPixels = 0;+ let difference = 0;+ let imageError = 0;+ // Only pixels outside geometry by >=2 physical pixels: avoid counting sample coverage as a trail.+ for (let y = 2; y < 510; y++)+ for (let x = 2; x < 510; x++) {+ const i = (y * 512 + x) * 4;+ let background = true;+ for (const [dx, dy] of [+ [0, 0],+ [-2, 0],+ [2, 0],+ [0, -2],+ [0, 2],+ ]) {+ const j = ((y + dy) * 512 + x + dx) * 4;+ if (expected[j] > 10 || expected[j + 1] > 10 || expected[j + 2] > 10)+ background = false;+ }+ if (background) {+ ghost +=+ Math.max(0, pixels[i] - expected[i]) ++ Math.max(0, pixels[i + 1] - expected[i + 1]) ++ Math.max(0, pixels[i + 2] - expected[i + 2]);+ backgroundPixels++;+ }+ imageError +=+ Math.abs(pixels[i] - expected[i]) ++ Math.abs(pixels[i + 1] - expected[i + 1]) ++ Math.abs(pixels[i + 2] - expected[i + 2]);+ if (previous)+ difference +=+ Math.abs(pixels[i] - previous[i]) ++ Math.abs(pixels[i + 1] - previous[i + 1]) ++ Math.abs(pixels[i + 2] - previous[i + 2]);+ }+ previous = pixels;+ if (!host.camera.worldRay([256, 256]).direction.equals(ray.direction))+ throw new Error("picking jittered");+ if (errors.length) throw new Error(errors.join("; "));+ const result = {+ mode,+ scenario,+ index,+ completedMs,+ resolveGpuMs,+ encodeMs: host.metrics.frameMs,+ resolveEncodeMs: host.temporal!.resolveEncodeMs,+ reprojectionCpuMs: host.temporal!.reprojectionCpuMs,+ ghostEnergy: ghost / Math.max(backgroundPixels * 3, 1),+ imageError: imageError / (512 * 512 * 3),+ temporalDifference: difference / (512 * 512 * 3),+ resetReason: host.temporal!.lastResetReason,+ };+ results.push(result);+ document.querySelector("#label")!.textContent =+ `${mode} / ${scenario} / frame ${index}`;+ return result;+ },+ async quality(next: TelosAAMode) {+ await api.start(next);+ reference.resize(512, 512, 4);+ reference.render();+ const highResolution = await reference.readPixels();+ let current!: Uint8Array;+ for (let frame = 0; frame < 16; frame++) {+ host.render();+ current = await host.readPixels();+ }+ let absoluteError = 0;+ for (let y = 0; y < 512; y++)+ for (let x = 0; x < 512; x++) {+ for (let channel = 0; channel < 3; channel++) {+ let sum = 0;+ for (let dy = 0; dy < 4; dy++)+ for (let dx = 0; dx < 4; dx++)+ sum +=+ highResolution[+ ((y * 4 + dy) * 2048 + x * 4 + dx) * 4 + channel+ ];+ absoluteError += Math.abs(+ current[(y * 512 + x) * 4 + channel] - sum / 16,+ );+ }+ }+ reference.resize(512, 512, 1);+ if (errors.length) throw new Error(errors.join("; "));+ return {+ mode: next,+ samplesPerReferencePixel: 16,+ meanAbsoluteError: absoluteError / (512 * 512 * 3),+ };+ },+ async realCad(next: TelosAAMode) {+ const packet = await (+ await fetch("/artifacts/local/three-telos/x1/ctc03-display.json")+ ).json();+ const meshes = packet.data.faces+ .filter((face: any) => face.meshPatch)+ .map((face: any) => {+ const mesh = face.meshPatch;+ const flatten = (points: any[]) =>+ points.flatMap((point) => [point.x, point.y, point.z]);+ return {+ definition: {+ id: "ctc03:" + face.faceId,+ positions: flatten(mesh.positions),+ normals: flatten(mesh.normals),+ indices: mesh.triangleIndices,+ },+ identity: { occurrenceId: "ctc03", faceId: face.faceId },+ material: materialFromAppearance({ baseColor: [0.7, 0.74, 0.78] }),+ };+ });+ host.setScene({ meshes, fields: [], lines: [] });+ host.camera.mode = "perspective";+ host.fit();+ host.setAA(next);+ for (let frame = 0; frame < 16; frame++) {+ host.render();+ await host.readPixels();+ }+ if (errors.length) throw new Error(errors.join("; "));+ return {+ faces: meshes.length,+ mode: next,+ resetReason: host.temporal!.lastResetReason,+ };+ },+ async debug() {+ host.setAA(mode, "policy");+ host.render();+ const pixels = await host.readPixels();+ const counts = { reject: 0, stable: 0, clamp: 0, edge: 0 };+ for (let i = 0; i < pixels.length; i += 4) {+ // BGRA bytes on this qualified Edge adapter.+ if (pixels[i + 2] > 240 && pixels[i + 1] < 20) counts.reject++;+ if (pixels[i + 1] > 240 && pixels[i + 2] < 20) counts.stable++;+ if (pixels[i + 1] > 240 && pixels[i + 2] > 240) counts.clamp++;+ if (pixels[i] > 240 && pixels[i + 2] < 20) counts.edge++;+ }+ if (errors.length) throw new Error(errors.join("; "));+ return counts;+ },+ dispose() {+ host.dispose();+ reference.dispose();+ },+};+(window as unknown as { taa: typeof api }).taa = api;+document.querySelector("pre")!.textContent =+ "Ready. Explicit frames, shared CIR/mesh depth, stable picking.";diff --git a/Aetheris.Web.Runtime/telos/tests/temporal.test.ts b/Aetheris.Web.Runtime/telos/tests/temporal.test.tsnew file mode 100644index 00000000..641d9c23--- /dev/null+++ b/Aetheris.Web.Runtime/telos/tests/temporal.test.ts@@ -0,0 +1,32 @@+import { test } from "node:test";+import assert from "node:assert/strict";+import { Vector3 } from "three";+import {+ TelosCamera,+ temporalProjection,+ temporalJitter,+} from "../dist/index.js";+for (const mode of ["perspective", "orthographic"] as const) {+ test(`${mode}: render jitter is bounded and logical picking is invariant`, () => {+ const camera = new TelosCamera();+ camera.mode = mode;+ camera.resize(800, 600);+ camera.update();+ const original = camera.viewProjection.clone();+ const ray = camera.worldRay([400, 300]);+ const world = new Vector3(0.2, 0.1, 0);+ const logical = world.clone().applyMatrix4(original);+ for (let frame = 0; frame < 24; frame++) {+ const jitter = temporalJitter(frame);+ const render = world+ .clone()+ .applyMatrix4(temporalProjection(camera, 1600, 1200, frame));+ assert.ok(Math.abs((render.x - logical.x) * 800 - jitter[0]) < 1e-9);+ assert.ok(Math.abs((render.y - logical.y) * -600 - jitter[1]) < 1e-9);+ assert.ok(jitter.every((value) => Math.abs(value) <= 0.5));+ assert.deepEqual(camera.viewProjection.elements, original.elements);+ assert.deepEqual(camera.worldRay([400, 300]), ray);+ assert.deepEqual(jitter, temporalJitter(frame + 8));+ }+ });+}diff --git a/Aetheris.Web.Runtime/telos/tsconfig.browser.json b/Aetheris.Web.Runtime/telos/tsconfig.browser.jsonindex 4d17fa86..b36db3e3 100644--- a/Aetheris.Web.Runtime/telos/tsconfig.browser.json+++ b/Aetheris.Web.Runtime/telos/tsconfig.browser.json@@ -1,5 +1,5 @@{"extends": "./tsconfig.json","compilerOptions": { "rootDir": ".", "outDir": "../../artifacts/local/three-telos/browser", "declaration": false },- "include": ["src/**/*.ts", "tests/browser-witness.ts"]+ "include": ["src/**/*.ts", "tests/browser-witness.ts", "tests/taa-witness.ts"]}diff --git a/aetheris.client/src/viewer/AetherisViewport.tsx b/aetheris.client/src/viewer/AetherisViewport.tsxindex 262ac172..48fb8a60 100644--- a/aetheris.client/src/viewer/AetherisViewport.tsx+++ b/aetheris.client/src/viewer/AetherisViewport.tsx@@ -54,6 +54,7 @@ function TelosViewport(props: AetherisViewportProps) {if (!current) return;const value = latest.current,theme = value.theme ?? ATELIER_VIEWPORT_THEME;+ current.setAA(value.aaMode ?? "SpatialOnly", value.aaDebug ?? "color");current.setScene(cadmataTelosScene(value));current.background = clearColor(theme.sceneBackground);current.grid = value.showGrid !== false && theme.gridStyle.enabled;diff --git a/aetheris.client/src/viewer/viewportProps.ts b/aetheris.client/src/viewer/viewportProps.tsindex 80f3a20a..6caa2139 100644--- a/aetheris.client/src/viewer/viewportProps.ts+++ b/aetheris.client/src/viewer/viewportProps.ts@@ -5,6 +5,9 @@ import type { CadmataLayerVisibility } from "./cadmataLayers";import type { PmiVisibility } from "./pmiPresentation";import type { ViewportTheme } from "./viewportTheme";export interface AetherisViewportProps {+ /** Bounded shared Telos developer comparison controls; spatial AA remains the default. */+ aaMode?: import("@aetheris/three-telos").TelosAAMode;+ aaDebug?: import("@aetheris/three-telos").TelosAADebug;/** Optional host inspection seam for integration/qualification; does not transfer camera ownership. */onHostReady?: (host: import("@aetheris/three-telos").TelosHost) => void;displayScene?: DisplayScene | null;diff --git a/docs/release/TELOS-TAA-X0.md b/docs/release/TELOS-TAA-X0.mdnew file mode 100644index 00000000..d0a8eb5c--- /dev/null+++ b/docs/release/TELOS-TAA-X0.md@@ -0,0 +1,182 @@+# TELOS-TAA-X0++Verdict: **Meaningful progression**, 2026-10-05. The missing utility frontend/lowering prerequisite is removed, and the shared experimental temporal path renders real WebGPU mesh, CIR and mixed scenes. **The visual acceptance question remains unresolved.** Utility reduces error against a supersampled static reference compared with fixed TAA, but both temporal modes are worse than spatial-only in that witness. Spatial AA remains the product default. No claim of useful silhouette convergence or superior ghosting is made.++## Executive answer and exact next blocker++Three Telos can own conservative temporal resources and execute a deterministic, source-authored utility resolve without a per-pixel CPU policy. This run does not yet prove that it provides better CAD AA than the existing spatial path.++The next bounded blocker is **subpixel silhouette coverage/correspondence in the shared resolve**. `temporal-resolve.wgsl` requires both current and previous pixels to contain geometry and uses nearest previous-depth evidence. Background/foreground coverage changes fail correspondence; those pixels use the current jittered sample rather than integrating valid edge coverage. Strong depth rejection protects against ghosts but leaves sample-phase variation. The measured static image errors below make this a concrete quality failure rather than a subjective tuning concern. Do not increase history weights to conceal it.++Smallest next repair: distinguish bounded edge-coverage evidence from interior surface correspondence in Telos, improve the confidence test at fractional reprojection positions, and rerun this exact supersampled reference and motion witness. Keep selection rays and post-resolve topology stable. A transform-history redesign, CIR rebuild, product-specific resolve, or general policy engine is not justified by this result.++## Utility syntax audit++| Owner before this work | Syntax/status found | Actual lowering/ownership |+| --- | --- | --- |+| Copeland TS | No implemented `decide` or `when utility` expression in the ordinary parser or graphics binder. | Graphics used ordinary locals, comparisons, branches and helper calls in VD-MIR. No shader-compatible utility runtime existed. |+| Older Aurelian SDSL-V in Copeland | Lexer `KeywordUtility`, `SdslvWhenUtilityExpression`, candidate/options AST records. | Declaration scaffolding is not implementation: `HlslEmitter` explicitly lists this expression as unsupported; no completed parser/binder utility lane was found. |+| Copeland-hosted Dominatus | `Ai.Decide` / `Ai.Option`, explicit option scoring, controller commitment/hysteresis and reports. | CLR agent/controller policy. It is implemented, but is not Copeland TS syntax or shader lowering and must not become a per-pixel CPU decision path. |+| Oct | Standalone `when utility { case value when Bool score Int ... else value }`; enum-targeted form; separate controller-bound `when policy`. | AST, parser, typecheck, interpreter and compiled ordinary-block lowering are present. Guards once in source order, score only when eligible, greatest score, earliest-source tie, only selected result evaluated. Required fallback, compatible result types. Standalone form has no commitment or policy fields. |+| Aetheris JudgmentEngine | Named admissible candidates, normalized utility helpers, finite scores, rejection reporting and deterministic priority/source ties. | Existing .NET bounded judgment authority; not shader syntax. Its finite/admissible/deterministic model is reused conceptually, without duplicating its runtime on the GPU or adding CPU decisions. |++Audit source pointers: Copeland `src/Copeland/Copeland.TS/Syntax`, `Gpu/GpuGraphicsBinder.cs`; `src/Aurelian/Aurelian.Shaders/Language/{Tokens,Ast,Emission/Hlsl}`; Oct `Language/reference/runtime/21-octomata.md`, `internal/ast/program.go`, `internal/typecheck/typecheck.go`, `internal/interpret/interpret.go`, and compiled utility corpus/lowering; Aetheris `Aetheris.Kernel.Core/Judgment/JudgmentEngine.cs`. Oct was inspected without changing its source.++### Chosen canonical syntax for this milestone++Reuse Oct's one-shot form in the **Copeland graphics GPU profile**:++```typescript+return when utility {+ case RejectHistory() when true score Score(risk)+ case StableHistory(stable) when depth > 0.8 && motion > 0.7 && edge < 0.2 score Score(stable)+ case ClampedHistory(clamped) when depth > 0.8 && motion > 0.5 && edge < 0.2 score Score(clamped)+ case EdgeConservative(depth * motion * color) when depth > 0.8 && motion > 0.8 && color > 0.8 && edge >= 0.2 score Score(depth * motion * color)+ else RejectHistory()+};+```++The GPU subset already admits `u32`, rather than Oct's signed `Int`, so **every score is explicitly `u32`**. Author confidence as `f32`; `Score` maps it to finite integer buckets 0,20,40,60,80,100. This introduces no floating/NaN score law. Cases number 1–16, guards are `bool`, all results/fallback share one type, ties keep the earliest source case. Reject is first, so uncertain ties favor rejection. Result functions give alternatives visible names; this subset does not yet admit GPU judgment enums.++Added: shared syntax AST/parser, bounded graphics typechecking and normalization to a closed helper with ordinary `local`, `if`, `assign`, `return`, numeric comparisons and call expressions. Guards execute once, ineligible scores do not execute, and only the selected value executes. Nested choices are supported. No special utility instruction reaches VD-MIR, WGSL or HLSL. Host compilation explicitly refuses the form with `COPE-UTILITY-PROFILE-0001`; compute utility, enum-targeted choices, host utility, hysteresis and commitment remain unqualified. This is a candidate canonical **one-shot shader form**, not a declaration of complete host-language parity.++The direct WGSL backend now exposes compiler-owned source-function/emitted-name metadata for static linkage. The offline generator uses that map to generate `telosPolicy`, avoiding guessed backend names or runtime reflection. `fixtures/three-telos/temporal-policy.v.ts` owns all actual policy scoring, admissibility, weights and winner selection. Its generated runtime WGSL is a necessary package asset with a reproduction command, not a handwritten substitute for utility. Sampling/reprojection/clamping are ordinary Telos WGSL plumbing.++## Shared architecture and temporal inputs++`TelosTemporal` belongs to Three Telos, alongside `TelosHost`, `TelosFrame` and `TelosCamera`. Cadmata and the actual sibling Helios wrapper accept `aaMode`/`aaDebug` and call the same `host.setAA`; there is no second temporal implementation. Both default to `SpatialOnly`. `None` disables temporal resolve/jitter, while intrinsic line coverage AA remains active in all modes. `TAA` is the fixed baseline; `TAAUtility` is the experiment.++Minimum inputs: current surface color and authoritative `depth32float`; previous resolved surface color and previous authoritative depth; current inverse jittered VP, previous jittered VP and its inverse. Reconstructed world points use WebGPU [0,1] depth. CIR writes depth at its analytic hit, so the same reconstruction works for CIR and mesh pixels. Additional normal/identity attachments were not introduced: they cost bandwidth and require changing the admitted field output ABI. Appearance, visibility, selection, geometry and occurrence updates invalidate the whole history through `setScene`, preserving correctness without identity buffers.++Eight Halton(2,3) samples are bounded to half a physical pixel. Rendering consumes separate jittered matrices and CIR rays; `camera.project`, `unproject`, `worldRay`, PMI projection and engineering picking retain the logical unjittered camera. Both orthographic and perspective math are checked. A static dirty viewport requests eight accumulation frames and then stops scheduling. Interactive camera input requests further frames; direct qualification stepping disables RAF so there are no unrecorded samples.++Camera-only reprojection is supported. **No retained previous occurrence transforms existed to reuse.** Moving occurrences therefore reset all history through `setScene`; they do not claim object-motion reprojection. Callers must respect the existing immutable scene/geometry contract and submit transform/appearance changes through `setScene`.++### Policies and parameters++| Policy | Weight | Reason |+| --- | --- | --- |+| RejectHistory | 0 | Always admissible; score is maximum depth/motion risk or edge-plus-color risk. Conservative ties favor this arm. |+| StableHistory | 0.50 | High depth/motion/color confidence, away from edges. |+| ClampedHistory | 0.25 | Valid correspondence with neighborhood/color disagreement. |+| EdgeConservative | 0.12 | Valid, slow, color-consistent edge evidence. |++Stable score is depth × motion × color × (1−edge). Clamp score is depth × motion × (1−color) × (1−edge). Reject score is max(1−depth,1−motion,edge×(1−color)). All accepted histories are clipped to a bounded 3×3 current RGB min/max range, including the stable policy.++Depth confidence drops with previous-world separation measured in current pixel footprint, to zero at two footprints; admission >0.8 means less than 0.4 footprint discrepancy. This is intentionally strict and contributes to the isolated coverage issue. Motion allows <1 pixel of sample jitter and drops to zero by 8 pixels/frame. Luminance confidence drops to zero at a 0.15 normalized-color difference. Edge risk comes from a 3×3 depth discontinuity measured against four pixel footprints. These are documented experimental thresholds, not universal CAD tuning. No normal-agreement claim is made.++The baseline uses the same jitter, reprojection, depth admission and neighborhood clamp with fixed 0.50 history. Thus the comparison changes policy, not resources or sampling. Policy debug colors are red reject, green stable, yellow clamp and blue edge. Confidence, motion and depth disagreement views are also available. Debug rendering reads frozen last color history; debug pixels never enter history. Seed a color view first to inspect accumulated decisions.++### Pass order and lifecycle++Background → opaque mesh → CIR field → temporal resolve → capture surface history/depth → reference grid → topology → authoring/selection overlays → DOM PMI/presentation. Topology and authoring geometry use logical camera projection. DOM PMI never enters a GPU history texture. The line shader now computes local derivative coverage on expanded screen-space quads; this was missing in the original hard-edged line shader. It does not temporally accumulate lines or replace BRep topology authority.++Resize/resource generation, DPR, camera mode/projection parameters, AA mode, and `setScene` invalidate history. Appearance/selection updates deliberately reset rather than leave old colors. GPU loss keeps the existing host-stop diagnostic behavior. Missing temporal assets or pipeline validation failure retains spatial viewport startup. Temporal textures are created only on the first enabled render, retained across frames, recreated on physical-size changes and released on disposal. Returning to spatial mode retains the allocated temporal textures for reuse until resize/disposal; this memory behavior is explicit.++Logical topology depth testing against jittered surface depth can still disagree within half a pixel near silhouettes; strict topology occlusion/coverage parity in temporal mode is not accepted.++## Memory++Color source/history use the adapter's ordinary `bgra8unorm`/`rgba8unorm`, not HDR. Previous depth is `depth32float`. Additional temporal texture storage is **12 bytes per physical pixel**: source color, history color, previous depth. Existing current depth/canvas storage is excluded. One 224-byte uniform and optional timestamp query/readback storage are negligible next to the textures.++| CSS viewport / DPR | Physical dimensions | Additional temporal textures |+| --- | --- | --- |+| 1080p / 1 | 1920×1080 | 23.73 MiB |+| 1440p / 1 | 2560×1440 | 42.19 MiB |+| 1080p / 2 | 3840×2160 | 94.92 MiB |+| 1440p / 2 | 5120×2880 | 168.75 MiB |++These are allocation arithmetic, not browser memory telemetry. Large-DPR performance/OOM behavior is unqualified.++## Controlled browser evidence and comparison++Real Edge WebGPU, 512×512 physical pixels, deterministic 24-frame sequences for each mode: static mixed mesh/CIR, orbit, fast camera, disocclusion behind a foreground edge, and moving occurrence. Includes a bright direct-WGSL CIR cylinder, a dark mesh foreground and thin topology strokes. All 360 recorded frames complete without GPU validation/page errors; canonical picking rays remain unchanged by rendering. Policy debug includes 77,071 stable and 410 conservative-edge pixels; rejected pixels include the background. This static witness did not exercise a winning clamped policy; its branch exists and typechecks, but branch occupancy is not claimed.++The nontrivial CTC03 mechanical STEP witness renders all 129 faces in each mode, with bends, holes and slots. Repository CLI inspection independently reports one body, one shell, 129 faces, 306 edges and 198 vertices. The CAD capture consumes the existing Cadmata display packet; this is a shared-host mesh witness, not an interactive TAA qualification of both products or a real-part CIR admission claim.++Static quality reference: render the same scene at DPR4 (2048²), box-average 16 physical samples per 512² output pixel, compare RGB mean absolute error in 8-bit channel units after 16 controlled frames:++| Mode | Error to supersampled reference |+| --- | --- |+| Spatial/no temporal | 0.105024 |+| Fixed TAA | 0.170217 |+| Utility TAA | 0.145127 |++Utility is about 14.7% better than baseline for this one static capture, but about 38.2% worse than spatial-only. This is **not** successful AA qualification. Motion image difference against the unjittered render is a diagnostic, not an anti-alias ground truth; static frame-to-frame variation remains nonzero in temporal modes. No progressive-blur acceptance claim is made.++Ghost energy samples background pixels at least two pixels outside the unjittered visible geometry. Both temporal paths have essentially zero energy there, so this witness does not distinguish their ghosting quality. Pixel-boundary coverage and subpixel trails are outside that metric. Inspect the motion recording before judging visual quality; there is no validated superior-ghosting claim.++Raw local evidence: `artifacts/local/telos-taa/browser/metrics.json`, `policy-counts.json`, mode/scenario PNGs, `utility-policy.png`, CTC03 captures and `comparison.webm`. The recording labels each mode/scenario and includes controlled motion. Raw captures are ignored generated output and are not promoted into source control. `fallback.json` qualifies startup/rendering after deliberately blocking both temporal shader assets; the host remains running in `SpatialOnly`.++## Measured performance++Local Edge run only, same 512² mixed CIR/mesh witness. Warm-frame arithmetic means over frames 8–23; browser CPU timer granularity makes sub-0.1ms CPU values noisy. GPU resolve duration comes from optional WebGPU timestamp queries. Queue-completion time includes drawing, resolve/copies and qualification readback-copy submission; it is not a production presented-frame percentile or display latency. History copies are outside the resolve GPU timestamp interval. No large-viewport scaling or universal performance claim follows.++| Mode | View | Resolve GPU ms | Resolve encode CPU ms | Reprojection/setup CPU ms | Queue completion ms |+| --- | --- | --- | --- | --- | --- |+| None | static | — | 0.000 | 0.000 | 3.825 |+| None | orbit | — | 0.000 | 0.000 | 3.556 |+| None | fast | — | 0.000 | 0.000 | 3.875 |+| None | disocclusion | — | 0.000 | 0.000 | 5.037 |+| None | moving-occurrence | — | 0.000 | 0.000 | 5.463 |+| TAA | static | 0.283 | 0.031 | 0.000 | 6.250 |+| TAA | orbit | 0.426 | 0.019 | 0.013 | 5.694 |+| TAA | fast | 0.446 | 0.000 | 0.013 | 5.613 |+| TAA | disocclusion | 0.315 | 0.025 | 0.012 | 6.287 |+| TAA | moving-occurrence | 0.344 | 0.013 | 0.006 | 6.219 |+| TAAUtility | static | 0.369 | 0.031 | 0.000 | 6.506 |+| TAAUtility | orbit | 0.348 | 0.025 | 0.000 | 5.987 |+| TAAUtility | fast | 0.565 | 0.013 | 0.006 | 5.787 |+| TAAUtility | disocclusion | 0.295 | 0.000 | 0.000 | 6.325 |+| TAAUtility | moving-occurrence | 0.373 | 0.031 | 0.000 | 6.375 |++## Validation and qualification limits++- Aetheris Release solution build: 0 errors, 10 existing WebAssembly warnings. Fast lane: 1,005 passed. Full serial lane: **4,312 passed**, 20 projects, no failures/skips. No legacy Zig lane was changed or needed.+- Copeland TS full suite: **1,394 passed**, including utility selection, expression scores, zero/equal ties, fallback, incompatible scores/guards/results, nested choices, bounded case count, source-map/symbol linkage and explicit host refusal.+- Aurelian shader suite: **152 passed**. New utility test emits ordinary HLSL and validates vertex/fragment SPIR-V through native tools. The first full run found missing Naga; installed the repository-documented pinned Naga 27.0.0 under ignored local output and reran successfully. The Telos direct WGSL runtime/compiler path does not require Naga.+- Telos strict TypeScript/build/unit checks: 9 passed, including render-only jitter bounds and exact logical ray stability for both camera modes. Browser runtime compilation validates the generated policy and plumbing together.+- Cadmata production frontend build and **85 tests pass**. Helios development build and **29 tests pass**. Helios production build refuses the installed non-AOT SDK with its existing explicit message: `Production requires the AOT SDK package. Run npm run sdk:install:production.` No SDK republish/AOT packaging expansion was attempted for this graphics milestone.+- The ordinary spatial/mixed-depth browser witness also passes with optional temporal assets blocked. Product-level TAA camera/PMI/selection motion remains unqualified; optional controls are integrated and built, not declared production accepted.++## Friction log++| Friction | Workaround / owner / permanent repair / status |+| --- | --- |+| Utility language gap | Removed in Copeland graphics frontend; ordinary VD-MIR normalization. Host/compute/enum-targeted utility explicitly deferred. |+| WGSL helper naming | Removed by compiler-owned FunctionNames metadata and generated static shim. No text guessing or runtime reflection. |+| Missing occurrence motion data | Safe workaround: whole-history reset on `setScene`. Owner Telos scene lifecycle. Retained previous transforms/identity correspondence remain deferred; do not infer camera-only motion for moved objects. |+| Silhouette/reprojection confidence | Existing strict rejection prevents stale trails but does not integrate fractional coverage. Owner shared Telos resolve/local primitive coverage. Next bounded repair; concrete supersampled failure above. |+| CIR/mesh mismatch | Shared analytic-hit/mesh depth reprojection works in one frame; smooth fractional CIR silhouette accumulation is not accepted. Avoid changing CIR authority. |+| Topology smear/occlusion | Lines stay after resolve and get local spatial coverage. No temporal smear; half-pixel surface-depth/line alignment remains a qualification limit. |+| Appearance changes | Whole-history reset; no prior colors retained through scene updates. Per-occurrence selective invalidation deferred. |+| History format | Standard UNORM + depth32float qualified at 512². DPR2 cost is significant; large viewport allocation/OOM recovery unqualified. |+| Browser readback | Canvas swap texture can expire after an awaited frame boundary. Qualification submits readback immediately after `render`; await its completion afterwards. Persistent screenshot staging is not introduced. |+| Browser feature/assets | Optional temporal loading/pipeline fallback; missing-assets spatial rendering qualified. Timestamp availability never gates startup. GPU loss follows existing stop diagnostic. |+| Toolchain | Legacy shader suite needed pinned Naga; local installation removed that environment blocker. Direct WGSL remains managed. |+| Helios production package | Development integration passes. AOT SDK package is absent in current installation; production packaging remains a separate explicit gap. |++## Code-quality review++One shared owner contains history, jitter, reprojection, resolve and optional timing. Policy lives only in source VTS; there is no duplicate CPU scoring function or handwritten WGSL policy. Generated shader names come from the compiler's ABI metadata. Uniform storage and VP/inverse matrices are retained; render projection accepts a retained output matrix. Textures and bind groups are created only on size generation changes. Existing per-draw host/field allocations remain outside this milestone; no claim of an allocation-free renderer is made. Repeated primary scene updates intentionally trade accumulation for correctness. Both products merely pass shared AA settings. No background services, schedules, parallel rule engine, model inference, DOM filtering or new CIR engine were added.++## Reproduction++From the Aetheris root, with the explicitly supplied Copeland compiler checkout and a Playwright module:++```powershell+./scripts/prepare-telos-temporal-policy.ps1 -CopelandRoot <CopelandRoot>+./scripts/prepare-three-telos-cir.ps1 -CopelandRoot <CopelandRoot>+npm --prefix Aetheris.Web.Runtime/telos test+npm --prefix Aetheris.Web.Runtime/telos run build:witness+node scripts/qualify-telos-taa.mts <absolute-playwright-index.mjs>+node scripts/qualify-telos-taa.mts <absolute-playwright-index.mjs> --fallback-only+```++The mechanical-model phase reuses `artifacts/local/three-telos/x1/ctc03-display.json` from `scripts/qualify-three-telos-x1.mts`; regenerate that canonical display packet first on a clean machine. Its source is the tracked CTC03 STEP under `docs/development/milestones/modules/sheetmetal/artifacts/ctc03-manufacturing-release/`. All raw logs, runtime probes and captures default to ignored `artifacts/local/`.++## Acceptance status++Language audit, bounded utility lowering, shared history ownership, render-only jitter, camera reprojection, baseline/utility policies, clamp, rejection, debug modes, CIR/mesh/mixed rendering, conservative moving-object rejection and developer product controls exist and have real-path evidence. Relevant compiler/kernel/frontend regressions pass as scoped above.++**Withhold Accepted**: useful silhouette AA against the spatial reference fails; superior ghosting is not established; temporal topology occlusion/product PMI interaction and object-motion reprojection remain unqualified; Helios production AOT packaging is absent. These boundaries are explicit, and the default spatial viewport remains preserved. The next action is the isolated fractional-coverage/confidence repair, not more history-weight tuning.diff --git a/fixtures/three-telos/temporal-policy.v.ts b/fixtures/three-telos/temporal-policy.v.tsnew file mode 100644index 00000000..75db09d0--- /dev/null+++ b/fixtures/three-telos/temporal-policy.v.ts@@ -0,0 +1,37 @@+// Finite deterministic policy. Integer score buckets preserve Oct's no-NaN score law.+// Result: policy (0 reject, 1 stable, 2 clamped, 3 edge), history weight, confidence.+function Score(confidence: f32): u32 {+ if (confidence >= 0.9) { return 100; }+ if (confidence >= 0.7) { return 80; }+ if (confidence >= 0.5) { return 60; }+ if (confidence >= 0.3) { return 40; }+ if (confidence >= 0.1) { return 20; }+ return 0;+}+function RejectHistory(): float3 { return float3(0.0, 0.0, 0.0); }+function StableHistory(confidence: f32): float3 { return float3(1.0, 0.5, confidence); }+function ClampedHistory(confidence: f32): float3 { return float3(2.0, 0.25, confidence); }+function EdgeConservative(confidence: f32): float3 { return float3(3.0, 0.12, confidence); }+function TemporalPolicy(depth: f32, motion: f32, color: f32, edge: f32): float3 {+ const stable: f32 = depth * motion * color * (1.0 - edge);+ const clamped: f32 = depth * motion * (1.0 - color) * (1.0 - edge);+ const risk: f32 = Max(1.0 - depth, Max(1.0 - motion, edge * (1.0 - color)));+ return when utility {+ case RejectHistory() when true score Score(risk)+ case StableHistory(stable) when depth > 0.8 && motion > 0.7 && edge < 0.2 score Score(stable)+ case ClampedHistory(clamped) when depth > 0.8 && motion > 0.5 && edge < 0.2 score Score(clamped)+ case EdgeConservative(depth * motion * color) when depth > 0.8 && motion > 0.8 && color > 0.8 && edge >= 0.2 score Score(depth * motion * color)+ else RejectHistory()+ };+}+// Compiler linking witness; the runtime calls TemporalPolicy using compiler-owned symbol metadata.+@space(clip.position) type Clip = float4;+stream Input { @location(0) position: float3; }+stream Varyings { @builtin(position) position: Clip; @location(0) evidence: float4; }+stream Output { @target(0) color: float4; }+@vertex function VertexMain(input: Input): Varyings {+ return { position: float4(input.position, 1.0), evidence: float4(1.0, 1.0, 1.0, 0.0) };+}+@pixel function PixelMain(input: Varyings): Output {+ return { color: float4(TemporalPolicy(input.evidence.x, input.evidence.y, input.evidence.z, input.evidence.w), 1.0) };+}diff --git a/scripts/compile-telos-temporal-policy.cs b/scripts/compile-telos-temporal-policy.csnew file mode 100644index 00000000..a552a8cd--- /dev/null+++ b/scripts/compile-telos-temporal-policy.cs@@ -0,0 +1,28 @@+using Copeland.TS.Gpu;+using Copeland.TS.Gpu.VdMir;+using Copeland.TS.Gpu.Wgsl;++string source = File.ReadAllText(args[0]);+var request = new GpuCompilationRequest([new GpuSourceFile("temporal-policy.v.ts", source)]);+var result = WgslGraphicsBackend.Compile(request);+if (!result.Success)+{+ throw new InvalidOperationException(string.Join("\n",+ result.Diagnostics.Select(diagnostic => diagnostic.Code + ": " + diagnostic.Message)));+}++var program = result.Program!;+string policyName = program.FunctionNames["TemporalPolicy"];+string shim = $$"""+++// Source: fixtures/three-telos/temporal-policy.v.ts+// Semantic hash: {{program.SemanticHash}}+// Static linkage from compiler-owned FunctionNames.+fn telosPolicy(depth: f32, motion: f32, color: f32, edge: f32) -> vec3<f32> {+ return {{policyName}}(depth, motion, color, edge);+}++""";+File.WriteAllText(args[1], program.Code + shim);+Console.WriteLine("Temporal policy -> ordinary VD-MIR -> direct WGSL: " + program.SemanticHash);diff --git a/scripts/prepare-telos-temporal-policy.ps1 b/scripts/prepare-telos-temporal-policy.ps1new file mode 100644index 00000000..6eddf050--- /dev/null+++ b/scripts/prepare-telos-temporal-policy.ps1@@ -0,0 +1,15 @@+param([Parameter(Mandatory=$true)][string]$CopelandRoot)+$ErrorActionPreference = 'Stop'+$repo = Split-Path $PSScriptRoot -Parent+$output = Join-Path $repo 'artifacts/local/telos-taa/compiler'+New-Item -ItemType Directory -Force -Path $output | Out-Null+$backend = [Security.SecurityElement]::Escape((Join-Path $CopelandRoot 'src/Copeland/Copeland.TS.Backend.Wgsl/Copeland.TS.Backend.Wgsl.csproj'))+@"+<Project Sdk="Microsoft.NET.Sdk">+ <PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup>+ <ItemGroup><ProjectReference Include="$backend"/></ItemGroup>+</Project>+"@ | Set-Content -LiteralPath (Join-Path $output 'Compiler.csproj')+Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'compile-telos-temporal-policy.cs') -Destination (Join-Path $output 'Program.cs')+dotnet run --project (Join-Path $output 'Compiler.csproj') -c Release -- (Join-Path $repo 'fixtures/three-telos/temporal-policy.v.ts') (Join-Path $repo 'Aetheris.Web.Runtime/telos/src/shaders/temporal-policy.wgsl')+if ($LASTEXITCODE -ne 0) { throw 'Temporal policy compilation failed.' }diff --git a/scripts/qualify-telos-taa.mts b/scripts/qualify-telos-taa.mtsnew file mode 100644index 00000000..be3eb08e--- /dev/null+++ b/scripts/qualify-telos-taa.mts@@ -0,0 +1,176 @@+import { createServer } from "node:http";+import { readFile, mkdir, writeFile } from "node:fs/promises";+import { resolve, extname, sep } from "node:path";+import { pathToFileURL } from "node:url";+const { chromium } = await import(pathToFileURL(resolve(process.argv[2])).href);+const repo = process.cwd();+const output = resolve(repo, "artifacts/local/telos-taa/browser");+await mkdir(output, { recursive: true });+const server = createServer(async (request, response) => {+ try {+ const file = resolve(+ repo,+ "." ++ decodeURIComponent(new URL(request.url!, "http://localhost").pathname),+ );+ if (!file.startsWith(repo + sep)) throw new Error("outside repo");+ response.setHeader(+ "Content-Type",+ (+ {+ ".js": "text/javascript",+ ".html": "text/html",+ ".json": "application/json",+ } as Record<string, string>+ )[extname(file)] ?? "application/octet-stream",+ );+ response.end(await readFile(file));+ } catch {+ response.statusCode = 404;+ response.end("missing");+ }+});+await new Promise<void>((done) => server.listen(0, "127.0.0.1", done));+const address = server.address();+if (!address || typeof address === "string") throw new Error("no address");+const browser = await chromium.launch({+ executablePath:+ "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",+ headless: true,+});+const context = await browser.newContext({+ viewport: { width: 760, height: 690 },+ recordVideo: { dir: output, size: { width: 760, height: 690 } },+});+const page = await context.newPage();+const errors: string[] = [];+page.on("pageerror", (error: Error) => errors.push(String(error)));+try {+ if (process.argv.includes("--fallback-only")) {+ await page.route("**/temporal-*.wgsl", (route: any) => route.abort());+ await page.goto(+ `http://127.0.0.1:${address.port}/Aetheris.Web.Runtime/telos/tests/browser.html`,+ );+ await page.waitForFunction(+ () => Boolean((window as any).telosQualification),+ { timeout: 30000 },+ );+ const fallback = await page.evaluate(async () => {+ const qualification = (window as any).telosQualification;+ if (qualification.status !== "PASS")+ throw new Error(JSON.stringify(qualification));+ const host = (window as any).telosWitness;+ host.setAA("TAAUtility");+ host.render();+ await host.readPixels();+ const result = {+ mode: host.aaMode,+ temporalAvailable: Boolean(host.temporal),+ stopped: host.owner.stopped,+ };+ host.dispose();+ return result;+ });+ if (+ fallback.mode !== "SpatialOnly" ||+ fallback.temporalAvailable ||+ fallback.stopped+ )+ throw new Error(JSON.stringify(fallback));+ await writeFile(+ resolve(output, "fallback.json"),+ JSON.stringify(fallback, null, 2),+ );+ console.log("Missing temporal assets: spatial viewport qualified");+ } else {+ await page.goto(+ `http://127.0.0.1:${address.port}/Aetheris.Web.Runtime/telos/tests/taa-browser.html`,+ );+ await page.waitForFunction(() => Boolean((window as any).taa), {+ timeout: 30000,+ });+ const setup = await page.evaluate(() => ({+ adapter: (window as any).taa.host.owner.capabilities.features,+ format: (window as any).taa.host.owner.format,+ }));+ console.log(JSON.stringify(setup));+ for (const mode of ["None", "TAA", "TAAUtility"]) {+ for (const scenario of [+ "static",+ "orbit",+ "fast",+ "disocclusion",+ "moving-occurrence",+ ]) {+ await page.evaluate(+ (mode: string) => (window as any).taa.start(mode),+ mode,+ );+ for (let index = 0; index < 24; index++) {+ await page.evaluate(+ ({ scenario, index }: any) =>+ (window as any).taa.frame(scenario, index),+ { scenario, index },+ );+ await page.waitForTimeout(24);+ }+ await page+ .locator("#view")+ .screenshot({ path: resolve(output, `${mode}-${scenario}.png`) });+ console.log(`${mode}: ${scenario} complete`);+ if (mode === "TAAUtility" && scenario === "static") {+ const counts = await page.evaluate(() => (window as any).taa.debug());+ await writeFile(+ resolve(output, "policy-counts.json"),+ JSON.stringify(counts, null, 2),+ );+ await page+ .locator("#view")+ .screenshot({ path: resolve(output, "utility-policy.png") });+ if (!(counts.stable > 0)) throw new Error("no stable history pixels");+ if (!(counts.reject > 0)) throw new Error("no rejection pixels");+ }+ }+ }+ const quality = [];+ for (const mode of ["None", "TAA", "TAAUtility"]) {+ quality.push(+ await page.evaluate(+ (mode: string) => (window as any).taa.quality(mode),+ mode,+ ),+ );+ }+ const realCad = [];+ for (const mode of ["None", "TAA", "TAAUtility"]) {+ realCad.push(+ await page.evaluate(+ (mode: string) => (window as any).taa.realCad(mode),+ mode,+ ),+ );+ await page+ .locator("#view")+ .screenshot({ path: resolve(output, `${mode}-ctc03.png`) });+ }+ const result = await page.evaluate(() => ({+ results: (window as any).taa.results,+ errors: (window as any).taa.errors,+ }));+ await writeFile(+ resolve(output, "metrics.json"),+ JSON.stringify(+ { setup, quality, realCad, ...result, pageErrors: errors },+ null,+ 2,+ ),+ );+ if (errors.length || result.errors.length)+ throw new Error(JSON.stringify({ errors, resultErrors: result.errors }));+ await page.evaluate(() => (window as any).taa.dispose());+ }+} finally {+ await context.close();+ await browser.close();+ server.close();+}