rayzee 8.6.0 → 8.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * DLSS Super Resolution — final-render output scaling.
2
+ * Neural super resolution — final-render output scaling.
3
3
  *
4
4
  * Traces at half resolution, denoises, then runs one neural upscale to reach the
5
5
  * requested output size. On a 1.89M-triangle interior at 32 spp this matched a
@@ -35,7 +35,7 @@ import { getAssetConfig } from '../AssetConfig.js';
35
35
  /** The network is a fixed 2x per axis. */
36
36
  export const SR_SCALE = 2;
37
37
 
38
- const log = createLogger( 'dlss' );
38
+ const log = createLogger( 'neural' );
39
39
 
40
40
  /**
41
41
  * Largest input side the runtime actually survives — 2048, i.e. 4096 output.
@@ -63,24 +63,25 @@ function loadRuntime() {
63
63
 
64
64
  if ( _runtimePromise ) return _runtimePromise;
65
65
 
66
- const { dlssRuntimeUrl, dlssAssetBaseUrl } = getAssetConfig();
67
- globalThis.__DLSS5_ASSET_BASE__ = dlssAssetBaseUrl;
66
+ const { neuralRuntimeUrl, neuralAssetBaseUrl } = getAssetConfig();
67
+ if ( ! neuralAssetBaseUrl ) return Promise.reject( new Error( 'No neural model location: set neuralAssetBaseUrl with configureAssets()' ) );
68
+ globalThis.__NEURAL_ASSET_BASE__ = neuralAssetBaseUrl;
68
69
 
69
70
  _runtimePromise = new Promise( ( resolve, reject ) => {
70
71
 
71
- if ( globalThis.DLSSRuntime?.getNativeSR ) return resolve( globalThis.DLSSRuntime.getNativeSR() );
72
+ if ( globalThis.NeuralRuntime?.getNativeSR ) return resolve( globalThis.NeuralRuntime.getNativeSR() );
72
73
 
73
74
  const el = document.createElement( 'script' );
74
- el.src = dlssRuntimeUrl;
75
+ el.src = neuralRuntimeUrl;
75
76
  el.onload = () => {
76
77
 
77
- const factory = globalThis.DLSSRuntime?.getNativeSR;
78
- if ( ! factory ) return reject( new Error( 'DLSS runtime loaded but exposed no super-resolution entry' ) );
78
+ const factory = globalThis.NeuralRuntime?.getNativeSR;
79
+ if ( ! factory ) return reject( new Error( 'Neural runtime loaded but exposed no super-resolution entry' ) );
79
80
  resolve( factory() );
80
81
 
81
82
  };
82
83
 
83
- el.onerror = () => reject( new Error( `Failed to load the DLSS runtime from ${dlssRuntimeUrl}` ) );
84
+ el.onerror = () => reject( new Error( `Failed to load the neural runtime from ${neuralRuntimeUrl}` ) );
84
85
  document.head.appendChild( el );
85
86
 
86
87
  } );
@@ -126,20 +127,20 @@ function ensureReader( device, width, height ) {
126
127
  width,
127
128
  height,
128
129
  storage: device.createBuffer( {
129
- label: 'rayzee:dlss-sr-pack',
130
+ label: 'rayzee:neural-sr-pack',
130
131
  size: bytes,
131
132
  usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
132
133
  } ),
133
134
  map: device.createBuffer( {
134
- label: 'rayzee:dlss-sr-pack-map',
135
+ label: 'rayzee:neural-sr-pack-map',
135
136
  size: bytes,
136
137
  usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ,
137
138
  } ),
138
139
  pipeline: device.createComputePipeline( {
139
- label: 'rayzee:dlss-sr-pack',
140
+ label: 'rayzee:neural-sr-pack',
140
141
  layout: 'auto',
141
142
  compute: {
142
- module: device.createShaderModule( { label: 'rayzee:dlss-sr-pack', code: DENOISED_PACK_WGSL } ),
143
+ module: device.createShaderModule( { label: 'rayzee:neural-sr-pack', code: DENOISED_PACK_WGSL } ),
143
144
  entryPoint: 'main',
144
145
  },
145
146
  } ),
@@ -171,7 +172,7 @@ export function releaseDenoisedReader() {
171
172
  export async function readDenoisedHalf( denoiser ) {
172
173
 
173
174
  const texture = denoiser?._outGPUTexture;
174
- if ( ! texture ) throw new Error( 'DLSSSuperRes: no denoised frame — enable OIDN and finish a render first' );
175
+ if ( ! texture ) throw new Error( 'NeuralSuperRes: no denoised frame — enable OIDN and finish a render first' );
175
176
 
176
177
  const device = denoiser.gpuDevice;
177
178
  const { width, height } = denoiser._outTexSize;
@@ -184,7 +185,7 @@ export async function readDenoisedHalf( denoiser ) {
184
185
  ],
185
186
  } );
186
187
 
187
- const encoder = device.createCommandEncoder( { label: 'rayzee:dlss-sr-pack' } );
188
+ const encoder = device.createCommandEncoder( { label: 'rayzee:neural-sr-pack' } );
188
189
  const pass = encoder.beginComputePass();
189
190
  pass.setPipeline( reader.pipeline );
190
191
  pass.setBindGroup( 0, group );
@@ -201,7 +202,7 @@ export async function readDenoisedHalf( denoiser ) {
201
202
 
202
203
  }
203
204
 
204
- export class DLSSSuperRes {
205
+ export class NeuralSuperRes {
205
206
 
206
207
  constructor( sr, canvas ) {
207
208
 
@@ -255,14 +256,14 @@ export class DLSSSuperRes {
255
256
 
256
257
  if ( ! Number.isInteger( width ) || ! Number.isInteger( height ) || width < 1 || height < 1 ) {
257
258
 
258
- throw new Error( 'DLSSSuperRes.create: width and height must be positive integers' );
259
+ throw new Error( 'NeuralSuperRes.create: width and height must be positive integers' );
259
260
 
260
261
  }
261
262
 
262
263
  if ( width > SR_MAX_INPUT || height > SR_MAX_INPUT ) {
263
264
 
264
265
  throw new Error(
265
- `DLSSSuperRes.create: input capped at ${SR_MAX_INPUT}px per side (${SR_MAX_INPUT * SR_SCALE}px output), ` +
266
+ `NeuralSuperRes.create: input capped at ${SR_MAX_INPUT}px per side (${SR_MAX_INPUT * SR_SCALE}px output), ` +
266
267
  `got ${width}x${height}. Above that the runtime's history plane exceeds maxTextureDimension2D ` +
267
268
  'and it fails later with an unrelated bind-group error.'
268
269
  );
@@ -287,7 +288,7 @@ export class DLSSSuperRes {
287
288
 
288
289
  }
289
290
 
290
- const instance = new DLSSSuperRes( sr, canvas );
291
+ const instance = new NeuralSuperRes( sr, canvas );
291
292
  instance._allocate();
292
293
  return instance;
293
294
 
@@ -306,13 +307,13 @@ export class DLSSSuperRes {
306
307
  /** Runs the network once over a frame already in its own layout, as `readDenoisedHalf` returns. */
