ultra-text 1.0.1 → 1.0.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.
Files changed (237) hide show
  1. package/README.md +339 -1039
  2. package/dist/assets/cpuSdf.worker-Dy4P5_TI.js +466 -0
  3. package/dist/assets/cpuSdf.worker-Dy4P5_TI.js.map +1 -0
  4. package/dist/assets/traceOutline.worker-B5uVKmR4.js +1725 -0
  5. package/dist/assets/traceOutline.worker-B5uVKmR4.js.map +1 -0
  6. package/dist/atlas/appendAtlas.js +97 -31
  7. package/dist/atlas/appendAtlas.js.map +1 -1
  8. package/dist/atlas/buildAtlas.js +4 -3
  9. package/dist/atlas/buildAtlas.js.map +1 -1
  10. package/dist/atlas/colorGlyphs.d.ts +0 -10
  11. package/dist/atlas/colorGlyphs.js +97 -155
  12. package/dist/atlas/colorGlyphs.js.map +1 -1
  13. package/dist/atlas/colorTexture.d.ts +1 -0
  14. package/dist/atlas/colorTexture.js +64 -0
  15. package/dist/atlas/colorTexture.js.map +1 -0
  16. package/dist/atlas/cpuAtlas.d.ts +4 -1
  17. package/dist/atlas/cpuAtlas.js +14 -7
  18. package/dist/atlas/cpuAtlas.js.map +1 -1
  19. package/dist/atlas/cpuSdf.d.ts +1 -1
  20. package/dist/atlas/cpuSdf.js +235 -68
  21. package/dist/atlas/cpuSdf.js.map +1 -1
  22. package/dist/atlas/cpuWorker.d.ts +11 -3
  23. package/dist/atlas/cpuWorker.js +179 -22
  24. package/dist/atlas/cpuWorker.js.map +1 -1
  25. package/dist/atlas/gpuAtlas.js +188 -287
  26. package/dist/atlas/gpuAtlas.js.map +1 -1
  27. package/dist/atlas/gpuCommon.d.ts +257 -0
  28. package/dist/atlas/gpuCommon.js +845 -0
  29. package/dist/atlas/gpuCommon.js.map +1 -0
  30. package/dist/atlas/jfaWgsl.d.ts +1 -1
  31. package/dist/atlas/jfaWgsl.js +226 -249
  32. package/dist/atlas/jfaWgsl.js.map +1 -1
  33. package/dist/atlas/rasterize.d.ts +22 -0
  34. package/dist/atlas/rasterize.js +329 -158
  35. package/dist/atlas/rasterize.js.map +1 -1
  36. package/dist/atlas/shapeRaster.js +2 -1
  37. package/dist/atlas/shapeRaster.js.map +1 -1
  38. package/dist/atlas/vanillaBounds.d.ts +64 -0
  39. package/dist/atlas/vanillaBounds.js +42 -0
  40. package/dist/atlas/vanillaBounds.js.map +1 -0
  41. package/dist/atlas/vanillaCore.d.ts +100 -0
  42. package/dist/atlas/vanillaCore.js +1065 -0
  43. package/dist/atlas/vanillaCore.js.map +1 -0
  44. package/dist/atlas/vanillaCpuAtlas.d.ts +9 -0
  45. package/dist/atlas/vanillaCpuAtlas.js +72 -0
  46. package/dist/atlas/vanillaCpuAtlas.js.map +1 -0
  47. package/dist/atlas/vanillaExtras.d.ts +8 -0
  48. package/dist/atlas/vanillaExtras.js +167 -0
  49. package/dist/atlas/vanillaExtras.js.map +1 -0
  50. package/dist/atlas/vanillaGpuHelpers.d.ts +295 -0
  51. package/dist/atlas/vanillaGpuHelpers.js +354 -0
  52. package/dist/atlas/vanillaGpuHelpers.js.map +1 -0
  53. package/dist/dom/DomSdf.js +243 -297
  54. package/dist/dom/DomSdf.js.map +1 -1
  55. package/dist/dom/DomSlug.js +94 -165
  56. package/dist/dom/DomSlug.js.map +1 -1
  57. package/dist/dom/Text.d.ts +4 -1
  58. package/dist/dom/Text.js +5 -1
  59. package/dist/dom/Text.js.map +1 -1
  60. package/dist/dom/browserShaping.js +31 -14
  61. package/dist/dom/browserShaping.js.map +1 -1
  62. package/dist/dom/clusters.js +13 -2
  63. package/dist/dom/clusters.js.map +1 -1
  64. package/dist/dom/cssEffects.d.ts +4 -0
  65. package/dist/dom/cssEffects.js +72 -0
  66. package/dist/dom/cssEffects.js.map +1 -0
  67. package/dist/dom/domAnalytic.d.ts +53 -0
  68. package/dist/dom/domAnalytic.js +282 -0
  69. package/dist/dom/domAnalytic.js.map +1 -0
  70. package/dist/dom/domExtras.d.ts +27 -0
  71. package/dist/dom/domExtras.js +137 -0
  72. package/dist/dom/domExtras.js.map +1 -0
  73. package/dist/dom/fontCanvas.d.ts +16 -0
  74. package/dist/dom/fontCanvas.js +31 -13
  75. package/dist/dom/fontCanvas.js.map +1 -1
  76. package/dist/dom/layoutSignature.js +175 -57
  77. package/dist/dom/layoutSignature.js.map +1 -1
  78. package/dist/dom/markup.d.ts +10 -0
  79. package/dist/dom/markup.js +16 -1
  80. package/dist/dom/markup.js.map +1 -1
  81. package/dist/dom/pretextLayout.js +78 -28
  82. package/dist/dom/pretextLayout.js.map +1 -1
  83. package/dist/dom/snapshot.d.ts +4 -0
  84. package/dist/dom/snapshot.js +891 -484
  85. package/dist/dom/snapshot.js.map +1 -1
  86. package/dist/dom/snapshotsEqual.d.ts +7 -0
  87. package/dist/dom/snapshotsEqual.js +68 -0
  88. package/dist/dom/snapshotsEqual.js.map +1 -0
  89. package/dist/dom/svgCapture.d.ts +8 -1
  90. package/dist/dom/svgCapture.js +105 -28
  91. package/dist/dom/svgCapture.js.map +1 -1
  92. package/dist/dom/textTransform.d.ts +13 -1
  93. package/dist/dom/textTransform.js +31 -13
  94. package/dist/dom/textTransform.js.map +1 -1
  95. package/dist/dom/tone.js +91 -44
  96. package/dist/dom/tone.js.map +1 -1
  97. package/dist/index.js +4 -3
  98. package/dist/slug/SlugMaterial.d.ts +17 -3
  99. package/dist/slug/SlugMaterial.js +98 -26
  100. package/dist/slug/SlugMaterial.js.map +1 -1
  101. package/dist/slug/cff.d.ts +5 -0
  102. package/dist/slug/cff.js +780 -0
  103. package/dist/slug/cff.js.map +1 -0
  104. package/dist/slug/coverage.d.ts +19 -15
  105. package/dist/slug/coverage.js +380 -225
  106. package/dist/slug/coverage.js.map +1 -1
  107. package/dist/slug/preprocessCore.d.ts +6 -2
  108. package/dist/slug/preprocessCore.js +199 -148
  109. package/dist/slug/preprocessCore.js.map +1 -1
  110. package/dist/slug/runtime.d.ts +1 -0
  111. package/dist/slug/runtime.js +113 -74
  112. package/dist/slug/runtime.js.map +1 -1
  113. package/dist/slug/standaloneRuntime.d.ts +3 -2
  114. package/dist/slug/standaloneRuntime.js +112 -67
  115. package/dist/slug/standaloneRuntime.js.map +1 -1
  116. package/dist/slug/truetype.d.ts +14 -6
  117. package/dist/slug/truetype.js +356 -255
  118. package/dist/slug/truetype.js.map +1 -1
  119. package/dist/slug/vanillaCore.d.ts +410 -0
  120. package/dist/slug/vanillaCore.js +1630 -0
  121. package/dist/slug/vanillaCore.js.map +1 -0
  122. package/dist/slug-vanilla.d.ts +13 -364
  123. package/dist/slug-vanilla.js +7 -1454
  124. package/dist/slug.d.ts +2 -2
  125. package/dist/slug.js +7 -7
  126. package/dist/text/GlyphTextMaterial.d.ts +6 -1
  127. package/dist/text/GlyphTextMaterial.js +16 -12
  128. package/dist/text/GlyphTextMaterial.js.map +1 -1
  129. package/dist/text/RectMaterial.js +6 -10
  130. package/dist/text/RectMaterial.js.map +1 -1
  131. package/dist/text/SdfTextMaterial.d.ts +9 -3
  132. package/dist/text/SdfTextMaterial.js +125 -38
  133. package/dist/text/SdfTextMaterial.js.map +1 -1
  134. package/dist/text/decorations.d.ts +7 -2
  135. package/dist/text/decorations.js +187 -79
  136. package/dist/text/decorations.js.map +1 -1
  137. package/dist/text/geometry.d.ts +3 -22
  138. package/dist/text/geometryUtils.d.ts +16 -1
  139. package/dist/text/geometryUtils.js +83 -8
  140. package/dist/text/geometryUtils.js.map +1 -1
  141. package/dist/text/glyphGeometry.d.ts +9 -0
  142. package/dist/text/glyphGeometry.js +434 -0
  143. package/dist/text/glyphGeometry.js.map +1 -0
  144. package/dist/text/index.d.ts +2 -1
  145. package/dist/text/rectGeometry.d.ts +13 -0
  146. package/dist/text/rectGeometry.js +101 -0
  147. package/dist/text/rectGeometry.js.map +1 -0
  148. package/dist/text/reflow.d.ts +23 -1
  149. package/dist/text/reflow.js +223 -94
  150. package/dist/text/reflow.js.map +1 -1
  151. package/dist/text/snap.d.ts +15 -0
  152. package/dist/text/snap.js +26 -0
  153. package/dist/text/snap.js.map +1 -0
  154. package/dist/text/tone.js +2 -2
  155. package/dist/text/tone.js.map +1 -1
  156. package/dist/types.d.ts +23 -7
  157. package/dist/vanilla.d.ts +13 -363
  158. package/dist/vanilla.js +7 -1474
  159. package/dist/windfoil/WindfoilCompositeMaterial.d.ts +1 -1
  160. package/dist/windfoil/WindfoilCompositeMaterial.js +10 -3
  161. package/dist/windfoil/WindfoilCompositeMaterial.js.map +1 -1
  162. package/dist/windfoil/WindfoilMaterial.d.ts +12 -5
  163. package/dist/windfoil/WindfoilMaterial.js +71 -8
  164. package/dist/windfoil/WindfoilMaterial.js.map +1 -1
  165. package/dist/windfoil/compositeGeometry.js +12 -5
  166. package/dist/windfoil/compositeGeometry.js.map +1 -1
  167. package/dist/windfoil/coverage.d.ts +10 -2
  168. package/dist/windfoil/coverage.js +147 -59
  169. package/dist/windfoil/coverage.js.map +1 -1
  170. package/dist/windfoil/geometry.d.ts +17 -2
  171. package/dist/windfoil/geometry.js +220 -57
  172. package/dist/windfoil/geometry.js.map +1 -1
  173. package/dist/windfoil/layerGrid.js +8 -8
  174. package/dist/windfoil/layerGrid.js.map +1 -1
  175. package/dist/windfoil/mixed.d.ts +1 -0
  176. package/dist/windfoil/mixed.js +57 -29
  177. package/dist/windfoil/mixed.js.map +1 -1
  178. package/dist/windfoil/preprocess.js +2 -2
  179. package/dist/windfoil/preprocessCore.d.ts +2 -0
  180. package/dist/windfoil/preprocessCore.js +69 -37
  181. package/dist/windfoil/preprocessCore.js.map +1 -1
  182. package/dist/windfoil/requests.d.ts +1 -1
  183. package/dist/windfoil/requests.js +11 -4
  184. package/dist/windfoil/requests.js.map +1 -1
  185. package/dist/windfoil/resolveOutline.d.ts +9 -0
  186. package/dist/windfoil/resolveOutline.js +20 -0
  187. package/dist/windfoil/resolveOutline.js.map +1 -0
  188. package/dist/windfoil/runtime.d.ts +4 -1
  189. package/dist/windfoil/runtime.js +69 -63
  190. package/dist/windfoil/runtime.js.map +1 -1
  191. package/dist/windfoil/shapeGeometry.js +80 -34
  192. package/dist/windfoil/shapeGeometry.js.map +1 -1
  193. package/dist/windfoil/sizeSwitch.d.ts +1 -1
  194. package/dist/windfoil/sizeSwitch.js +13 -8
  195. package/dist/windfoil/sizeSwitch.js.map +1 -1
  196. package/dist/windfoil/storage.d.ts +78 -6
  197. package/dist/windfoil/storage.js +166 -11
  198. package/dist/windfoil/storage.js.map +1 -1
  199. package/dist/windfoil/svg/curves.d.ts +20 -0
  200. package/dist/windfoil/svg/curves.js +145 -42
  201. package/dist/windfoil/svg/curves.js.map +1 -1
  202. package/dist/windfoil/svg/document.js +10 -1
  203. package/dist/windfoil/svg/document.js.map +1 -1
  204. package/dist/windfoil/svg/pathConverter.js +66 -50
  205. package/dist/windfoil/svg/pathConverter.js.map +1 -1
  206. package/dist/windfoil/svg/pathData.d.ts +9 -0
  207. package/dist/windfoil/svg/pathData.js +142 -109
  208. package/dist/windfoil/svg/pathData.js.map +1 -1
  209. package/dist/windfoil/svg/winding.js +34 -10
  210. package/dist/windfoil/svg/winding.js.map +1 -1
  211. package/dist/windfoil/trace/contours.d.ts +5 -0
  212. package/dist/windfoil/trace/contours.js +256 -62
  213. package/dist/windfoil/trace/contours.js.map +1 -1
  214. package/dist/windfoil/trace/fit.d.ts +3 -1
  215. package/dist/windfoil/trace/fit.js +915 -265
  216. package/dist/windfoil/trace/fit.js.map +1 -1
  217. package/dist/windfoil/trace/outline.js +55 -30
  218. package/dist/windfoil/trace/outline.js.map +1 -1
  219. package/dist/windfoil/trace/traceOutline.worker.d.ts +24 -0
  220. package/dist/windfoil/trace/traceWorker.d.ts +13 -0
  221. package/dist/windfoil/trace/traceWorker.js +192 -0
  222. package/dist/windfoil/trace/traceWorker.js.map +1 -0
  223. package/dist/windfoil/trace/types.d.ts +10 -0
  224. package/dist/windfoil/tracedOutlines.d.ts +2 -0
  225. package/dist/windfoil/tracedOutlines.js +393 -103
  226. package/dist/windfoil/tracedOutlines.js.map +1 -1
  227. package/package.json +48 -29
  228. package/skills/ultra-text/SKILL.md +9 -10
  229. package/skills/ultra-text/references/frameworks.md +46 -2
  230. package/skills/ultra-text/references/three-tsl.md +27 -25
  231. package/skills/ultra-text/references/vanilla-webgpu.md +5 -2
  232. package/dist/assets/cpuSdf.worker-xS57yQbP.js +0 -322
  233. package/dist/assets/cpuSdf.worker-xS57yQbP.js.map +0 -1
  234. package/dist/slug-vanilla.js.map +0 -1
  235. package/dist/text/geometry.js +0 -348
  236. package/dist/text/geometry.js.map +0 -1
  237. package/dist/vanilla.js.map +0 -1
