@margoengine/shader 0.1.0 → 1.0.0

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.
Files changed (49) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +4 -4
  3. package/README.md +1920 -1771
  4. package/dist/attribute.d.ts +28 -0
  5. package/dist/black-hole.js +3 -3
  6. package/dist/clock-BLGNexlt.js +3 -3
  7. package/dist/{compute-D-BghbXj.js → compute-CXGG9qvI.js} +76 -70
  8. package/dist/compute-texture.js +3 -3
  9. package/dist/compute-volume.js +3 -3
  10. package/dist/compute.d.ts +8 -2
  11. package/dist/{control-DvjfV7R0.js → control-CFjkGPBk.js} +1 -1
  12. package/dist/deform.js +2 -2
  13. package/dist/editor-pass.js +17 -17
  14. package/dist/effects.js +2 -2
  15. package/dist/glsl-material.js +2 -2
  16. package/dist/glsl-pass.js +5 -5
  17. package/dist/glsl.js +18 -18
  18. package/dist/gpu-DQJk2xAv.js +55 -0
  19. package/dist/graph.js +2 -2
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +103 -8
  22. package/dist/{lighting-Dx8_RsBz.js → lighting-JU9yQPfM.js} +2 -2
  23. package/dist/lighting.js +1 -1
  24. package/dist/{material-CU7p-Q8u.js → material-C6bpqlnE.js} +1 -1
  25. package/dist/{material-REzUrXtu.js → material-CZ8V1FeA.js} +95 -71
  26. package/dist/material.d.ts +9 -4
  27. package/dist/{node-DzKv9CF2.js → node-B6yoIC9V.js} +126 -126
  28. package/dist/node.d.ts +7 -1
  29. package/dist/noise.js +1 -1
  30. package/dist/pass.d.ts +1 -0
  31. package/dist/pass.js +24 -21
  32. package/dist/{post-DC62ZleD.js → post-DLpZ110L.js} +17 -17
  33. package/dist/{raw-D0W8U3Qa.js → raw-0AYej3Ak.js} +422 -273
  34. package/dist/raw.d.ts +125 -15
  35. package/dist/raw.js +1 -1
  36. package/dist/readback.js +13 -12
  37. package/dist/serialization.js +12 -12
  38. package/dist/shadertoy.js +6 -6
  39. package/dist/shared/caster.d.ts +159 -152
  40. package/dist/shared/fog.d.ts +33 -33
  41. package/dist/shared/fractal.d.ts +9 -9
  42. package/dist/shared/msaa.d.ts +30 -25
  43. package/dist/shared/stack.d.ts +22 -22
  44. package/dist/subgroups.js +4 -4
  45. package/dist/{texture-D6vy0bam.js → texture-BawKO_h9.js} +1 -1
  46. package/dist/texture-array.js +2 -2
  47. package/dist/utils.js +32 -32
  48. package/package.json +151 -151
  49. package/dist/gpu-DQ5Jmggz.js +0 -31
@@ -1,10 +1,10 @@
1
- // @margo/core-built 0.1.0
1
+ // @margo/core-built 1.0.0
2
2
  import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
3
 
4
- import { Pt as e, T as t, l as n, o as r } from "./node-DzKv9CF2.js";
5
- import { t as i } from "./clock-BLGNexlt.js";
6
- import { n as a, t as o } from "./view-rect-Bm1ac-TK.js";
7
- import { n as s, r as c } from "./gpu-DQ5Jmggz.js";
4
+ import { Pt as e, T as t, l as n, o as r } from "./node-B6yoIC9V.js";
5
+ import { n as i, t as a } from "./view-rect-Bm1ac-TK.js";
6
+ import { n as o, r as s } from "./gpu-DQJk2xAv.js";
7
+ import { t as c } from "./clock-BLGNexlt.js";
8
8
  import { t as l } from "./display-BrJM_Qkd.js";
9
9
  import { t as u } from "./own-stack-D1XnXrrz.js";
10
10
  import { MargoError as d } from "@margoengine/math/errors";
@@ -37,8 +37,8 @@ function y(e) {
37
37
  return `textureLoad(${r}, ${t.args.length ? `vec2i(${e.wrap(t.args[0])} * vec2f(textureDimensions(${r})))` : n}, 0)`;
38
38
  });
39
39
  }