307
308
  async _run( source ) {
308
309
 
309
- if ( this.disposed ) throw new Error( 'DLSSSuperRes: disposed' );
310
+ if ( this.disposed ) throw new Error( 'NeuralSuperRes: disposed' );
310
311
 
311
312
  const w = this.inputWidth;
312
313
  const h = this.inputHeight;
313
314
  if ( source.width !== w || source.height !== h ) {
314
315
 
315
- throw new Error( `DLSSSuperRes: expected a ${w}x${h} source, got ${source.width}x${source.height}` );
316
+ throw new Error( `NeuralSuperRes: expected a ${w}x${h} source, got ${source.width}x${source.height}` );
316
317
 
317
318
  }
318
319
 
@@ -320,7 +321,7 @@ export class DLSSSuperRes {
320
321
  if ( ! source.half || source.half.length !== color.length ) {
321
322
 
322
323
  throw new Error(
323
- `DLSSSuperRes: expected ${color.length} packed halfs from readDenoisedHalf, got ${source.half?.length}`
324
+ `NeuralSuperRes: expected ${color.length} packed halfs from readDenoisedHalf, got ${source.half?.length}`
324
325
  );
325
326
 
326
327
  }
@@ -364,7 +365,7 @@ export class DLSSSuperRes {
364
365
  const { result, ms } = await this._run( source );
365
366
  const { outputWidth, outputHeight } = this.geometry;
366
367
 
367
- this._toneMapper ??= new PackedToneMapper( this.sr.device, 'rayzee:dlss-sr-tonemap' );
368
+ this._toneMapper ??= new PackedToneMapper( this.sr.device, 'rayzee:neural-sr-tonemap' );
368
369
  this._toneMapper.ensureSize( outputWidth, outputHeight );
369
370
 
370
371
  const started = performance.now();
@@ -436,7 +437,7 @@ function waitForDenoise( app, samples, timeoutMs ) {
436
437
  }, 200 );
437
438
 
438
439
  const timer = setTimeout(
439
- () => finish( false, new Error( 'DLSSSuperRes: timed out waiting for the render to finish' ) ),
440
+ () => finish( false, new Error( 'NeuralSuperRes: timed out waiting for the render to finish' ) ),
440
441
  timeoutMs,
441
442
  );
442
443
 
@@ -453,7 +454,7 @@ function waitForDenoise( app, samples, timeoutMs ) {
453
454
  * @param {number} opts.outputWidth final width; must be even
454
455
  * @param {number} opts.outputHeight final height; must be even
455
456
  * @param {number} [opts.samples] samples to accumulate at half resolution
456
- * @param {DLSSSuperRes} [opts.upscaler] reuse an upscaler already built for this size
457
+ * @param {NeuralSuperRes} [opts.upscaler] reuse an upscaler already built for this size
457
458
  * @param {boolean} [opts.present] draw the result over the viewport
458
459
  * @returns {Promise<{rgba8: Uint8ClampedArray, width: number, height: number, timings: object}>}
459
460
  */
@@ -495,7 +496,7 @@ export async function renderUpscaled( app, {
495
496
 
496
497
  const t = performance.now();
497
498
  onProgress( 'Loading the super-resolution model' );
498
- sr = await DLSSSuperRes.create( { width: inW, height: inH, onProgress } );
499
+ sr = await NeuralSuperRes.create( { width: inW, height: inH, onProgress } );
499
500
  timings.load = performance.now() - t;
500
501
 
501
502
  } else if ( sr.inputWidth !== inW || sr.inputHeight !== inH ) {