@bloopjs/toodle 0.0.103 → 0.1.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.
Files changed (128) hide show
  1. package/dist/Toodle.d.ts +50 -20
  2. package/dist/Toodle.d.ts.map +1 -1
  3. package/dist/backends/IBackendShader.d.ts +48 -0
  4. package/dist/backends/IBackendShader.d.ts.map +1 -0
  5. package/dist/backends/IRenderBackend.d.ts +92 -0
  6. package/dist/backends/IRenderBackend.d.ts.map +1 -0
  7. package/dist/backends/ITextureAtlas.d.ts +34 -0
  8. package/dist/backends/ITextureAtlas.d.ts.map +1 -0
  9. package/dist/backends/detection.d.ts +16 -0
  10. package/dist/backends/detection.d.ts.map +1 -0
  11. package/dist/backends/mod.d.ts +9 -0
  12. package/dist/backends/mod.d.ts.map +1 -0
  13. package/dist/backends/webgl2/WebGLBackend.d.ts +51 -0
  14. package/dist/backends/webgl2/WebGLBackend.d.ts.map +1 -0
  15. package/dist/backends/webgl2/WebGLQuadShader.d.ts +17 -0
  16. package/dist/backends/webgl2/WebGLQuadShader.d.ts.map +1 -0
  17. package/dist/backends/webgl2/glsl/quad.glsl.d.ts +12 -0
  18. package/dist/backends/webgl2/glsl/quad.glsl.d.ts.map +1 -0
  19. package/dist/backends/webgl2/mod.d.ts +3 -0
  20. package/dist/backends/webgl2/mod.d.ts.map +1 -0
  21. package/dist/backends/webgpu/ShaderDescriptor.d.ts.map +1 -0
  22. package/dist/{textures → backends/webgpu}/TextureComputeShader.d.ts +1 -1
  23. package/dist/backends/webgpu/TextureComputeShader.d.ts.map +1 -0
  24. package/dist/backends/webgpu/WebGPUBackend.d.ts +67 -0
  25. package/dist/backends/webgpu/WebGPUBackend.d.ts.map +1 -0
  26. package/dist/backends/webgpu/WebGPUQuadShader.d.ts +18 -0
  27. package/dist/backends/webgpu/WebGPUQuadShader.d.ts.map +1 -0
  28. package/dist/backends/webgpu/mod.d.ts +3 -0
  29. package/dist/backends/webgpu/mod.d.ts.map +1 -0
  30. package/dist/backends/webgpu/parser.d.ts.map +1 -0
  31. package/dist/{shaders → backends/webgpu}/postprocess/blur.d.ts +1 -1
  32. package/dist/backends/webgpu/postprocess/blur.d.ts.map +1 -0
  33. package/dist/{shaders → backends/webgpu}/postprocess/mod.d.ts +1 -1
  34. package/dist/backends/webgpu/postprocess/mod.d.ts.map +1 -0
  35. package/dist/backends/webgpu/samplers.d.ts.map +1 -0
  36. package/dist/backends/webgpu/wgsl/example.wgsl.d.ts.map +1 -0
  37. package/dist/backends/webgpu/wgsl/hello.wgsl.d.ts.map +1 -0
  38. package/dist/backends/webgpu/wgsl/helloInstanced.wgsl.d.ts.map +1 -0
  39. package/dist/backends/webgpu/wgsl/pixel-scraping.wgsl.d.ts.map +1 -0
  40. package/dist/backends/webgpu/wgsl/quad.wgsl.d.ts.map +1 -0
  41. package/dist/coreTypes/EngineUniform.d.ts.map +1 -0
  42. package/dist/mod.d.ts +3 -2
  43. package/dist/mod.d.ts.map +1 -1
  44. package/dist/mod.js +6741 -6151
  45. package/dist/mod.js.map +28 -23
  46. package/dist/scene/Batcher.d.ts +2 -2
  47. package/dist/scene/Batcher.d.ts.map +1 -1
  48. package/dist/scene/QuadNode.d.ts +3 -2
  49. package/dist/scene/QuadNode.d.ts.map +1 -1
  50. package/dist/scene/RenderComponent.d.ts +2 -2
  51. package/dist/scene/RenderComponent.d.ts.map +1 -1
  52. package/dist/scene/SceneNode.d.ts +2 -2
  53. package/dist/scene/SceneNode.d.ts.map +1 -1
  54. package/dist/text/TextShader.d.ts +8 -6
  55. package/dist/text/TextShader.d.ts.map +1 -1
  56. package/dist/textures/AssetManager.d.ts +21 -5
  57. package/dist/textures/AssetManager.d.ts.map +1 -1
  58. package/dist/textures/types.d.ts +4 -2
  59. package/dist/textures/types.d.ts.map +1 -1
  60. package/dist/textures/util.d.ts.map +1 -1
  61. package/dist/utils/boilerplate.d.ts +1 -1
  62. package/dist/utils/boilerplate.d.ts.map +1 -1
  63. package/package.json +1 -1
  64. package/src/Toodle.ts +155 -171
  65. package/src/backends/IBackendShader.ts +52 -0
  66. package/src/backends/IRenderBackend.ts +118 -0
  67. package/src/backends/ITextureAtlas.ts +35 -0
  68. package/src/backends/detection.ts +46 -0
  69. package/src/backends/mod.ts +29 -0
  70. package/src/backends/webgl2/WebGLBackend.ts +256 -0
  71. package/src/backends/webgl2/WebGLQuadShader.ts +278 -0
  72. package/src/backends/webgl2/glsl/quad.glsl.ts +114 -0
  73. package/src/backends/webgl2/mod.ts +2 -0
  74. package/src/{textures → backends/webgpu}/TextureComputeShader.ts +2 -48
  75. package/src/backends/webgpu/WebGPUBackend.ts +350 -0
  76. package/src/{shaders/QuadShader.ts → backends/webgpu/WebGPUQuadShader.ts} +226 -170
  77. package/src/backends/webgpu/mod.ts +2 -0
  78. package/src/{shaders → backends/webgpu}/parser.ts +2 -2
  79. package/src/{shaders → backends/webgpu}/postprocess/blur.ts +2 -2
  80. package/src/{shaders → backends/webgpu}/postprocess/mod.ts +1 -1
  81. package/src/mod.ts +3 -2
  82. package/src/scene/Batcher.ts +3 -3
  83. package/src/scene/QuadNode.ts +7 -6
  84. package/src/scene/RenderComponent.ts +2 -2
  85. package/src/scene/SceneNode.ts +11 -12
  86. package/src/text/TextNode.ts +2 -2
  87. package/src/text/TextShader.ts +17 -11
  88. package/src/textures/AssetManager.ts +119 -94
  89. package/src/textures/types.ts +4 -2
  90. package/src/textures/util.ts +0 -65
  91. package/src/utils/boilerplate.ts +1 -1
  92. package/dist/shaders/EngineUniform.d.ts.map +0 -1
  93. package/dist/shaders/IShader.d.ts +0 -15
  94. package/dist/shaders/IShader.d.ts.map +0 -1
  95. package/dist/shaders/QuadShader.d.ts +0 -18
  96. package/dist/shaders/QuadShader.d.ts.map +0 -1
  97. package/dist/shaders/ShaderDescriptor.d.ts.map +0 -1
  98. package/dist/shaders/mod.d.ts +0 -6
  99. package/dist/shaders/mod.d.ts.map +0 -1
  100. package/dist/shaders/parser.d.ts.map +0 -1
  101. package/dist/shaders/postprocess/blur.d.ts.map +0 -1
  102. package/dist/shaders/postprocess/mod.d.ts.map +0 -1
  103. package/dist/shaders/samplers.d.ts.map +0 -1
  104. package/dist/shaders/wgsl/example.wgsl.d.ts.map +0 -1
  105. package/dist/shaders/wgsl/hello.wgsl.d.ts.map +0 -1
  106. package/dist/shaders/wgsl/helloInstanced.wgsl.d.ts.map +0 -1
  107. package/dist/shaders/wgsl/quad.wgsl.d.ts.map +0 -1
  108. package/dist/textures/TextureComputeShader.d.ts.map +0 -1
  109. package/dist/textures/pixel-scraping.wgsl.d.ts.map +0 -1
  110. package/src/shaders/IShader.ts +0 -20
  111. package/src/shaders/mod.ts +0 -5
  112. /package/dist/{shaders → backends/webgpu}/ShaderDescriptor.d.ts +0 -0
  113. /package/dist/{shaders → backends/webgpu}/parser.d.ts +0 -0
  114. /package/dist/{shaders → backends/webgpu}/samplers.d.ts +0 -0
  115. /package/dist/{shaders → backends/webgpu}/wgsl/example.wgsl.d.ts +0 -0
  116. /package/dist/{shaders → backends/webgpu}/wgsl/hello.wgsl.d.ts +0 -0
  117. /package/dist/{shaders → backends/webgpu}/wgsl/helloInstanced.wgsl.d.ts +0 -0
  118. /package/dist/{textures → backends/webgpu/wgsl}/pixel-scraping.wgsl.d.ts +0 -0
  119. /package/dist/{shaders → backends/webgpu}/wgsl/quad.wgsl.d.ts +0 -0
  120. /package/dist/{shaders → coreTypes}/EngineUniform.d.ts +0 -0
  121. /package/src/{shaders → backends/webgpu}/ShaderDescriptor.ts +0 -0
  122. /package/src/{shaders → backends/webgpu}/samplers.ts +0 -0
  123. /package/src/{shaders → backends/webgpu}/wgsl/example.wgsl.ts +0 -0
  124. /package/src/{shaders → backends/webgpu}/wgsl/hello.wgsl.ts +0 -0
  125. /package/src/{shaders → backends/webgpu}/wgsl/helloInstanced.wgsl.ts +0 -0
  126. /package/src/{textures → backends/webgpu/wgsl}/pixel-scraping.wgsl.ts +0 -0
  127. /package/src/{shaders → backends/webgpu}/wgsl/quad.wgsl.ts +0 -0
  128. /package/src/{shaders → coreTypes}/EngineUniform.ts +0 -0
