@taole/giftstage 0.2.1 → 0.2.2

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.
@@ -2506,11 +2506,11 @@ const rg = class CA {
2506
2506
  }), bindGroupLayout: B, textureCount: 1 }, this.pipelines.set(g, I), I;
2507
2507
  }
2508
2508
  ensureParticlePipeline(A) {
2509
- const g = `particle-instanced:${A}`;
2510
- let I = this.pipelines.get(g);
2511
- if (I) return I;
2509
+ const g = this.frameUsesStencil ? "pass" : "none", I = `particle-instanced:${A}:${g}`;
2510
+ let B = this.pipelines.get(I);
2511
+ if (B) return B;
2512
2512
  this.ensureInstancedProjectionBuffer();
2513
- const B = this.device.createBindGroupLayout({
2513
+ const Q = this.device.createBindGroupLayout({
2514
2514
  entries: [
2515
2515
  {
2516
2516
  binding: 0,
@@ -2523,11 +2523,12 @@ const rg = class CA {
2523
2523
  buffer: { type: "read-only-storage", minBindingSize: 80 }
2524
2524
  }
2525
2525
  ]
2526
- }), Q = this.device.createShaderModule({ code: SA.particleInstanced }), E = A === "additive";
2527
- return I = { pipeline: this.device.createRenderPipeline({
2528
- layout: this.device.createPipelineLayout({ bindGroupLayouts: [B] }),
2526
+ }), E = this.device.createShaderModule({ code: SA.particleInstanced }), i = A === "additive";
2527
+ return B = { pipeline: this.device.createRenderPipeline({
2528
+ label: `particle-instanced:${A}:${g}`,
2529
+ layout: this.device.createPipelineLayout({ bindGroupLayouts: [Q] }),
2529
2530
  vertex: {
2530
- module: Q,
2531
+ module: E,
2531
2532
  entryPoint: "vs",
2532
2533
  buffers: [{
2533
2534
  arrayStride: 8,
@@ -2535,11 +2536,11 @@ const rg = class CA {
2535
2536
  }]
2536
2537
  },
2537
2538
  fragment: {
2538
- module: Q,
2539
+ module: E,
2539
2540
  entryPoint: "fs",
2540
2541
  targets: [{
2541
2542
  format: this.format,
2542
- blend: E ? {
2543
+ blend: i ? {
2543
2544
  color: { srcFactor: "one", dstFactor: "one" },
2544
2545
  alpha: { srcFactor: "one", dstFactor: "one" }
2545
2546
  } : {
@@ -2549,8 +2550,16 @@ const rg = class CA {
2549
2550
  }]
2550
2551
  },
2551
2552
  primitive: { topology: "triangle-list" },
2553
+ depthStencil: g === "pass" ? {
2554
+ format: "depth24plus-stencil8",
2555
+ depthWriteEnabled: !1,
2556
+ depthCompare: "always",
2557
+ stencilFront: { compare: "always", passOp: "keep", failOp: "keep", depthFailOp: "keep" },
2558
+ stencilBack: { compare: "always", passOp: "keep", failOp: "keep", depthFailOp: "keep" },
2559
+ stencilWriteMask: 0
2560
+ } : void 0,
2552
2561
  multisample: { count: this.msaaSampleCount }
2553
- }), bindGroupLayout: B, textureCount: 0 }, this.pipelines.set(g, I), I;
2562
+ }), bindGroupLayout: Q, textureCount: 0 }, this.pipelines.set(I, B), B;
2554
2563
  }
2555
2564
  createInstancedSvgaPipeline(A, g, I) {
2556
2565
  this.ensureInstancedProjectionBuffer(), this.ensureInstancedStorageBuffer();
@@ -3868,7 +3877,7 @@ const rg = class CA {
3868
3877
  const s = A.uniforms.u_projection;
3869
3878
  if (!(s instanceof Float32Array) || s.length < 16) return;
3870
3879
  this.ensureInstancedProjection(s);
3871
- const n = `${a}:${E.id}`;
3880
+ const n = `${this.frameUsesStencil ? "pass" : "none"}:${a}:${E.id}`;
3872
3881
  let r = this.particleDataBindGroupCache.get(n);
3873
3882
  r || (r = this.device.createBindGroup({
3874
3883
  layout: o.bindGroupLayout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/giftstage",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "High-performance WebGPU/WebGL gift animation player unifying SVGA, VAP, AlphaVideo, and images",
5
5
  "type": "module",
6
6
  "main": "dist/gift-stage.cjs",