40
- var b = 0, x = class t {coreRequirement=__margoCoreRequirement("0.1.0",import.meta.url);
41
- static async attach(e, n, r = {}) {__margoAssertCore(e,__margoCoreRequirement("0.1.0",import.meta.url));
40
+ var b = 0, x = class t {coreRequirement=__margoCoreRequirement("1.0.0",import.meta.url);
41
+ static async attach(e, n, r = {}) {__margoAssertCore(e,__margoCoreRequirement("1.0.0",import.meta.url));
42
42
  let { signal: i, ...a } = r;
43
43
  i?.throwIfAborted();
44
44
  let o = new t(n, a);
@@ -57,7 +57,7 @@ var b = 0, x = class t {coreRequirement=__margoCoreRequirement("0.1.0",import.me
57
57
  }
58
58
  code(e = !1) {
59
59
  let t = e ? `let c = ${this.value};\n let x = pbrNeutral(max(c.rgb, vec3f(0.0)));\n return vec4f(select(x * 12.92, 1.055 * pow(x, vec3f(1.0 / 2.4)) - 0.055, x >= vec3f(0.0031308)), c.a);` : `return ${this.value};`;
60
- return `${s}\n${this.program.declare(0)}\n${e ? l : ""}@fragment fn fragment(v:Vertex)->@location(0) vec4f {\n${this.body} ${t}\n}\n`;
60
+ return `${o}\n${this.program.declare(0)}\n${e ? l : ""}@fragment fn fragment(v:Vertex)->@location(0) vec4f {\n${this.body} ${t}\n}\n`;
61
61
  }
62
62
  joinStack(e) {
63
63
  if (this.host || this.disposed) throw new d(this.disposed ? "disposed" : "attached", `${this.name} is already attached; create a new NodePass for another PostStack`);
@@ -69,32 +69,32 @@ var b = 0, x = class t {coreRequirement=__margoCoreRequirement("0.1.0",import.me
69
69
  setup(e) {
70
70
  if (!this.host || this.disposed) throw new d("state", "NodePass runs inside a PostStack: PostStack.attach(engine, [pass])");
71
71
  if (!e.gpu) throw new d("unsupported", "NodePass requires WebGPU; use a WebGPU engine");
72
- this.engine = e, i.hold(e, this);
72
+ this.engine = e, c.hold(e, this);
73
73
  }
74
74
  registerPasses() {}
75
75
  render(t, n, r) {
76
- let s = t.device, l = this.kind === "hdr" && !r.hdr;
77
- (!this.pipeline || this.format !== r.format || this.samples !== r.multisample.count || this.encoded !== l) && (this.format = r.format, this.samples = r.multisample.count, this.encoded = l, this.pipeline = c(s, this.code(l), r.format, { multisample: r.multisample }), this.group = void 0), this.sampler ??= s.createSampler({
76
+ let o = t.device, l = this.kind === "hdr" && !r.hdr;
77
+ (!this.pipeline || this.format !== r.format || this.samples !== r.multisample.count || this.encoded !== l) && (this.format = r.format, this.samples = r.multisample.count, this.encoded = l, this.pipeline = s(o, this.code(l), r.format, { multisample: r.multisample }), this.group = void 0), this.sampler ??= o.createSampler({
78
78
  magFilter: "linear",
79
79
  minFilter: "linear"
80
80
  });
81
81
  let u = this.host.depthTexture;
82
82
  u !== this.depthTexture && (this.depthTexture = u, this.depthView = u?.createView({ aspect: "depth-only" }));
83
- let d = this.program.entries(s, {
83
+ let d = this.program.entries(o, {
84
84
  width: t.width,
85
85
  height: t.height,
86
- time: i.find(this.engine)?.time ?? 0,
86
+ time: c.find(this.engine)?.time ?? 0,
87
87
  delta: t.delta,
88
88
  input: n,
89
89
  sampler: this.sampler,
90
90
  depth: this.depthView
91
91
  });
92
- (!this.group || !e(d, this.last)) && (this.last = d, this.group = d.length ? s.createBindGroup({
92
+ (!this.group || !e(d, this.last)) && (this.last = d, this.group = d.length ? o.createBindGroup({
93
93
  layout: this.pipeline.getBindGroupLayout(0),
94
94
  entries: d
95
- }) : void 0), this.attachment.view = r.view, this.attachment.loadOp = a(t);
95
+ }) : void 0), this.attachment.view = r.view, this.attachment.loadOp = i(t);
96
96
  let f = t.encoder.beginRenderPass(this.descriptor);
97
- o(f, t), f.setPipeline(this.pipeline), this.group && f.setBindGroup(0, this.group), f.draw(3), f.end();
97
+ a(f, t), f.setPipeline(this.pipeline), this.group && f.setBindGroup(0, this.group), f.draw(3), f.end();
98
98
  }
99
99
  onDeviceRestored() {
100
100
  this.format = void 0, this.samples = void 0, this.encoded = !1, this.sampler = this.group = this.pipeline = this.depthTexture = this.depthView = void 0;
@@ -103,7 +103,7 @@ var b = 0, x = class t {coreRequirement=__margoCoreRequirement("0.1.0",import.me
103
103
  if (this.disposed) return;
104
104
  this.disposed = !0;
105
105
  let e = this.engine, t = this.stack;
106
- this.engine = this.stack = void 0, t?.removeEffect(this), i.release(e, this), e?.sceneOf(this)?.removePlugin(this.name), this.onDeviceRestored();
106
+ this.engine = this.stack = void 0, t?.removeEffect(this), c.release(e, this), e?.sceneOf(this)?.removePlugin(this.name), this.onDeviceRestored();
107
107
  }
108
108
  [Symbol.dispose ?? Symbol()]() {
109
109
  this.dispose();