3D engine that AI agents drive
Create the native tracer locator on first use
Nguyen Xuan Anadf1e16bd0df
diff --git a/scripts/agent-runtime.mjs b/scripts/agent-runtime.mjsindex b9d5cd75..909366f1 100644--- a/scripts/agent-runtime.mjs+++ b/scripts/agent-runtime.mjs@@ -78,7 +78,7 @@ export function createAgentRuntime({ kernelWorkers = true, backend = 'gpu', browif (!['gpu', 'cpu'].includes(backend)) {throw new RangeError('backend must be gpu or cpu.');}- const nativeTracerLocator = createNativeTracerLocator();+ let nativeTracerLocator;if (!Number.isInteger(memory) || memory < 32 || memory > MAXIMUM_MEMORY_MIB) {throw new RangeError(`memory must be an integer from 32 to ${MAXIMUM_MEMORY_MIB} MiB.`);}@@ -461,6 +461,7 @@ export function createAgentRuntime({ kernelWorkers = true, backend = 'gpu', browconst { type, ...tracerOptions } = settings.renderer;if (settings.renderer.backend === 'gpu' && backend === 'cpu') throw new Error('renderer.backend "gpu" needs a runtime on the GPU backend, and this one runs on SwiftShader.');const choice = await chooseDenoiser(settings.renderer.denoise);+ nativeTracerLocator ??= createNativeTracerLocator();const trace = await chooseTraceBackend({ requested: settings.renderer.backend, runtimeBackend: backend, locator: nativeTracerLocator });const traceOptions = { width, height, ...tracerOptions, backend: trace.backend === 'native' ? 'gpu' : trace.backend, denoise: choice.denoise, threads: PATH_TRACER_THREADS };let traced;