wgsl-renderer 0.3.2 → 0.3.4

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.
package/dist/cjs/index.js CHANGED
@@ -456,10 +456,6 @@ var WGSLRenderer = class {
456
456
  * @param options Optional texture creation options for when the texture needs to be created
457
457
  */
458
458
  getPassTexture(passName, options) {
459
- const pass = this.passes.find((pass$1) => pass$1.name === passName);
460
- if (!pass) throw new Error(`Cannot find pass named '${passName}'. Available passes: [${this.passes.map((p) => p.name).join(", ")}]`);
461
- const f = options?.format ?? "rgba8unorm";
462
- if (pass.format && f !== pass.format) throw new Error(`Format must be set to ${pass.format}, pass name: '${passName}'`);
463
459
  return PassTextureRef.create(passName, options);
464
460
  }
465
461
  /**
@@ -472,17 +468,8 @@ var WGSLRenderer = class {
472
468
  const textureName = `pass_${this.passes.indexOf(targetPass)}_output`;
473
469
  let texture = this.textureManager.getTexture(textureName);
474
470
  if (!texture) {
475
- const format = ref.options?.format || this.format;
476
- const usage = ref.options?.usage || GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT;
477
- const size = this.textureManager.getPixelSize();
478
- texture = this.device.createTexture({
479
- size: [size.width, size.height],
480
- format,
481
- usage,
482
- sampleCount: 1,
483
- mipLevelCount: ref.options?.mipLevelCount || 1
484
- });
485
- this.textureManager.setTexture(textureName, texture);
471
+ const format = this.passes.find((pass) => pass.name === ref.passName)?.format || this.format;
472
+ texture = this.textureManager.createTexture(textureName, format, ref.options?.mipLevelCount);
486
473
  }
487
474
  return texture.createView({
488
475
  baseMipLevel: 0,
package/dist/esm/index.js CHANGED
@@ -455,10 +455,6 @@ var WGSLRenderer = class {
455
455
  * @param options Optional texture creation options for when the texture needs to be created
456
456
  */
457
457
  getPassTexture(passName, options) {
458
- const pass = this.passes.find((pass$1) => pass$1.name === passName);
459
- if (!pass) throw new Error(`Cannot find pass named '${passName}'. Available passes: [${this.passes.map((p) => p.name).join(", ")}]`);
460
- const f = options?.format ?? "rgba8unorm";
461
- if (pass.format && f !== pass.format) throw new Error(`Format must be set to ${pass.format}, pass name: '${passName}'`);
462
458
  return PassTextureRef.create(passName, options);
463
459
  }
464
460
  /**
@@ -471,17 +467,8 @@ var WGSLRenderer = class {
471
467
  const textureName = `pass_${this.passes.indexOf(targetPass)}_output`;
472
468
  let texture = this.textureManager.getTexture(textureName);
473
469
  if (!texture) {
474
- const format = ref.options?.format || this.format;
475
- const usage = ref.options?.usage || GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT;
476
- const size = this.textureManager.getPixelSize();
477
- texture = this.device.createTexture({
478
- size: [size.width, size.height],
479
- format,
480
- usage,
481
- sampleCount: 1,
482
- mipLevelCount: ref.options?.mipLevelCount || 1
483
- });
484
- this.textureManager.setTexture(textureName, texture);
470
+ const format = this.passes.find((pass) => pass.name === ref.passName)?.format || this.format;
471
+ texture = this.textureManager.createTexture(textureName, format, ref.options?.mipLevelCount);
485
472
  }
486
473
  return texture.createView({
487
474
  baseMipLevel: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgsl-renderer",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "A multi-pass renderer based on WebGPU and WGSL.",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",