3D engine that AI agents drive
Enable full Cook M1 Cycles kernel manifest and parity wiring (#894)
Nguyen Xuan An04f87b2f3a1a
diff --git a/bench/cycles-parity/test-lobes.mjs b/bench/cycles-parity/test-lobes.mjsindex 56e82bcc..be9bf0a6 100644--- a/bench/cycles-parity/test-lobes.mjs+++ b/bench/cycles-parity/test-lobes.mjs@@ -552,7 +552,7 @@ async function runFurnaceSceneCase(sceneCase, sphereGeometry, whiteEnvironment,maxSeconds: 300,};const nativeInput = typeof renderNative.buildNativeInputV2 === 'function'- ? renderNative.buildNativeInputV2(traceScene, camera, traceOptions, packModule)+ ? renderNative.buildNativeInputV2(traceScene, camera, { ...traceOptions, parts }, packModule): renderNative.buildNativeInput(traceScene, camera, traceOptions, packModule);const traced = renderNative.traceNative(nativeInput, traceOptions);const pixelCount = options.sceneWidth * options.sceneHeight;diff --git a/bench/cycles-parity/trace-native.mjs b/bench/cycles-parity/trace-native.mjsindex 251f6d46..51ae3614 100644--- a/bench/cycles-parity/trace-native.mjs+++ b/bench/cycles-parity/trace-native.mjs@@ -112,7 +112,7 @@ async function runCli() {const traceSource = await reconstructTraceSceneSource(description);const traceScene = buildTraceScene(traceSource.parts, traceSource.environment);const camera = createCamera(traceSource.camera, options.width, options.height);- const nativeInput = packSceneForKernel(traceScene, camera, options);+ const nativeInput = packSceneForKernel(traceScene, camera, { ...options, parts: traceSource.parts });const sceneBuildSeconds = (performance.now() - buildStarted) / 1000;const traced = renderNative.traceNative(nativeInput, {width: options.width,diff --git a/packages/render-native/src/cycles/kernel-manifest.txt b/packages/render-native/src/cycles/kernel-manifest.txtindex f116716b..05f88baf 100644--- a/packages/render-native/src/cycles/kernel-manifest.txt+++ b/packages/render-native/src/cycles/kernel-manifest.txt@@ -1,19 +1,14 @@# Ordered WGSL module manifest for the Cycles-parity native kernel (`kernel: "cycles"`).# Blank lines and `#` comments are ignored; listed files are relative to `src/cycles/` and concatenated in order.-#-# Planned lane append order:-# abi.wgsl-# sampler.wgsl-# camera.wgsl-# filter.wgsl-# closure.wgsl-# bsdf_diffuse.wgsl-# bsdf_microfacet.wgsl-# bsdf_glass.wgsl-# bsdf_sheen.wgsl-# bsdf_coat.wgsl-# lights.wgsl-# light_tree.wgsl-# integrator.wgslabi.wgsl+sampler.wgsl+filter.wgsl+camera.wgsl+bsdf_diffuse.wgsl+bsdf_microfacet.wgsl+bsdf_glass.wgsl+bsdf_coat.wgsl+closure.wgsl+lights.wgsl+integrator.wgsldiff --git a/tests/native-pack-input.test.js b/tests/native-pack-input.test.jsindex a53a50b5..3d0d736c 100644--- a/tests/native-pack-input.test.js+++ b/tests/native-pack-input.test.js@@ -113,17 +113,16 @@ test('resolveNativeKernel defaults to legacy, falls back to JS67_NATIVE_KERNEL,}});-test('traceNative fails cleanly without crashing when cycles kernel manifest has no main entry point', { skip: !findNativeAddon() }, () => {+test('traceNative traces finite RGBA pixels on both legacy and cycles kernels', { skip: !findNativeAddon() }, () => {const input = buildNativeInput(buildTraceScene(plainParts, {}), camera, options, pack);- assert.throws(- () => traceNative(input, { ...options, kernel: 'cycles' }),- /Cycles native kernel.*@compute main/,- );+ const cyclesResult = traceNative(input, { ...options, kernel: 'cycles' });+ assert.equal(cyclesResult.rgba.length, options.width * options.height * 4);+ assert.ok(cyclesResult.rgba.every(Number.isFinite));+ assert.equal(cyclesResult.averageSamples, options.samples);withKernelEnv('cycles', () => {- assert.throws(- () => traceNative(input, options),- /Cycles native kernel.*@compute main/,- );+ const envCyclesResult = traceNative(input, options);+ assert.equal(envCyclesResult.rgba.length, options.width * options.height * 4);+ assert.ok(envCyclesResult.rgba.every(Number.isFinite));const legacyResult = traceNative(input, { ...options, kernel: 'legacy' });assert.equal(legacyResult.rgba.length, options.width * options.height * 4);assert.ok(legacyResult.rgba.every(Number.isFinite));