package/dist/Toodle.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ import type { IBackendShader } from "./backends/IBackendShader";
2
+ import type { BlendMode } from "./backends/IRenderBackend";
3
+ import type { BackendType, IRenderBackend } from "./backends/mod";
4
+ import { WebGLBackend } from "./backends/webgl2/mod";
5
+ import { WebGPUBackend } from "./backends/webgpu/mod";
6
+ import type { PostProcess } from "./backends/webgpu/postprocess/mod";
1
7
  import type { Color } from "./coreTypes/Color";
2
8
  import type { Point } from "./coreTypes/Point";
3
9
  import type { Limits, LimitsOptions } from "./limits";
@@ -7,9 +13,6 @@ import { JumboQuadNode, type JumboQuadOptions } from "./scene/JumboQuadNode";
7
13
  import { QuadNode, type QuadOptions } from "./scene/QuadNode";
8
14
  import { type NodeOptions, SceneNode } from "./scene/SceneNode";
9
15
  import type { Resolution } from "./screen/resolution";
10
- import type { IShader } from "./shaders/IShader";
11
- import type { PostProcess } from "./shaders/postprocess/mod";
12
- import { QuadShader, type QuadShaderOpts } from "./shaders/QuadShader";
13
16
  import { TextNode, type TextOptions } from "./text/TextNode";