@@ -0,0 +1,845 @@
1
+ import { COLOR_BLEED_WGSL } from "./jfaWgsl.js";
2
+ var TILED_MAX_TEXELS = 45e4;
3
+ var ERROR_FILTERS = [
4
+ "validation",
5
+ "out-of-memory",
6
+ "internal"
7
+ ];
8
+ function storageBufferFits(limits, width, height) {
9
+ if (!limits || width <= 0 || height <= 0) return true;
10
+ const bytes = width * height * 4;
11
+ const storageStage = limits.maxStorageBuffersPerShaderStage;
12
+ if (storageStage !== void 0 && storageStage < 1) return false;
13
+ if (limits.maxStorageBufferBindingSize !== void 0 && bytes > limits.maxStorageBufferBindingSize) return false;
14
+ if (limits.maxBufferSize !== void 0 && bytes > limits.maxBufferSize) return false;
15
+ return true;
16
+ }
17
+ function selectAtlasMode(directStore, pxRange, limits, width = 0, height = 0) {
18
+ if (!directStore) return "multi";
19
+ const workgroupDim = selectWorkgroupDimension(limits);
20
+ if (pxRange === void 0 || pxRange <= 12) {
21
+ if (workgroupDim === 16 && width * height > 45e4 && storageBufferFits(limits, width, height)) return "sep12";
22
+ return "tiled12";
23
+ }
24
+ if (pxRange <= 32 && !storageBufferFits(limits, width, height)) return "tiled32";
25
+ return "multi";
26
+ }
27
+ var KERNEL_NEEDS = [
28
+ ["maxComputeInvocationsPerWorkgroup", 64],
29
+ ["maxComputeWorkgroupSizeX", 8],
30
+ ["maxComputeWorkgroupSizeY", 8],
31
+ ["maxStorageBuffersPerShaderStage", 1]
32
+ ];
33
+ function selectWorkgroupDimension(limits) {
34
+ const inv = limits?.maxComputeInvocationsPerWorkgroup ?? 256;
35
+ const wx = limits?.maxComputeWorkgroupSizeX ?? 256;
36
+ const wy = limits?.maxComputeWorkgroupSizeY ?? 256;
37
+ return inv >= 256 && wx >= 16 && wy >= 16 ? 16 : 8;
38
+ }
39
+ function supportsDirectStore(features) {
40
+ const textures = globalThis.GPUTextureUsage;
41
+ return typeof textures?.STORAGE_BINDING === "number" && textures.STORAGE_BINDING > 0 && Boolean(features?.has("texture-formats-tier1"));
42
+ }
43
+ function edtRadius(pxRange) {
44
+ return Math.ceil(pxRange * .5) + 1;
45
+ }
46
+ function checkCommonAtlasLimits(caller, limits, width, height, radius, directStore, cpuHint = "", mode) {
47
+ if (radius > 65) throw new RangeError(`${caller}: pxRange exceeds fixed-point jump range${cpuHint}`);
48
+ if (!limits) return;
49
+ const tiledOnly = mode !== void 0 ? mode === "tiled12" || mode === "tiled32" : directStore && radius <= 7;
50
+ const needs = tiledOnly ? KERNEL_NEEDS.slice(0, 3) : KERNEL_NEEDS;
51
+ for (const [name, need] of needs) {
52
+ const value = limits[name];
53
+ if (value !== void 0 && value < need) throw new RangeError(`${caller}: ${name}=${value}, needs ${need}${cpuHint}`);
54
+ }
55
+ if (!directStore) {
56
+ const fragBuffers = limits.maxStorageBuffersInFragmentStage;
57
+ if (fragBuffers !== void 0 && fragBuffers < 1) throw new RangeError(`${caller}: maxStorageBuffersInFragmentStage=${fragBuffers}, needs 1${cpuHint}`);
58
+ }
59
+ const largest = limits.maxTextureDimension2D;
60
+ if (largest !== void 0 && Math.max(width, height) > largest) throw new RangeError(`${caller}: ${width}×${height} exceeds maxTextureDimension2D=${largest}${cpuHint ? "; lower maxAtlasSize" : ""}`);
61
+ if (tiledOnly) {
62
+ if (limits.maxBufferSize !== void 0 && 16 > limits.maxBufferSize) throw new RangeError(`${caller}: ${width}×${height} exceeds storage-buffer limits${cpuHint ? `${cpuHint} or lower maxAtlasSize` : ""}`);
63
+ return;
64
+ }
65
+ const bytes = width * height * 4;
66
+ if (limits.maxStorageBufferBindingSize !== void 0 && bytes > limits.maxStorageBufferBindingSize || limits.maxBufferSize !== void 0 && bytes > limits.maxBufferSize) throw new RangeError(`${caller}: ${width}×${height} exceeds storage-buffer limits${cpuHint ? `${cpuHint} or lower maxAtlasSize` : ""}`);
67
+ }
68
+ function openErrorScopes(device) {
69
+ const push = device.pushErrorScope;
70
+ const pop = device.popErrorScope;
71
+ if (typeof push !== "function" || typeof pop !== "function") return { close: () => Promise.resolve(null) };
72
+ for (const filter of ERROR_FILTERS) push.call(device, filter);
73
+ return { close() {
74
+ return Promise.all(ERROR_FILTERS.map(() => pop.call(device))).then((errors) => {
75
+ const error = errors.find(Boolean);
76
+ return error ? error.message ?? "unknown GPU error" : null;
77
+ }, (error) => String(error));
78
+ } };
79
+ }
80
+ var POOL_MAX_PER_CLASS = 2;
81
+ var POOL_MAX_IDLE_BYTES = 100663296;
82
+ var POOL_IDLE_TRIM_MS = 5e3;
83
+ var POOL_RING_BYTES = 4096;
84
+ function poolSizeClass(size, maxBufferSize = Infinity) {
85
+ const need = Math.max(256, Math.ceil(size / 4) * 4);
86
+ const pow2 = 2 ** Math.ceil(Math.log2(need));
87
+ let b = pow2 <= maxBufferSize ? pow2 : need;
88
+ if (b >= 524288) b = size <= b * 11 / 16 ? b * 11 / 16 : size <= b * 3 / 4 ? b * 3 / 4 : b;
89
+ return b;
90
+ }
91
+ function createGpuPool(device, options = {}) {
92
+ const now = options.now ?? (() => performance.now());
93
+ const setTimer = options.setTimer ?? ((fn, ms) => setTimeout(fn, ms));
94
+ const clearTimer = options.clearTimer ?? ((id) => clearTimeout(id));
95
+ const maxBuf = device.limits?.maxBufferSize ?? Infinity;
96
+ const maxStorageBuf = device.limits?.maxStorageBufferBindingSize ?? maxBuf;
97
+ const maxDim = device.limits?.maxTextureDimension2D ?? Infinity;
98
+ const ringBytes = Math.min(POOL_RING_BYTES, maxBuf);
99
+ const align = Math.max(256, device.limits?.minUniformBufferOffsetAlignment ?? 256);
100
+ const idle = /* @__PURE__ */ new Map();
101
+ const meta = /* @__PURE__ */ new WeakMap();
102
+ const counters = {
103
+ liveBuffers: 0,
104
+ liveTextures: 0,
105
+ liveBytes: 0,
106
+ idleBytes: 0,
107
+ createdBuffers: 0,
108
+ createdTextures: 0,
109
+ reused: 0
110
+ };
111
+ let ringBuffers = [];
112
+ let ringIndex = 0;
113
+ let ringOffset = 0;
114
+ let timer = null;
115
+ let destroyed = false;
116
+ let builds = 0;
117
+ let activeBuilds = 0;
118
+ let warm = false;
119
+ let lastBuildTime = now();
120
+ const lend = (m, sign) => {
121
+ counters[`live${m.kind}`] += sign;
122
+ counters.liveBytes += sign * m.bytes;
123
+ };
124
+ const lendOut = (key, bytes, kind, make) => {
125
+ const list = idle.get(key);
126
+ const item = list?.pop();
127
+ let resource;
128
+ if (item) {
129
+ if (!list.length) idle.delete(key);
130
+ counters.idleBytes -= item.bytes;
131
+ counters.reused++;
132
+ resource = item.resource;
133
+ } else {
134
+ resource = make();
135
+ meta.set(resource, {
136
+ key,
137
+ bytes,
138
+ kind
139
+ });
140
+ counters[`created${kind}`]++;
141
+ }
142
+ lend(meta.get(resource), 1);
143
+ return resource;
144
+ };
145
+ const arm = () => {
146
+ if (timer !== null || destroyed || !idle.size && !warm && builds === 0) return;
147
+ const id = setTimer(() => {
148
+ timer = null;
149
+ trim(false);
150
+ }, POOL_IDLE_TRIM_MS);
151
+ if (id && typeof id.unref === "function") id.unref();
152
+ timer = id;
153
+ };
154
+ function discardRing() {
155
+ for (const b of ringBuffers) b.destroy();
156
+ ringBuffers = [];
157
+ ringIndex = 0;
158
+ ringOffset = 0;
159
+ }
160
+ function resetRing() {
161
+ ringIndex = 0;
162
+ ringOffset = 0;
163
+ }
164
+ function give(resource) {
165
+ if (!resource) return;
166
+ const m = meta.get(resource);
167
+ if (m) lend(m, -1);
168
+ const list = m ? idle.get(m.key) ?? [] : void 0;
169
+ if (!m || !list || destroyed || list.length >= POOL_MAX_PER_CLASS || counters.idleBytes + m.bytes > POOL_MAX_IDLE_BYTES) {
170
+ meta.delete(resource);
171
+ resource.destroy();
172
+ return;
173
+ }
174
+ list.push({
175
+ resource,
176
+ key: m.key,
177
+ bytes: m.bytes,
178
+ time: now()
179
+ });
180
+ idle.set(m.key, list);
181
+ counters.idleBytes += m.bytes;
182
+ arm();
183
+ }
184
+ function discard(resource) {
185
+ if (!resource) return;
186
+ const m = meta.get(resource);
187
+ if (m) {
188
+ lend(m, -1);
189
+ meta.delete(resource);
190
+ }
191
+ resource.destroy();
192
+ }
193
+ function trim(all = true) {
194
+ const t = now();
195
+ for (const [key, list] of idle) {
196
+ const keep = list.filter((item) => {
197
+ if (!all && t - item.time < 5e3) return true;
198
+ counters.idleBytes -= item.bytes;
199
+ item.resource.destroy();
200
+ return false;
201
+ });
202
+ if (keep.length) idle.set(key, keep);
203
+ else idle.delete(key);
204
+ }
205
+ if (counters.liveBuffers === 0 && counters.liveTextures === 0 && idle.size === 0 && (all || t - lastBuildTime >= 5e3)) {
206
+ discardRing();
207
+ warm = false;
208
+ builds = 0;
209
+ }
210
+ arm();
211
+ }
212
+ return {
213
+ beginBuild() {
214
+ activeBuilds++;
215
+ lastBuildTime = now();
216
+ if (builds === 0 && !warm && idle.size === 0) {
217
+ builds = 1;
218
+ return false;
219
+ }
220
+ builds++;
221
+ warm = true;
222
+ return true;
223
+ },
224
+ endBuild(transient, retain, failed = false) {
225
+ activeBuilds = Math.max(0, activeBuilds - 1);
226
+ lastBuildTime = now();
227
+ if (failed || !retain) {
228
+ for (const resource of transient) discard(resource);
229
+ if (activeBuilds === 0 && (failed || !warm)) discardRing();
230
+ else resetRing();
231
+ } else {
232
+ for (const resource of transient) give(resource);
233
+ resetRing();
234
+ }
235
+ arm();
236
+ },
237
+ buffer(size, usage) {
238
+ const bufUsage = globalThis.GPUBufferUsage;
239
+ const limit = (bufUsage ? (usage & bufUsage.STORAGE) !== 0 : (usage & 128) !== 0) ? Math.min(maxBuf, maxStorageBuf) : maxBuf;
240
+ const bytes = warm || builds === 0 ? poolSizeClass(size, limit) : Math.max(256, Math.ceil(size / 4) * 4);
241
+ return lendOut(`b|${usage}|${bytes}`, bytes, "Buffers", () => device.createBuffer({
242
+ size: bytes,
243
+ usage
244
+ }));
245
+ },
246
+ uploadTexture(width, height, format, usage) {
247
+ const round = warm || builds === 0;
248
+ const w = round ? Math.min(maxDim, Math.ceil(width / 64) * 64) : Math.min(maxDim, width);
249
+ const h = round ? Math.min(maxDim, Math.ceil(height / 64) * 64) : Math.min(maxDim, height);
250
+ return lendOut(`t|${format}|${usage}|${w}|${h}`, w * h * 4, "Textures", () => device.createTexture({
251
+ size: [w, h],
252
+ format,
253
+ usage
254
+ }));
255
+ },
256
+ ringAlloc(bytes, usage) {
257
+ const aligned = Math.ceil(bytes / align) * align;
258
+ const size = aligned <= ringBytes || bytes > ringBytes ? aligned : Math.ceil(bytes / 4) * 4;
259
+ if (size > ringBytes) {
260
+ const buffer = device.createBuffer({
261
+ size,
262
+ usage
263
+ });
264
+ ringBuffers.push(buffer);
265
+ return {
266
+ buffer,
267
+ offset: 0
268
+ };
269
+ }
270
+ if (ringOffset + size > ringBytes) {
271
+ ringIndex++;
272
+ ringOffset = 0;
273
+ }
274
+ const buffer = ringBuffers[ringIndex] ??= device.createBuffer({
275
+ size: ringBytes,
276
+ usage
277
+ });
278
+ const offset = ringOffset;
279
+ ringOffset += size;
280
+ return {
281
+ buffer,
282
+ offset
283
+ };
284
+ },
285
+ resetRing,
286
+ discardRing,
287
+ give,
288
+ discard,
289
+ trim,
290
+ stats() {
291
+ let idleCount = 0;
292
+ for (const list of idle.values()) idleCount += list.length;
293
+ return {
294
+ ...counters,
295
+ idle: idleCount,
296
+ live: counters.liveBuffers + counters.liveTextures
297
+ };
298
+ },
299
+ destroy() {
300
+ if (destroyed) return;
301
+ trim(true);
302
+ destroyed = true;
303
+ if (timer !== null) clearTimer(timer);
304
+ timer = null;
305
+ discardRing();
306
+ }
307
+ };
308
+ }
309
+ var devicePools = /* @__PURE__ */ new WeakMap();
310
+ var jfaLayouts = /* @__PURE__ */ new WeakMap();
311
+ function getDeviceGpuPool(device) {
312
+ let pool = devicePools.get(device);
313
+ if (!pool) devicePools.set(device, pool = createGpuPool(device));
314
+ return pool;
315
+ }
316
+ function getJfaLayouts(device) {
317
+ const cached = jfaLayouts.get(device);
318
+ if (cached) return cached;
319
+ if (typeof device.createBindGroupLayout !== "function" || typeof device.createPipelineLayout !== "function") return null;
320
+ const createBgl = device.createBindGroupLayout.bind(device);
321
+ const createPl = device.createPipelineLayout.bind(device);
322
+ const COMPUTE = 4;
323
+ const FRAGMENT = 2;
324
+ const uniform = (visibility) => ({
325
+ binding: 0,
326
+ visibility,
327
+ buffer: {
328
+ type: "uniform",
329
+ minBindingSize: 16
330
+ }
331
+ });
332
+ let tiledGroup;
333
+ let tiledPipeline;
334
+ let sepHorizGroup;
335
+ let sepHorizPipeline;
336
+ let sepVertStoreGroup;
337
+ let sepVertStorePipeline;
338
+ let resolveGroup;
339
+ let resolvePipeline;
340
+ const built = {
341
+ get tiledGroup() {
342
+ return tiledGroup ??= createBgl({ entries: [
343
+ uniform(COMPUTE),
344
+ {
345
+ binding: 1,
346
+ visibility: COMPUTE,
347
+ texture: {
348
+ sampleType: "unfilterable-float",
349
+ viewDimension: "2d"
350
+ }
351
+ },
352
+ {
353
+ binding: 2,
354
+ visibility: COMPUTE,
355
+ storageTexture: {
356
+ format: "r8unorm",
357
+ access: "write-only",
358
+ viewDimension: "2d"
359
+ }
360
+ }
361
+ ] });
362
+ },
363
+ get tiledPipeline() {
364
+ return tiledPipeline ??= createPl({ bindGroupLayouts: [built.tiledGroup] });
365
+ },
366
+ get sepHorizGroup() {
367
+ return sepHorizGroup ??= createBgl({ entries: [
368
+ uniform(COMPUTE),
369
+ {
370
+ binding: 1,
371
+ visibility: COMPUTE,
372
+ texture: {
373
+ sampleType: "unfilterable-float",
374
+ viewDimension: "2d"
375
+ }
376
+ },
377
+ {
378
+ binding: 2,
379
+ visibility: COMPUTE,
380
+ buffer: { type: "storage" }
381
+ }
382
+ ] });
383
+ },
384
+ get sepHorizPipeline() {
385
+ return sepHorizPipeline ??= createPl({ bindGroupLayouts: [built.sepHorizGroup] });
386
+ },
387
+ get sepVertStoreGroup() {
388
+ return sepVertStoreGroup ??= createBgl({ entries: [
389
+ uniform(COMPUTE),
390
+ {
391
+ binding: 1,
392
+ visibility: COMPUTE,
393
+ buffer: { type: "read-only-storage" }
394
+ },
395
+ {
396
+ binding: 2,
397
+ visibility: COMPUTE,
398
+ storageTexture: {
399
+ format: "r8unorm",
400
+ access: "write-only",
401
+ viewDimension: "2d"
402
+ }
403
+ }
404
+ ] });
405
+ },
406
+ get sepVertStorePipeline() {
407
+ return sepVertStorePipeline ??= createPl({ bindGroupLayouts: [built.sepVertStoreGroup] });
408
+ },
409
+ get resolveGroup() {
410
+ return resolveGroup ??= createBgl({ entries: [uniform(FRAGMENT), {
411
+ binding: 1,
412
+ visibility: FRAGMENT,
413
+ buffer: { type: "read-only-storage" }
414
+ }] });
415
+ },
416
+ get resolvePipeline() {
417
+ return resolvePipeline ??= createPl({ bindGroupLayouts: [built.resolveGroup] });
418
+ }
419
+ };
420
+ jfaLayouts.set(device, built);
421
+ return built;
422
+ }
423
+ function encodeJfaWork(device, encoder, pipelines, canvas, width, height, pxRange, radius, output, transient, buffers, textures, pool = getDeviceGpuPool(device)) {
424
+ const upload = pool.uploadTexture(width, height, "rgba8unorm", textures.TEXTURE_BINDING | textures.COPY_DST | textures.RENDER_ATTACHMENT);
425
+ transient.push(upload);
426
+ const useSep12 = pipelines.directStore && radius <= 7 && Boolean(pipelines.sepHorizPx12) && Boolean(pipelines.sepVertPx12 ?? pipelines.sepVertStore);
427
+ const tiledStore = !useSep12 && pipelines.directStore && radius <= 17 ? (radius <= 7 ? pipelines.tiledStore : null) ?? pipelines.tiledStoreWide : null;
428
+ const seedBytes = width * height * 4;
429
+ const seed = tiledStore ? null : pool.buffer(seedBytes, buffers.STORAGE);
430
+ if (seed) transient.push(seed);
431
+ const paramsSlot = pool.ringAlloc(16, buffers.UNIFORM | buffers.COPY_DST);
432
+ const values = /* @__PURE__ */ new Int32Array(4);
433
+ values.set([
434
+ width,
435
+ height,
436
+ radius
437
+ ]);
438
+ new Float32Array(values.buffer, 12, 1)[0] = 1 / pxRange;
439
+ device.queue.writeBuffer(paramsSlot.buffer, paramsSlot.offset, values);
440
+ device.queue.copyExternalImageToTexture({
441
+ source: canvas,
442
+ flipY: false
443
+ }, {
444
+ texture: upload,
445
+ premultipliedAlpha: false
446
+ }, [width, height]);
447
+ const uploadView = upload.createView();
448
+ const paramsBinding = {
449
+ buffer: paramsSlot.buffer,
450
+ offset: paramsSlot.offset,
451
+ size: 16
452
+ };
453
+ const layouts = pipelines.layouts ?? null;
454
+ const groupsX = Math.ceil(width / pipelines.workgroupDim);
455
+ const groupsY = Math.ceil(height / pipelines.workgroupDim);
456
+ const flood = encoder.beginComputePass();
457
+ if (tiledStore) {
458
+ const finalView = output.createView({ mipLevelCount: 1 });
459
+ flood.setPipeline(tiledStore);
460
+ flood.setBindGroup(0, device.createBindGroup({
461
+ layout: layouts ? layouts.tiledGroup : tiledStore.getBindGroupLayout(0),
462
+ entries: [
463
+ {
464
+ binding: 0,
465
+ resource: paramsBinding
466
+ },
467
+ {
468
+ binding: 1,
469
+ resource: uploadView
470
+ },
471
+ {
472
+ binding: 2,
473
+ resource: finalView
474
+ }
475
+ ]
476
+ }));
477
+ flood.dispatchWorkgroups(groupsX, groupsY);
478
+ flood.end();
479
+ return upload;
480
+ }
481
+ const sepHoriz = useSep12 ? pipelines.sepHorizPx12 : pipelines.sepHoriz;
482
+ flood.setPipeline(sepHoriz);
483
+ flood.setBindGroup(0, device.createBindGroup({
484
+ layout: layouts ? layouts.sepHorizGroup : sepHoriz.getBindGroupLayout(0),
485
+ entries: [
486
+ {
487
+ binding: 0,
488
+ resource: paramsBinding
489
+ },
490
+ {
491
+ binding: 1,
492
+ resource: uploadView
493
+ },
494
+ {
495
+ binding: 2,
496
+ resource: {
497
+ buffer: seed,
498
+ offset: 0,
499
+ size: seedBytes
500
+ }
501
+ }
502
+ ]
503
+ }));
504
+ flood.dispatchWorkgroups(Math.ceil(width / 64), useSep12 ? Math.ceil(height / 4) : height);
505
+ const sepVert = useSep12 ? pipelines.sepVertPx12 ?? pipelines.sepVertStore : pipelines.sepVertStore;
506
+ if (pipelines.directStore && sepVert) {
507
+ const finalView = output.createView({ mipLevelCount: 1 });
508
+ flood.setPipeline(sepVert);
509
+ flood.setBindGroup(0, device.createBindGroup({
510
+ layout: layouts ? layouts.sepVertStoreGroup : sepVert.getBindGroupLayout(0),
511
+ entries: [
512
+ {
513
+ binding: 0,
514
+ resource: paramsBinding
515
+ },
516
+ {
517
+ binding: 1,
518
+ resource: {
519
+ buffer: seed,
520
+ offset: 0,
521
+ size: seedBytes
522
+ }
523
+ },
524
+ {
525
+ binding: 2,
526
+ resource: finalView
527
+ }
528
+ ]
529
+ }));
530
+ flood.dispatchWorkgroups(groupsX, groupsY);
531
+ flood.end();
532
+ } else {
533
+ flood.end();
534
+ const resolve = encoder.beginRenderPass({ colorAttachments: [{
535
+ view: output.createView({ mipLevelCount: 1 }),
536
+ loadOp: "clear",
537
+ storeOp: "store"
538
+ }] });
539
+ resolve.setPipeline(pipelines.resolve);
540
+ resolve.setBindGroup(0, device.createBindGroup({
541
+ layout: layouts ? layouts.resolveGroup : pipelines.resolve.getBindGroupLayout(0),
542
+ entries: [{
543
+ binding: 0,
544
+ resource: paramsBinding
545
+ }, {
546
+ binding: 1,
547
+ resource: {
548
+ buffer: seed,
549
+ offset: 0,
550
+ size: seedBytes
551
+ }
552
+ }]
553
+ }));
554
+ resolve.draw(3);
555
+ resolve.end();
556
+ }
557
+ return upload;
558
+ }
559
+ var COLOR_BLEED_STATE_KEY = Symbol.for("ultra-text.gpuColorBleed");
560
+ function colorBleedState() {
561
+ const g = globalThis;
562
+ return g[COLOR_BLEED_STATE_KEY] ??= {
563
+ bleeds: /* @__PURE__ */ new WeakMap(),
564
+ ready: /* @__PURE__ */ new WeakMap()
565
+ };
566
+ }
567
+ function registerDeferredColorBleed(data, entry) {
568
+ colorBleedState().bleeds.set(data, entry);
569
+ }
570
+ function peekDeferredColorBleed(data) {
571
+ return colorBleedState().bleeds.get(data);
572
+ }
573
+ function takeDeferredColorBleed(data) {
574
+ const { bleeds } = colorBleedState();
575
+ const entry = bleeds.get(data);
576
+ if (entry) bleeds.delete(data);
577
+ return entry;
578
+ }
579
+ function flushDeferredColorBleed(data) {
580
+ takeDeferredColorBleed(data)?.applyCpu();
581
+ }
582
+ function putReadyGpuColorTexture(data, texture) {
583
+ colorBleedState().ready.set(data, texture);
584
+ }
585
+ function takeReadyGpuColorTexture(data) {
586
+ const { ready } = colorBleedState();
587
+ const tex = ready.get(data);
588
+ if (tex) ready.delete(data);
589
+ return tex;
590
+ }
591
+ var bleedPipelineCache = /* @__PURE__ */ new WeakMap();
592
+ function getBleedPipelines(device) {
593
+ const existing = bleedPipelineCache.get(device);
594
+ if (existing) return existing;
595
+ const module = device.createShaderModule({
596
+ label: "ultra-text color bleed",
597
+ code: COLOR_BLEED_WGSL
598
+ });
599
+ let classifyLayout = "auto";
600
+ let horizLayout = "auto";
601
+ let resolveLayout = "auto";
602
+ let classifyPipeLayout = "auto";
603
+ let horizPipeLayout = "auto";
604
+ let resolvePipeLayout = "auto";
605
+ if (typeof device.createBindGroupLayout === "function" && typeof device.createPipelineLayout === "function") {
606
+ const COMPUTE = 4;
607
+ const FRAGMENT = 2;
608
+ const u = (vis) => ({
609
+ binding: 0,
610
+ visibility: vis,
611
+ buffer: {
612
+ type: "uniform",
613
+ minBindingSize: 16
614
+ }
615
+ });
616
+ const tex = (binding) => ({
617
+ binding,
618
+ visibility: COMPUTE,
619
+ texture: {
620
+ sampleType: "unfilterable-float",
621
+ viewDimension: "2d"
622
+ }
623
+ });
624
+ classifyLayout = device.createBindGroupLayout({ entries: [
625
+ u(COMPUTE),
626
+ tex(1),
627
+ tex(2),
628
+ {
629
+ binding: 3,
630
+ visibility: COMPUTE,
631
+ buffer: { type: "storage" }
632
+ }
633
+ ] });
634
+ classifyPipeLayout = device.createPipelineLayout({ bindGroupLayouts: [classifyLayout] });
635
+ horizLayout = device.createBindGroupLayout({ entries: [
636
+ u(COMPUTE),
637
+ {
638
+ binding: 3,
639
+ visibility: COMPUTE,
640
+ buffer: { type: "storage" }
641
+ },
642
+ {
643
+ binding: 4,
644
+ visibility: COMPUTE,
645
+ buffer: { type: "storage" }
646
+ }
647
+ ] });
648
+ horizPipeLayout = device.createPipelineLayout({ bindGroupLayouts: [horizLayout] });
649
+ resolveLayout = device.createBindGroupLayout({ entries: [
650
+ u(FRAGMENT),
651
+ {
652
+ binding: 5,
653
+ visibility: FRAGMENT,
654
+ buffer: { type: "read-only-storage" }
655
+ },
656
+ {
657
+ binding: 6,
658
+ visibility: FRAGMENT,
659
+ buffer: { type: "read-only-storage" }
660
+ }
661
+ ] });
662
+ resolvePipeLayout = device.createPipelineLayout({ bindGroupLayouts: [resolveLayout] });
663
+ }
664
+ const classify = device.createComputePipeline({
665
+ layout: classifyPipeLayout,
666
+ compute: {
667
+ module,
668
+ entryPoint: "classifyMain"
669
+ }
670
+ });
671
+ const horiz = device.createComputePipeline({
672
+ layout: horizPipeLayout,
673
+ compute: {
674
+ module,
675
+ entryPoint: "horizMain"
676
+ }
677
+ });
678
+ const resolve = device.createRenderPipeline({
679
+ layout: resolvePipeLayout,
680
+ vertex: {
681
+ module,
682
+ entryPoint: "bleedVert"
683
+ },
684
+ fragment: {
685
+ module,
686
+ entryPoint: "bleedResolveFrag",
687
+ targets: [{ format: "rgba8unorm-srgb" }]
688
+ }
689
+ });
690
+ const built = {
691
+ classify,
692
+ horiz,
693
+ resolve,
694
+ classifyLayout: classifyLayout === "auto" ? classify.getBindGroupLayout(0) : classifyLayout,
695
+ horizLayout: horizLayout === "auto" ? horiz.getBindGroupLayout(0) : horizLayout,
696
+ resolveLayout: resolveLayout === "auto" ? resolve.getBindGroupLayout(0) : resolveLayout
697
+ };
698
+ bleedPipelineCache.set(device, built);
699
+ return built;
700
+ }
701
+ function encodeGpuColorBleed(device, encoder, bleed, mipLevelCount, pool = getDeviceGpuPool(device)) {
702
+ const { width, height, pxRange, white, black } = bleed;
703
+ const globals = globalThis;
704
+ const bufUsage = globals.GPUBufferUsage ?? {
705
+ COPY_DST: 8,
706
+ UNIFORM: 64,
707
+ STORAGE: 128
708
+ };
709
+ const texUsage = globals.GPUTextureUsage ?? {
710
+ COPY_SRC: 1,
711
+ COPY_DST: 2,
712
+ TEXTURE_BINDING: 4,
713
+ RENDER_ATTACHMENT: 16
714
+ };
715
+ const transient = [];
716
+ const pipes = getBleedPipelines(device);
717
+ const wTex = pool.uploadTexture(width, height, "rgba8unorm", texUsage.TEXTURE_BINDING | texUsage.COPY_DST);
718
+ transient.push(wTex);
719
+ const bTex = pool.uploadTexture(width, height, "rgba8unorm", texUsage.TEXTURE_BINDING | texUsage.COPY_DST);
720
+ transient.push(bTex);
721
+ const bytes = width * height * 4;
722
+ const rawBuf = pool.buffer(bytes, bufUsage.STORAGE);
723
+ transient.push(rawBuf);
724
+ const hSeedBuf = pool.buffer(bytes, bufUsage.STORAGE);
725
+ transient.push(hSeedBuf);
726
+ const slot = pool.ringAlloc(16, bufUsage.UNIFORM | bufUsage.COPY_DST);
727
+ const radius = Math.max(pxRange * 2, 32);
728
+ device.queue.writeBuffer(slot.buffer, slot.offset, new Uint32Array([
729
+ width,
730
+ height,
731
+ radius,
732
+ 0
733
+ ]));
734
+ device.queue.writeTexture({ texture: wTex }, white, {
735
+ offset: 0,
736
+ bytesPerRow: width * 4,
737
+ rowsPerImage: height
738
+ }, [width, height]);
739
+ device.queue.writeTexture({ texture: bTex }, black, {
740
+ offset: 0,
741
+ bytesPerRow: width * 4,
742
+ rowsPerImage: height
743
+ }, [width, height]);
744
+ const texture = device.createTexture({
745
+ size: [width, height],
746
+ mipLevelCount,
747
+ format: "rgba8unorm-srgb",
748
+ usage: texUsage.TEXTURE_BINDING | texUsage.COPY_DST | texUsage.COPY_SRC | texUsage.RENDER_ATTACHMENT
749
+ });
750
+ const pBind = {
751
+ buffer: slot.buffer,
752
+ offset: slot.offset,
753
+ size: 16
754
+ };
755
+ const rawBind = {
756
+ buffer: rawBuf,
757
+ offset: 0,
758
+ size: bytes
759
+ };
760
+ const seedBind = {
761
+ buffer: hSeedBuf,
762
+ offset: 0,
763
+ size: bytes
764
+ };
765
+ const comp = encoder.beginComputePass();
766
+ const gx = Math.ceil(width / 64);
767
+ comp.setPipeline(pipes.classify);
768
+ comp.setBindGroup(0, device.createBindGroup({
769
+ layout: pipes.classifyLayout,
770
+ entries: [
771
+ {
772
+ binding: 0,
773
+ resource: pBind
774
+ },
775
+ {
776
+ binding: 1,
777
+ resource: wTex.createView()
778
+ },
779
+ {
780
+ binding: 2,
781
+ resource: bTex.createView()
782
+ },
783
+ {
784
+ binding: 3,
785
+ resource: rawBind
786
+ }
787
+ ]
788
+ }));
789
+ comp.dispatchWorkgroups(gx, height);
790
+ comp.setPipeline(pipes.horiz);
791
+ comp.setBindGroup(0, device.createBindGroup({
792
+ layout: pipes.horizLayout,
793
+ entries: [
794
+ {
795
+ binding: 0,
796
+ resource: pBind
797
+ },
798
+ {
799
+ binding: 3,
800
+ resource: rawBind
801
+ },
802
+ {
803
+ binding: 4,
804
+ resource: seedBind
805
+ }
806
+ ]
807
+ }));
808
+ comp.dispatchWorkgroups(gx, height);
809
+ comp.end();
810
+ const ren = encoder.beginRenderPass({ colorAttachments: [{
811
+ view: texture.createView({
812
+ baseMipLevel: 0,
813
+ mipLevelCount: 1
814
+ }),
815
+ loadOp: "clear",
816
+ storeOp: "store"
817
+ }] });
818
+ ren.setPipeline(pipes.resolve);
819
+ ren.setBindGroup(0, device.createBindGroup({
820
+ layout: pipes.resolveLayout,
821
+ entries: [
822
+ {
823
+ binding: 0,
824
+ resource: pBind
825
+ },
826
+ {
827
+ binding: 5,
828
+ resource: rawBind
829
+ },
830
+ {
831
+ binding: 6,
832
+ resource: seedBind
833
+ }
834
+ ]
835
+ }));
836
+ ren.draw(3);
837
+ ren.end();
838
+ return {
839
+ texture,
840
+ transient
841
+ };
842
+ }
843
+ export { POOL_IDLE_TRIM_MS, POOL_RING_BYTES, TILED_MAX_TEXELS, checkCommonAtlasLimits, createGpuPool, edtRadius, encodeGpuColorBleed, encodeJfaWork, flushDeferredColorBleed, getDeviceGpuPool, getJfaLayouts, openErrorScopes, peekDeferredColorBleed, poolSizeClass, putReadyGpuColorTexture, registerDeferredColorBleed, selectAtlasMode, selectWorkgroupDimension, storageBufferFits, supportsDirectStore, takeDeferredColorBleed, takeReadyGpuColorTexture };
844
+
845
+ //# sourceMappingURL=gpuCommon.js.map