wgsl-renderer 0.3.2 → 0.3.3

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
@@ -472,17 +472,8 @@ var WGSLRenderer = class {
472
472
  const textureName = `pass_${this.passes.indexOf(targetPass)}_output`;
473
473
  let texture = this.textureManager.getTexture(textureName);
474
474
  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);
475
+ const format = this.passes.find((pass) => pass.name === ref.passName)?.format || this.format;
476
+ texture = this.textureManager.createTexture(textureName, format, ref.options?.mipLevelCount);
486
477
  }
487
478
  return texture.createView({
488
479
  baseMipLevel: 0,
package/dist/esm/index.js CHANGED
@@ -471,17 +471,8 @@ var WGSLRenderer = class {
471
471
  const textureName = `pass_${this.passes.indexOf(targetPass)}_output`;
472
472
  let texture = this.textureManager.getTexture(textureName);
473
473
  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);
474
+ const format = this.passes.find((pass) => pass.name === ref.passName)?.format || this.format;
475
+ texture = this.textureManager.createTexture(textureName, format, ref.options?.mipLevelCount);
485
476
  }
486
477
  return texture.createView({
487
478
  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.3",
4
4
  "description": "A multi-pass renderer based on WebGPU and WGSL.",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",