14
17
  import { AssetManager, type TextureId } from "./textures/AssetManager";
15
18
  export declare class Toodle {
@@ -32,11 +35,6 @@ export declare class Toodle {
32
35
  /** number of instances enqueued last frame */
33
36
  instancesEnqueued: number;
34
37
  };
35
- /** sometimes for debugging you might want to access the GPU device, this should not be necessary in normal operation */
36
- debug: {
37
- device: GPUDevice;
38
- presentationFormat: GPUTextureFormat;
39
- };
40
38
  /**
41
39
  * Camera. This applies a 2d perspective projection matrix to any nodes drawn with toodle.draw
42
40
  */
@@ -50,10 +48,11 @@ export declare class Toodle {
50
48
  * it's unlikely that you want to use the constructor directly.
51
49
  * see {@link Toodle.attach} for creating a Toodle instance that draws to a canvas.
52
50
  */
53
- constructor(device: GPUDevice, context: GPUCanvasContext, presentationFormat: GPUTextureFormat, canvas: HTMLCanvasElement, resolution: Resolution, options: ToodleOptions);
51
+ constructor(backend: IRenderBackend, canvas: HTMLCanvasElement, resolution: Resolution, options: ToodleOptions);
54
52
  /**
55
53
  * Screen shader is an optional slot for post-processing effects.
56
54
  * Note that this will do the main render pass to an offscreen texture, which may impact performance.
55
+ * Currently only supported in WebGPU mode.
57
56
  */
58
57
  get postprocess(): PostProcess | null;
59
58
  set postprocess(value: PostProcess | null);
@@ -161,14 +160,14 @@ export declare class Toodle {
161
160
  *
162
161
  * @param label Debug name of the shader
163
162
  * @param instanceCount - The maximum number of instances that will be processed by the shader. Note that a worst-case buffer of this many instances will be immediately allocated.
164
- * @param userCode - The WGSL code to be used for the shader.
163
+ * @param userCode - The WGSL code to be used for the shader (WebGPU only).
165
164
  * @param blendMode - The blend mode to be used for the shader.
166
165
  *
167
166
  * @example
168
167
  *
169
168
  *
170
169
  */
171
- QuadShader(label: string, instanceCount: number, userCode: string, shaderOpts?: QuadShaderOpts): QuadShader;
170
+ QuadShader(label: string, instanceCount: number, userCode: string, shaderOpts?: QuadShaderOpts): IBackendShader;
172
171
  /**
173
172
  * Create a new quad node.
174
173
  *
@@ -211,7 +210,7 @@ export declare class Toodle {
211
210
  Text(fontId: string, text: string, textOpts?: TextOptions): TextNode;
212
211
  shapes: {
213
212
  Rect: (options?: QuadOptions) => QuadNode;
214
- Circle: (options?: QuadOptions) => QuadNode;
213
+ Circle: (options?: CircleOptions) => QuadNode;
215
214
  Line: (options: LineOptions) => QuadNode;
216
215
  };
217
216
  /**
@@ -235,14 +234,15 @@ export declare class Toodle {
235
234
  */
236
235
  destroy(): void;
237
236
  /**
238
- * Advanced and niche features
237
+ * Get the render backend instance.
238
+ * Cast to WebGPUBackend or WebGLBackend to access backend-specific properties.
239
+ *
240
+ * @example
241
+ * if (toodle.backend instanceof WebGPUBackend) {
242
+ * const device = toodle.backend.device;
243
+ * }
239
244
  */
240
- extra: {
241
- /**
242
- * Get the GPU device used by this Toodle instance.
243
- */
244
- device: () => GPUDevice;
245
- };
245
+ get backend(): WebGPUBackend | WebGLBackend;
246
246
  }
247
247
  export type StartFrameOptions = {
248
248
  /**
@@ -270,6 +270,26 @@ export type ToodleOptions = {
270
270
  */
271
271
  filter?: "nearest" | "linear";
272
272
  limits?: LimitsOptions;
273
+ /**
274
+ * The rendering backend to use.
275
+ *
276
+ * **auto**: Automatically detect the best available backend (WebGPU > WebGL).
277
+ *
278
+ * **webgpu**: Use WebGPU backend. Throws if WebGPU is not available.
279
+ *
280
+ * **webgl2**: Use WebGL 2 backend (fallback for older browsers).
281
+ *
282
+ * @default "auto"
283
+ */
284
+ backend?: BackendType | "auto";
285
+ };
286
+ export type CircleOptions = Omit<QuadOptions, "size"> & {
287
+ /**
288
+ * The radius of the circle in pixels.
289
+ * The diameter will be radius * 2.
290
+ * @default 50
291
+ */
292
+ radius?: number;
273
293
  };
274
294
  export type LineOptions = {
275
295
  /**
@@ -291,7 +311,7 @@ export type LineOptions = {
291
311
  /**
292
312
  * The shader to use for the line.
293
313
  */
294
- shader?: IShader;
314
+ shader?: IBackendShader;
295
315
  /**
296
316
  * The layer to draw the line on.
297
317
  */
@@ -301,4 +321,14 @@ export type LineOptions = {
301
321
  */
302
322
  key?: string;
303
323
  };
324
+ export type QuadShaderOpts = {
325
+ /**
326
+ * Blend mode for alpha compositing.
327
+ */
328
+ blendMode?: BlendMode;
329
+ /**
330
+ * Which texture atlas to bind (default: "default").
331
+ */
332
+ atlasId?: string;
333
+ };
304
334
  //# sourceMappingURL=Toodle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toodle.d.ts","sourceRoot":"","sources":["../src/Toodle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOtD,OAAO,EAAE,OAAO,EAAE,MAAM,i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;IACH,OAAO;IAMP;;;;;;;;OAQG;IACH,IAAI,OAAO,IAAI,aAAa,GAAG,YAAY,CAE1C;CACF;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC9B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACtD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,GAAG,EAAE,KAAK,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { EngineUniform } from "../coreTypes/EngineUniform";
2
+ import type { SceneNode } from "../scene/SceneNode";
3
+ import type { BlendMode } from "./IRenderBackend";
4
+ /**
5
+ * Options for creating a quad shader.
6
+ */
7
+ export type QuadShaderCreationOpts = {
8
+ /** Debug label for the shader */
9
+ label: string;
10
+ /** Maximum number of instances this shader can process per frame */
11
+ instanceCount: number;
12
+ /** User-defined shader code (WGSL for WebGPU, GLSL for WebGL) */
13
+ userCode?: string;
14
+ /** Blend mode for alpha compositing */
15
+ blendMode?: BlendMode;
16
+ /** Which texture atlas to bind (default: "default") */
17
+ atlasId?: string;
18
+ };
19
+ /**
20
+ * Backend-agnostic shader interface.
21
+ *
22
+ * This interface abstracts the differences between WebGPU and WebGL shaders.
23
+ * Each backend provides its own implementation.
24
+ */
25
+ export interface IBackendShader {
26
+ /** Debug label for the shader */
27
+ readonly label: string;
28
+ /**
29
+ * Prepare for a new frame.
30
+ * Called once per frame before any processBatch calls.
31
+ *
32
+ * @param uniform - Engine uniforms (view-projection, resolution)
33
+ */
34
+ startFrame(uniform: EngineUniform): void;
35
+ /**
36
+ * Process a batch of nodes and issue draw calls.
37
+ *
38
+ * @param nodes - The nodes to render
39
+ * @returns Number of draw calls issued
40
+ */
41
+ processBatch(nodes: SceneNode[]): number;
42
+ /**
43
+ * Cleanup after frame.
44
+ * Called once per frame after all processBatch calls.
45
+ */
46
+ endFrame(): void;
47
+ }
48
+ //# sourceMappingURL=IBackendShader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBackendShader.d.ts","sourceRoot":"","sources":["../../src/backends/IBackendShader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAEzC;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAEzC;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;CAClB"}
@@ -0,0 +1,92 @@
1
+ import type { Color } from "../coreTypes/Color";
2
+ import type { EngineUniform } from "../coreTypes/EngineUniform";
3
+ import type { Size } from "../coreTypes/Size";
4
+ import type { Limits } from "../limits";
5
+ import type { CpuTextureAtlas } from "../textures/types";
6
+ import type { IBackendShader, QuadShaderCreationOpts } from "./IBackendShader";
7
+ import type { ITextureAtlas, TextureAtlasOptions } from "./ITextureAtlas";
8
+ export type BackendType = "webgpu" | "webgl2";
9
+ export type BlendFactor = "one" | "zero" | "src-alpha" | "one-minus-src-alpha" | "dst-alpha" | "one-minus-dst-alpha";
10
+ export type BlendOperation = "add" | "subtract" | "reverse-subtract";
11
+ export type BlendMode = {
12
+ color: {
13
+ srcFactor: BlendFactor;
14
+ dstFactor: BlendFactor;
15
+ operation: BlendOperation;
16
+ };
17
+ alpha: {
18
+ srcFactor: BlendFactor;
19
+ dstFactor: BlendFactor;
20
+ operation: BlendOperation;
21
+ };
22
+ };
23
+ /**
24
+ * The render backend interface abstracts WebGPU and WebGL differences.
25
+ *
26
+ * Implementations handle GPU-specific operations like texture management,
27
+ * shader creation, and frame lifecycle.
28
+ */
29
+ export interface IRenderBackend {
30
+ /** The type of backend ("webgpu" or "webgl2") */
31
+ readonly type: BackendType;
32
+ /** Engine limits (texture size, instance count, etc.) */
33
+ readonly limits: Limits;
34
+ /** Size of the default texture atlas */
35
+ readonly atlasSize: Size;
36
+ /** Default atlas ID (always "default") */
37
+ readonly defaultAtlasId: string;
38
+ /**
39
+ * Begin a new frame.
40
+ * WebGPU: Creates command encoder and render pass
41
+ * WebGL: Clears the canvas if loadOp is "clear"
42
+ */
43
+ startFrame(clearColor: Color, loadOp: "clear" | "load"): void;
44
+ /**
45
+ * End the current frame and submit to GPU.
46
+ * WebGPU: Ends render pass and submits command buffer
47
+ * WebGL: Flushes pending operations
48
+ */
49
+ endFrame(): void;
50
+ /**
51
+ * Update engine uniforms (view-projection matrix, resolution).
52
+ * Called once per frame before shader processing.
53
+ */
54
+ updateEngineUniform(uniform: EngineUniform): void;
55
+ /**
56
+ * Upload a CPU texture atlas to a GPU texture array layer.
57
+ * @param atlas - The CPU-side atlas data to upload
58
+ * @param layerIndex - Which layer in the texture array to upload to
59
+ * @param atlasId - Which atlas to upload to (default: "default")
60
+ */
61
+ uploadAtlas(atlas: CpuTextureAtlas, layerIndex: number, atlasId?: string): Promise<void>;
62
+ /**
63
+ * Create a new texture atlas.
64
+ * @param id - Unique identifier for this atlas
65
+ * @param options - Atlas configuration (format, layers, size)
66
+ */
67
+ createTextureAtlas(id: string, options?: TextureAtlasOptions): ITextureAtlas;
68
+ /**
69
+ * Get a texture atlas by ID.
70
+ * @param id - Atlas identifier or defaults to "default"
71
+ * @returns The atlas, or null if not found
72
+ */
73
+ getTextureAtlas(id?: string): ITextureAtlas | null;
74
+ /**
75
+ * Destroy a texture atlas and free GPU resources.
76
+ * @param id - Atlas identifier
77
+ */
78
+ destroyTextureAtlas(id: string): void;
79
+ /**
80
+ * Create a quad shader for instanced rendering.
81
+ */
82
+ createQuadShader(opts: QuadShaderCreationOpts): IBackendShader;
83
+ /**
84
+ * Handle canvas resize.
85
+ */
86
+ resize(width: number, height: number): void;
87
+ /**
88
+ * Clean up GPU resources.
89
+ */
90
+ destroy(): void;
91
+ }
92
+ //# sourceMappingURL=IRenderBackend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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B,0CAA0C;IAC1C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;IAE9D;;;;OAIG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAElD;;;;;OAKG;IACH,WAAW,CACT,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAAC;IAE7E;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;IAEnD;;;OAGG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,cAAc,CAAC;IAE/D;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5C;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Supported texture atlas formats.
3
+ */
4
+ export type TextureAtlasFormat = "rgba8unorm" | "rg8unorm";
5
+ /**
6
+ * Options for creating a texture atlas.
7
+ */
8
+ export type TextureAtlasOptions = {
9
+ /** Texture format (default: "rgba8unorm") */
10
+ format?: TextureAtlasFormat;
11
+ /** Number of array layers (default: limits.textureArrayLayers) */
12
+ layers?: number;
13
+ /** Atlas size in pixels (default: limits.textureSize) */
14
+ size?: number;
15
+ };
16
+ /**
17
+ * Backend-agnostic texture atlas interface.
18
+ *
19
+ * Texture atlases are GPU texture arrays that store multiple textures.
20
+ * Each backend manages its atlases and provides this common interface.
21
+ */
22
+ export interface ITextureAtlas {
23
+ /** Unique identifier for this atlas */
24
+ readonly id: string;
25
+ /** Texture format */
26
+ readonly format: TextureAtlasFormat;
27
+ /** Number of array layers */
28
+ readonly layers: number;
29
+ /** Size in pixels (width = height) */
30
+ readonly size: number;
31
+ /** Underlying GPU handle (GPUTexture for WebGPU, WebGLTexture for WebGL) */
32
+ readonly handle: unknown;
33
+ }
34
+ //# sourceMappingURL=ITextureAtlas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITextureAtlas.d.ts","sourceRoot":"","sources":["../../src/backends/ITextureAtlas.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B"}
@@ -0,0 +1,16 @@
1
+ import type { BackendType } from "./IRenderBackend";
2
+ /**
3
+ * Detect the best available rendering backend.
4
+ *
5
+ * Tries WebGPU first (better performance), falls back to WebGL 2.
6
+ */
7
+ export declare function detectBackend(): Promise<BackendType>;
8
+ /**
9
+ * Check if WebGPU is available in the current environment.
10
+ */
11
+ export declare function isWebGPUAvailable(): boolean;
12
+ /**
13
+ * Check if WebGL 2 is available in the current environment.
14
+ */
15
+ export declare function isWebGL2Available(): boolean;
16
+ //# sourceMappingURL=detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/backends/detection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC,CAc1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C"}
@@ -0,0 +1,9 @@
1
+ export { detectBackend, isWebGL2Available, isWebGPUAvailable, } from "./detection";
2
+ export type { IBackendShader, QuadShaderCreationOpts } from "./IBackendShader";
3
+ export type { BackendType, BlendFactor, BlendMode, BlendOperation, IRenderBackend, } from "./IRenderBackend";
4
+ export type { ITextureAtlas, TextureAtlasFormat, TextureAtlasOptions, } from "./ITextureAtlas";
5
+ export { defaultFragmentShader as defaultGLSLFragmentShader } from "./webgl2/glsl/quad.glsl";
6
+ export { WebGLBackend } from "./webgl2/WebGLBackend";
7
+ export { type PostProcess, PostProcessDefaults, } from "./webgpu/postprocess/mod";
8
+ export { WebGPUBackend } from "./webgpu/WebGPUBackend";
9
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/backends/mod.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,IAAI,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EACL,KAAK,WAAW,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { Color } from "../../coreTypes/Color";
2
+ import type { EngineUniform } from "../../coreTypes/EngineUniform";
3
+ import type { Size } from "../../coreTypes/Size";
4
+ import type { Limits, LimitsOptions } from "../../limits";
5
+ import type { CpuTextureAtlas } from "../../textures/types";
6
+ import type { IBackendShader, QuadShaderCreationOpts } from "../IBackendShader";
7
+ import type { IRenderBackend } from "../IRenderBackend";
8
+ import type { ITextureAtlas, TextureAtlasFormat, TextureAtlasOptions } from "../ITextureAtlas";
9
+ export type WebGLBackendOptions = {
10
+ limits?: LimitsOptions;
11
+ format?: "rgba8unorm" | "rg8unorm";
12
+ };
13
+ /**
14
+ * WebGL 2 implementation of the render backend.
15
+ */
16
+ export declare class WebGLBackend implements IRenderBackend {
17
+ #private;
18
+ readonly type: "webgl2";
19
+ readonly limits: Limits;
20
+ readonly atlasSize: Size;
21
+ readonly defaultAtlasId = "default";
22
+ private constructor();
23
+ /**
24
+ * Create a WebGL 2 backend attached to a canvas.
25
+ */
26
+ static create(canvas: HTMLCanvasElement, options?: WebGLBackendOptions): Promise<WebGLBackend>;
27
+ startFrame(clearColor: Color, loadOp: "clear" | "load"): void;
28
+ endFrame(): void;
29
+ updateEngineUniform(_uniform: EngineUniform): void;
30
+ uploadAtlas(atlas: CpuTextureAtlas, layerIndex: number, atlasId?: string): Promise<void>;
31
+ createQuadShader(opts: QuadShaderCreationOpts): IBackendShader;
32
+ createTextureAtlas(id: string, options?: TextureAtlasOptions): ITextureAtlas;
33
+ getTextureAtlas(id: string): ITextureAtlas | null;
34
+ destroyTextureAtlas(id: string): void;
35
+ /**
36
+ * Get the default texture atlas handle.
37
+ * @deprecated Use getTextureAtlas("default").handle instead
38
+ */
39
+ get textureArrayHandle(): WebGLTexture;
40
+ resize(_width: number, _height: number): void;
41
+ destroy(): void;
42
+ /**
43
+ * Get the WebGL 2 rendering context.
44
+ */
45
+ get gl(): WebGL2RenderingContext;
46
+ /**
47
+ * Get the presentation format (of the default atlas).
48
+ */
49
+ get presentationFormat(): TextureAtlasFormat;
50
+ }
51
+ //# sourceMappingURL=WebGLBackend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGLBackend.d.ts","sourceRoot":"","sources":["../../../src/backends/webgl2/WebGLBackend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAa,YAAW,cAAc;;IACjD,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,cAAc,aAAa;IAMpC,OAAO;IAcP;;OAEG;WACU,MAAM,CACjB,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,YAAY,CAAC;IA4BxB,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;IAqB7D,QAAQ,IAAI,IAAI;IAKhB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAI5C,WAAW,CACf,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IA2ChB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,cAAc;IAU9D,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,aAAa;IAwC5E,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAIjD,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQrC;;;OAGG;IACH,IAAI,kBAAkB,IAAI,YAAY,CAErC;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI7C,OAAO,IAAI,IAAI;IASf;;OAEG;IACH,IAAI,EAAE,IAAI,sBAAsB,CAE/B;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,kBAAkB,CAE3C;CACF"}
@@ -0,0 +1,17 @@
1
+ import type { EngineUniform } from "../../coreTypes/EngineUniform";
2
+ import type { SceneNode } from "../../scene/SceneNode";
3
+ import type { IBackendShader } from "../IBackendShader";
4
+ import type { WebGLBackend } from "./WebGLBackend";
5
+ /**
6
+ * WebGL 2 implementation of quad shader for instanced rendering.
7
+ */
8
+ export declare class WebGLQuadShader implements IBackendShader {
9
+ #private;
10
+ readonly label: string;
11
+ constructor(label: string, backend: WebGLBackend, instanceCount: number, userFragmentShader?: string, atlasId?: string);
12
+ startFrame(uniform: EngineUniform): void;
13
+ processBatch(nodes: SceneNode[]): number;
14
+ endFrame(): void;
15
+ destroy(): void;
16
+ }
17
+ //# sourceMappingURL=WebGLQuadShader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGLQuadShader.d.ts","sourceRoot":"","sources":["../../../src/backends/webgl2/WebGLQuadShader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOnD;;GAEG;AACH,qBAAa,eAAgB,YAAW,cAAc;;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAiBrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,EACrB,aAAa,EAAE,MAAM,EACrB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,MAAM;IA8GlB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAkDxC,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM;IAgDxC,QAAQ,IAAI,IAAI;IAyBhB,OAAO,IAAI,IAAI;CAMhB"}
@@ -0,0 +1,12 @@
1
+ export declare const vertexShader = "#version 300 es\nprecision highp float;\n\n// Engine uniforms\nuniform mat3 u_viewProjection;\nuniform vec2 u_resolution;\n\n// Instance data attributes\n// location 0-2 are the model matrix for this instanced quad (mat3 as 3 vec3s)\nlayout(location = 0) in vec4 a_model0;\nlayout(location = 1) in vec4 a_model1;\nlayout(location = 2) in vec4 a_model2;\n// location 3 is the tint color\nlayout(location = 3) in vec4 a_tint;\n// location 4 is the uv offset and scale\nlayout(location = 4) in vec4 a_uvOffsetAndScale;\n// location 5 is the crop offset and scale\nlayout(location = 5) in vec4 a_cropOffsetAndScale;\n// location 6 is the atlas index (integer attribute)\nlayout(location = 6) in uint a_atlasIndex;\n\n// Outputs to fragment shader\nout vec4 v_uv; // xy = atlas uv, zw = original uv\nout vec4 v_tint;\nflat out int v_atlasIndex;\n\n// Lookup tables for unit quad positions and UVs\nconst vec2 posLookup[4] = vec2[4](\n vec2(-0.5, 0.5),\n vec2(-0.5, -0.5),\n vec2(0.5, 0.5),\n vec2(0.5, -0.5)\n);\n\nconst vec2 uvLookup[4] = vec2[4](\n vec2(0.0, 0.0),\n vec2(0.0, 1.0),\n vec2(1.0, 0.0),\n vec2(1.0, 1.0)\n);\n\nvoid main() {\n // Reconstruct model matrix from instance data\n mat3 modelMatrix = mat3(a_model0.xyz, a_model1.xyz, a_model2.xyz);\n\n // Transform vertex position\n vec2 localPosition = posLookup[gl_VertexID];\n vec2 cropOffset = a_cropOffsetAndScale.xy;\n vec2 cropScale = a_cropOffsetAndScale.zw;\n vec2 croppedPosition = localPosition * cropScale + cropOffset;\n vec3 worldPosition = modelMatrix * vec3(croppedPosition, 1.0);\n vec3 clipPosition = u_viewProjection * worldPosition;\n gl_Position = vec4(clipPosition.xy, 0.0, 1.0);\n\n // Set UV coordinates\n vec2 originalUv = uvLookup[gl_VertexID];\n vec2 atlasUv = originalUv * a_uvOffsetAndScale.zw * cropScale + a_uvOffsetAndScale.xy;\n v_uv = vec4(atlasUv, originalUv);\n\n // Pass through tint and atlas index\n v_tint = a_tint;\n v_atlasIndex = int(a_atlasIndex);\n}\n\n";
2
+ /**
3
+ * Default fragment shader for WebGL2 quad rendering.
4
+ * Custom fragment shaders must follow the same contract:
5
+ * - Required uniforms: u_resolution, u_textureArray
6
+ * - Required inputs: v_uv (vec4), v_tint (vec4), v_atlasIndex (flat int)
7
+ * - Required output: fragColor (vec4)
8
+ */
9
+ export declare const fragmentShader = "#version 300 es\nprecision highp float;\nprecision highp sampler2DArray;\n\n// Engine uniforms\nuniform vec2 u_resolution;\n\n// Texture array sampler\nuniform sampler2DArray u_textureArray;\n\n// Inputs from vertex shader\nin vec4 v_uv; // xy = atlas uv, zw = original uv\nin vec4 v_tint;\nflat in int v_atlasIndex;\n\n// Output color\nout vec4 fragColor;\n\nvoid main() {\n vec2 atlasUv = v_uv.xy;\n vec2 originalUv = v_uv.zw;\n\n if (v_atlasIndex == 1000) {\n // Rectangle - return solid color\n fragColor = vec4(1.0, 1.0, 1.0, 1.0) * v_tint;\n } else if (v_atlasIndex == 1001) {\n // Circle\n float edgeWidth = 4.0 / max(u_resolution.x, u_resolution.y);\n float centerDistance = 2.0 * distance(vec2(0.5, 0.5), originalUv);\n float alpha = 1.0 - smoothstep(1.0 - edgeWidth, 1.0 + edgeWidth, centerDistance);\n fragColor = vec4(v_tint.rgb, alpha * v_tint.a);\n } else {\n // Texture - sample from texture array\n vec4 color = texture(u_textureArray, vec3(atlasUv, float(v_atlasIndex)));\n fragColor = color * v_tint;\n }\n}\n";
10
+ /** Alias for users who want to extend the default shader */
11
+ export declare const defaultFragmentShader = "#version 300 es\nprecision highp float;\nprecision highp sampler2DArray;\n\n// Engine uniforms\nuniform vec2 u_resolution;\n\n// Texture array sampler\nuniform sampler2DArray u_textureArray;\n\n// Inputs from vertex shader\nin vec4 v_uv; // xy = atlas uv, zw = original uv\nin vec4 v_tint;\nflat in int v_atlasIndex;\n\n// Output color\nout vec4 fragColor;\n\nvoid main() {\n vec2 atlasUv = v_uv.xy;\n vec2 originalUv = v_uv.zw;\n\n if (v_atlasIndex == 1000) {\n // Rectangle - return solid color\n fragColor = vec4(1.0, 1.0, 1.0, 1.0) * v_tint;\n } else if (v_atlasIndex == 1001) {\n // Circle\n float edgeWidth = 4.0 / max(u_resolution.x, u_resolution.y);\n float centerDistance = 2.0 * distance(vec2(0.5, 0.5), originalUv);\n float alpha = 1.0 - smoothstep(1.0 - edgeWidth, 1.0 + edgeWidth, centerDistance);\n fragColor = vec4(v_tint.rgb, alpha * v_tint.a);\n } else {\n // Texture - sample from texture array\n vec4 color = texture(u_textureArray, vec3(atlasUv, float(v_atlasIndex)));\n fragColor = color * v_tint;\n }\n}\n";
12
+ //# sourceMappingURL=quad.glsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quad.glsl.d.ts","sourceRoot":"","sources":["../../../../src/backends/webgl2/glsl/quad.glsl.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,g8DAgExB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4iCAqC1B,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,4iCAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { WebGLBackend, type WebGLBackendOptions } from "./WebGLBackend";
2
+ export { WebGLQuadShader } from "./WebGLQuadShader";
3
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/backends/webgl2/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShaderDescriptor.d.ts","sourceRoot":"","sources":["../../../src/backends/webgpu/ShaderDescriptor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { TextureWithMetadata } from "./types";
1
+ import type { TextureWithMetadata } from "../../textures/types";
2
2
  /**
3
3
  * A GPU-based texture processor that uses compute shaders to:
4
4
  * 1. Find the non-transparent bounding box in a texture.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextureComputeShader.d.ts","sourceRoot":"","sources":["../../../src/backends/webgpu/TextureComputeShader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAwBhE;;;;;GAKG;AACH,qBAAa,oBAAoB;;gBAQ7B,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,kBAAkB,EAChC,aAAa,EAAE,kBAAkB,EACjC,sBAAsB,EAAE,kBAAkB;IAiB5C;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS;IAU/B;;;OAGG;IACG,cAAc,CAClB,cAAc,EAAE,mBAAmB,GAClC,OAAO,CAAC,mBAAmB,CAAC;CA2NhC"}
@@ -0,0 +1,67 @@
1
+ import type { Color } from "../../coreTypes/Color";
2
+ import type { EngineUniform } from "../../coreTypes/EngineUniform";
3
+ import type { Size } from "../../coreTypes/Size";
4
+ import type { Limits, LimitsOptions } from "../../limits";
5
+ import type { CpuTextureAtlas } from "../../textures/types";
6
+ import type { IBackendShader, QuadShaderCreationOpts } from "../IBackendShader";
7
+ import type { IRenderBackend } from "../IRenderBackend";
8
+ import type { ITextureAtlas, TextureAtlasOptions } from "../ITextureAtlas";
9
+ import type { PostProcess } from "./postprocess/mod";
10
+ export type WebGPUBackendOptions = {
11
+ limits?: LimitsOptions;
12
+ format?: "rgba8unorm" | "rg8unorm";
13
+ };
14
+ /**
15
+ * WebGPU implementation of the render backend.
16
+ */
17
+ export declare class WebGPUBackend implements IRenderBackend {
18
+ #private;
19
+ readonly type: "webgpu";
20
+ readonly limits: Limits;
21
+ readonly atlasSize: Size;
22
+ readonly defaultAtlasId = "default";
23
+ private constructor();
24
+ /**
25
+ * Create a WebGPU backend attached to a canvas.
26
+ */
27
+ static create(canvas: HTMLCanvasElement, options?: WebGPUBackendOptions): Promise<WebGPUBackend>;
28
+ startFrame(clearColor: Color, loadOp: "clear" | "load"): void;
29
+ endFrame(): void;
30
+ updateEngineUniform(_uniform: EngineUniform): void;
31
+ uploadAtlas(atlas: CpuTextureAtlas, layerIndex: number, atlasId?: string): Promise<void>;
32
+ createQuadShader(opts: QuadShaderCreationOpts): IBackendShader;
33
+ createTextureAtlas(id: string, options?: TextureAtlasOptions): ITextureAtlas;
34
+ getTextureAtlas(id?: string): ITextureAtlas | null;
35
+ destroyTextureAtlas(id: string): void;
36
+ resize(_width: number, _height: number): void;
37
+ destroy(): void;
38
+ /**
39
+ * Set a post-processor for screen effects.
40
+ * Setting a post-processor will cause the main render to go to an offscreen texture.
41
+ * Note: Ping-pong textures are not destroyed when setting to null to avoid
42
+ * race conditions with in-flight command buffers. They are cleaned up on destroy().
43
+ */
44
+ setPostprocess(processor: PostProcess | null): void;
45
+ /**
46
+ * Get the current post-processor.
47
+ */
48
+ getPostprocess(): PostProcess | null;
49
+ /**
50
+ * Get the GPU device for advanced operations.
51
+ */
52
+ get device(): GPUDevice;
53
+ /**
54
+ * Get the canvas context.
55
+ */
56
+ get context(): GPUCanvasContext;
57
+ /**
58
+ * Get the presentation format.
59
+ */
60
+ get presentationFormat(): GPUTextureFormat;
61
+ /**
62
+ * Get the current render pass encoder.
63
+ * Only available between startFrame() and endFrame().
64
+ */
65
+ get renderPass(): GPURenderPassEncoder;
66
+ }
67
+ //# sourceMappingURL=WebGPUBackend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUBackend.d.ts","sourceRoot":"","sources":["../../../src/backends/webgpu/WebGPUBackend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,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,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,aAAa;IAwB5E,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAIlD,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQrC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAW7C,OAAO,IAAI,IAAI;IAUf;;;;;OAKG;IACH,cAAc,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;IASnD;;OAEG;IACH,cAAc,IAAI,WAAW,GAAG,IAAI;IAiCpC;;OAEG;IACH,IAAI,MAAM,IAAI,SAAS,CAEtB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,gBAAgB,CAE9B;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,gBAAgB,CAEzC;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,oBAAoB,CAMrC;CACF"}
@@ -0,0 +1,18 @@
1
+ import type { EngineUniform } from "../../coreTypes/EngineUniform";
2
+ import type { SceneNode } from "../../scene/SceneNode";
3
+ import type { IBackendShader } from "../IBackendShader";
4
+ import type { BlendMode } from "../IRenderBackend";
5
+ import type { WebGPUBackend } from "./WebGPUBackend";
6
+ /**
7
+ * WebGPU implementation of quad shader for instanced rendering.
8
+ */
9
+ export declare class WebGPUQuadShader implements IBackendShader {
10
+ #private;
11
+ readonly label: string;
12
+ readonly code: string;
13
+ constructor(label: string, backend: WebGPUBackend, instanceCount: number, userCode?: string, blendMode?: BlendMode, atlasId?: string);
14
+ startFrame(uniform: EngineUniform): void;
15
+ processBatch(nodes: SceneNode[]): number;
16
+ endFrame(): void;
17
+ }
18
+ //# sourceMappingURL=WebGPUQuadShader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUQuadShader.d.ts","sourceRoot":"","sources":["../../../src/backends/webgpu/WebGPUQuadShader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD;;GAEG;AACH,qBAAa,gBAAiB,YAAW,cAAc;;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAcpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,EACtB,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,SAAS,EACrB,OAAO,CAAC,EAAE,MAAM;IAyHlB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAkBxC,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM;IA4DxC,QAAQ,IAAI,IAAI;CA4CjB"}
@@ -0,0 +1,3 @@
1
+ export { WebGPUBackend, type WebGPUBackendOptions } from "./WebGPUBackend";
2
+ export { WebGPUQuadShader } from "./WebGPUQuadShader";
3
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/backends/webgpu/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/backends/webgpu/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,UAK/C;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,gBAAgB,CA4ClB;AAuED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,QAAQ,GAAE,iBAA8B,GACvC,qBAAqB,CAkDvB;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,QAaxD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAqB9D"}
@@ -1,3 +1,3 @@
1
- import type { Color } from "../../coreTypes/Color";
1
+ import type { Color } from "../../../coreTypes/Color";
2
2
  export declare function blur(encoder: GPUCommandEncoder, context: GPUCanvasContext, device: GPUDevice, clearColor: Color, presentationFormat: GPUTextureFormat, pingpong: [GPUTexture, GPUTexture]): void;
3
3
  //# sourceMappingURL=blur.d.ts.map