@jbrowse/render-core 5.0.0-beta.1 → 5.0.0-beta.10

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 (352) hide show
  1. package/esm/RenderCanvas.d.ts +2 -2
  2. package/esm/RenderLifecycleMixin.d.ts +52 -20
  3. package/esm/RenderLifecycleMixin.js +89 -23
  4. package/esm/canvas2dUtils.d.ts +90 -23
  5. package/esm/canvas2dUtils.js +119 -36
  6. package/esm/colorRampLut.d.ts +5 -5
  7. package/esm/colorRampLut.js +6 -6
  8. package/esm/computePipeline.d.ts +14 -0
  9. package/esm/computePipeline.js +62 -0
  10. package/esm/contractReports.d.ts +54 -0
  11. package/esm/contractReports.js +112 -0
  12. package/esm/coverageBand.d.ts +13 -8
  13. package/esm/coverageBand.js +15 -5
  14. package/esm/coverageBandBuffers.d.ts +2 -9
  15. package/esm/coverageBandBuffers.js +1 -13
  16. package/esm/createRenderingBackend.d.ts +14 -18
  17. package/esm/createRenderingBackend.js +4 -2
  18. package/esm/displayPhase.d.ts +83 -104
  19. package/esm/displayPhase.js +42 -82
  20. package/esm/encodeMemo.d.ts +14 -0
  21. package/esm/encodeMemo.js +48 -0
  22. package/esm/gpuContextLostError.d.ts +30 -0
  23. package/esm/gpuContextLostError.js +40 -0
  24. package/esm/gpuDevice.d.ts +29 -10
  25. package/esm/gpuDevice.js +35 -16
  26. package/esm/graphicsCapabilities.d.ts +27 -19
  27. package/esm/graphicsCapabilities.js +40 -18
  28. package/esm/hal/createHal.d.ts +4 -5
  29. package/esm/hal/createHal.js +14 -4
  30. package/esm/hal/deviceGpuCache.d.ts +25 -30
  31. package/esm/hal/deviceGpuCache.js +88 -97
  32. package/esm/hal/gpuHalBase.d.ts +5 -4
  33. package/esm/hal/gpuHalBase.js +25 -14
  34. package/esm/hal/index.d.ts +2 -2
  35. package/esm/hal/index.js +1 -1
  36. package/esm/hal/mockHal.d.ts +15 -10
  37. package/esm/hal/mockHal.js +31 -18
  38. package/esm/hal/oomReporter.d.ts +7 -0
  39. package/esm/hal/oomReporter.js +10 -0
  40. package/esm/hal/passIds.d.ts +8 -7
  41. package/esm/hal/passIds.js +11 -10
  42. package/esm/hal/regionRegistry.d.ts +0 -1
  43. package/esm/hal/regionRegistry.js +3 -15
  44. package/esm/hal/types.d.ts +55 -18
  45. package/esm/hal/webgl2Hal.d.ts +23 -6
  46. package/esm/hal/webgl2Hal.js +161 -155
  47. package/esm/hal/webgpuHal.d.ts +29 -13
  48. package/esm/hal/webgpuHal.js +221 -153
  49. package/esm/installUpload.d.ts +16 -3
  50. package/esm/installUpload.js +13 -41
  51. package/esm/instanceCache.d.ts +10 -7
  52. package/esm/instanceCache.js +14 -15
  53. package/esm/instancePass.d.ts +2 -1
  54. package/esm/mapUploadSync.d.ts +2 -10
  55. package/esm/mapUploadSync.js +2 -3
  56. package/esm/marks/barMark.d.ts +30 -0
  57. package/esm/marks/barMark.js +149 -0
  58. package/esm/marks/colorFill.d.ts +17 -0
  59. package/esm/marks/colorFill.js +26 -0
  60. package/esm/marks/drawAgainstHit.d.ts +113 -0
  61. package/esm/marks/drawAgainstHit.js +407 -0
  62. package/esm/marks/ellipseDistance.d.ts +10 -0
  63. package/esm/marks/ellipseDistance.js +136 -0
  64. package/esm/marks/glyphPaint.d.ts +36 -0
  65. package/esm/marks/glyphPaint.js +77 -0
  66. package/esm/marks/index.d.ts +33 -0
  67. package/esm/marks/index.js +20 -0
  68. package/esm/marks/lineMark.d.ts +37 -0
  69. package/esm/marks/lineMark.js +416 -0
  70. package/esm/marks/linkMark.d.ts +76 -0
  71. package/esm/marks/linkMark.js +585 -0
  72. package/esm/marks/markBackend.d.ts +118 -0
  73. package/esm/marks/markBackend.js +196 -0
  74. package/esm/marks/markHit.d.ts +32 -0
  75. package/esm/marks/markHit.js +61 -0
  76. package/esm/marks/markInk.d.ts +18 -0
  77. package/esm/marks/markInk.js +71 -0
  78. package/esm/marks/markPaint.d.ts +14 -0
  79. package/esm/marks/markPaint.js +32 -0
  80. package/esm/marks/markPlan.d.ts +25 -0
  81. package/esm/marks/markPlan.js +20 -0
  82. package/esm/marks/markRamp.d.ts +72 -0
  83. package/esm/marks/markRamp.js +197 -0
  84. package/esm/marks/nearestMarkHit.d.ts +55 -0
  85. package/esm/marks/nearestMarkHit.js +158 -0
  86. package/esm/marks/pathRecorder.d.ts +14 -0
  87. package/esm/marks/pathRecorder.js +80 -0
  88. package/esm/marks/pointMark.d.ts +42 -0
  89. package/esm/marks/pointMark.js +125 -0
  90. package/esm/marks/rowLane.d.ts +39 -0
  91. package/esm/marks/rowLane.js +41 -0
  92. package/esm/marks/rowSpanIndex.d.ts +29 -0
  93. package/esm/marks/rowSpanIndex.js +141 -0
  94. package/esm/marks/rowTable.d.ts +41 -0
  95. package/esm/marks/rowTable.js +75 -0
  96. package/esm/marks/ruleMark.d.ts +21 -0
  97. package/esm/marks/ruleMark.js +91 -0
  98. package/esm/marks/spanMark.d.ts +42 -0
  99. package/esm/marks/spanMark.js +81 -0
  100. package/esm/marks/types.d.ts +261 -0
  101. package/esm/marks/types.js +175 -0
  102. package/esm/marks/valueScale.d.ts +23 -0
  103. package/esm/marks/valueScale.js +11 -0
  104. package/esm/namedReactions.d.ts +3 -4
  105. package/esm/namedReactions.js +3 -4
  106. package/esm/perRegionRenderingBackend.d.ts +21 -3
  107. package/esm/perRegionRenderingBackend.js +37 -3
  108. package/esm/regionDataMap.d.ts +2 -2
  109. package/esm/regionDataMap.js +25 -23
  110. package/esm/renderBlock.d.ts +14 -0
  111. package/esm/renderBlock.js +25 -0
  112. package/esm/renderingBackendBase.d.ts +20 -14
  113. package/esm/renderingBackendBase.js +12 -7
  114. package/esm/scoreScale.d.ts +27 -0
  115. package/esm/scoreScale.js +88 -0
  116. package/esm/shaders/barMark.generated.d.ts +3 -0
  117. package/esm/shaders/barMark.generated.js +7 -0
  118. package/esm/shaders/barMark.glsl.generated.d.ts +2 -0
  119. package/esm/shaders/barMark.glsl.generated.js +4 -0
  120. package/esm/shaders/barMark.iface.generated.d.ts +90 -0
  121. package/esm/shaders/barMark.iface.generated.js +205 -0
  122. package/esm/shaders/barMark.wgsl.generated.d.ts +1 -0
  123. package/esm/shaders/barMark.wgsl.generated.js +3 -0
  124. package/esm/shaders/capsule.js.generated.d.ts +1 -0
  125. package/esm/shaders/capsule.js.generated.js +11 -0
  126. package/esm/shaders/clipStrip.generated.d.ts +2 -0
  127. package/esm/shaders/clipStrip.generated.js +4 -0
  128. package/esm/shaders/clipStrip.js.generated.d.ts +1 -0
  129. package/esm/shaders/clipStrip.js.generated.js +21 -0
  130. package/esm/shaders/colorRampLut.js.generated.d.ts +1 -0
  131. package/esm/shaders/colorRampLut.js.generated.js +17 -0
  132. package/esm/shaders/coverageBar.generated.d.ts +2 -3
  133. package/esm/shaders/coverageBar.generated.js +4 -3
  134. package/esm/shaders/coverageBar.glsl.generated.d.ts +2 -0
  135. package/esm/shaders/coverageBar.glsl.generated.js +4 -0
  136. package/esm/shaders/coverageBar.iface.generated.js +1 -1
  137. package/esm/shaders/coverageBar.wgsl.generated.d.ts +1 -0
  138. package/esm/shaders/coverageBar.wgsl.generated.js +3 -0
  139. package/esm/shaders/coverageClip.generated.d.ts +3 -0
  140. package/esm/shaders/coverageClip.generated.js +7 -0
  141. package/esm/shaders/coverageClip.glsl.generated.d.ts +2 -0
  142. package/esm/shaders/coverageClip.glsl.generated.js +4 -0
  143. package/esm/shaders/coverageClip.iface.generated.d.ts +85 -0
  144. package/esm/shaders/coverageClip.iface.generated.js +114 -0
  145. package/esm/shaders/coverageClip.wgsl.generated.d.ts +1 -0
  146. package/esm/shaders/coverageClip.wgsl.generated.js +3 -0
  147. package/esm/shaders/coverageIndicator.generated.d.ts +2 -3
  148. package/esm/shaders/coverageIndicator.generated.js +4 -3
  149. package/esm/shaders/coverageIndicator.glsl.generated.d.ts +2 -0
  150. package/esm/shaders/coverageIndicator.glsl.generated.js +4 -0
  151. package/esm/shaders/coverageIndicator.iface.generated.js +1 -1
  152. package/esm/shaders/coverageIndicator.wgsl.generated.d.ts +1 -0
  153. package/esm/shaders/coverageIndicator.wgsl.generated.js +3 -0
  154. package/esm/shaders/coverageInterbase.generated.d.ts +2 -3
  155. package/esm/shaders/coverageInterbase.generated.js +4 -3
  156. package/esm/shaders/coverageInterbase.glsl.generated.d.ts +2 -0
  157. package/esm/shaders/coverageInterbase.glsl.generated.js +4 -0
  158. package/esm/shaders/coverageInterbase.iface.generated.js +1 -1
  159. package/esm/shaders/coverageInterbase.wgsl.generated.d.ts +1 -0
  160. package/esm/shaders/coverageInterbase.wgsl.generated.js +3 -0
  161. package/esm/shaders/coverageMod.generated.d.ts +2 -3
  162. package/esm/shaders/coverageMod.generated.js +4 -3
  163. package/esm/shaders/coverageMod.glsl.generated.d.ts +2 -0
  164. package/esm/shaders/coverageMod.glsl.generated.js +4 -0
  165. package/esm/shaders/coverageMod.iface.generated.js +1 -1
  166. package/esm/shaders/coverageMod.wgsl.generated.d.ts +1 -0
  167. package/esm/shaders/coverageMod.wgsl.generated.js +3 -0
  168. package/esm/shaders/coverageSnp.generated.d.ts +2 -3
  169. package/esm/shaders/coverageSnp.generated.js +4 -3
  170. package/esm/shaders/coverageSnp.glsl.generated.d.ts +2 -0
  171. package/esm/shaders/coverageSnp.glsl.generated.js +4 -0
  172. package/esm/shaders/coverageSnp.iface.generated.js +1 -1
  173. package/esm/shaders/coverageSnp.wgsl.generated.d.ts +1 -0
  174. package/esm/shaders/coverageSnp.wgsl.generated.js +3 -0
  175. package/esm/shaders/curveDistance.js.generated.d.ts +5 -0
  176. package/esm/shaders/curveDistance.js.generated.js +87 -0
  177. package/esm/shaders/hpmath.js.generated.d.ts +2 -1
  178. package/esm/shaders/hpmath.js.generated.js +5 -2
  179. package/esm/shaders/lineCenterMark.generated.d.ts +3 -0
  180. package/esm/shaders/lineCenterMark.generated.js +7 -0
  181. package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -0
  182. package/esm/shaders/lineCenterMark.glsl.generated.js +4 -0
  183. package/esm/shaders/lineCenterMark.iface.generated.d.ts +104 -0
  184. package/esm/shaders/lineCenterMark.iface.generated.js +237 -0
  185. package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -0
  186. package/esm/shaders/lineCenterMark.wgsl.generated.js +3 -0
  187. package/esm/shaders/lineCommon.generated.d.ts +2 -0
  188. package/esm/shaders/lineCommon.generated.js +4 -0
  189. package/esm/shaders/lineStepMark.generated.d.ts +3 -0
  190. package/esm/shaders/lineStepMark.generated.js +7 -0
  191. package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -0
  192. package/esm/shaders/lineStepMark.glsl.generated.js +4 -0
  193. package/esm/shaders/lineStepMark.iface.generated.d.ts +98 -0
  194. package/esm/shaders/lineStepMark.iface.generated.js +225 -0
  195. package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -0
  196. package/esm/shaders/lineStepMark.wgsl.generated.js +3 -0
  197. package/esm/shaders/linkMark.consts.generated.d.ts +14 -0
  198. package/esm/shaders/linkMark.consts.generated.js +16 -0
  199. package/esm/shaders/linkMark.generated.d.ts +4 -0
  200. package/esm/shaders/linkMark.generated.js +8 -0
  201. package/esm/shaders/linkMark.glsl.generated.d.ts +2 -0
  202. package/esm/shaders/linkMark.glsl.generated.js +4 -0
  203. package/esm/shaders/linkMark.iface.generated.d.ts +142 -0
  204. package/esm/shaders/linkMark.iface.generated.js +1829 -0
  205. package/esm/shaders/linkMark.js.generated.d.ts +7 -0
  206. package/esm/shaders/linkMark.js.generated.js +159 -0
  207. package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -0
  208. package/esm/shaders/linkMark.wgsl.generated.js +3 -0
  209. package/esm/shaders/markColor.generated.d.ts +9 -0
  210. package/esm/shaders/markColor.generated.js +11 -0
  211. package/esm/shaders/pointGlyph.js.generated.d.ts +2 -0
  212. package/esm/shaders/pointGlyph.js.generated.js +15 -0
  213. package/esm/shaders/pointMark.consts.generated.d.ts +7 -0
  214. package/esm/shaders/pointMark.consts.generated.js +9 -0
  215. package/esm/shaders/pointMark.generated.d.ts +4 -0
  216. package/esm/shaders/pointMark.generated.js +8 -0
  217. package/esm/shaders/pointMark.glsl.generated.d.ts +2 -0
  218. package/esm/shaders/pointMark.glsl.generated.js +4 -0
  219. package/esm/shaders/pointMark.iface.generated.d.ts +98 -0
  220. package/esm/shaders/pointMark.iface.generated.js +219 -0
  221. package/esm/shaders/pointMark.js.generated.d.ts +3 -0
  222. package/esm/shaders/pointMark.js.generated.js +93 -0
  223. package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -0
  224. package/esm/shaders/pointMark.wgsl.generated.js +3 -0
  225. package/esm/shaders/rowRect.generated.d.ts +0 -1
  226. package/esm/shaders/rowRect.generated.js +0 -1
  227. package/esm/shaders/rowTable.generated.d.ts +1 -0
  228. package/esm/shaders/rowTable.generated.js +3 -0
  229. package/esm/shaders/rowTable.js.generated.d.ts +5 -0
  230. package/esm/shaders/rowTable.js.generated.js +29 -0
  231. package/esm/shaders/scoreScale.generated.d.ts +2 -0
  232. package/esm/shaders/scoreScale.generated.js +4 -0
  233. package/esm/shaders/scoreScale.js.generated.d.ts +1 -0
  234. package/esm/shaders/scoreScale.js.generated.js +50 -23
  235. package/esm/shaders/spanMark.generated.d.ts +3 -0
  236. package/esm/shaders/spanMark.generated.js +7 -0
  237. package/esm/shaders/spanMark.glsl.generated.d.ts +2 -0
  238. package/esm/shaders/spanMark.glsl.generated.js +4 -0
  239. package/esm/shaders/spanMark.iface.generated.d.ts +81 -0
  240. package/esm/shaders/spanMark.iface.generated.js +215 -0
  241. package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -0
  242. package/esm/shaders/spanMark.wgsl.generated.js +3 -0
  243. package/esm/sharedBackendKey.d.ts +18 -0
  244. package/esm/{keyedRenderingBackend.js → sharedBackendKey.js} +5 -0
  245. package/esm/slangPass.d.ts +18 -11
  246. package/esm/slangPass.js +12 -4
  247. package/esm/useGraphicsCapabilities.d.ts +1 -1
  248. package/esm/useGraphicsCapabilities.js +1 -1
  249. package/esm/useRenderingBackend.d.ts +13 -13
  250. package/esm/useRenderingBackend.js +58 -20
  251. package/esm/webgpuUtils.d.ts +3 -11
  252. package/esm/webgpuUtils.js +12 -33
  253. package/package.json +32 -7
  254. package/src/shaders/antialias.slang +46 -0
  255. package/src/shaders/arcHull.test.ts +267 -0
  256. package/src/shaders/barMark.generated.ts +11 -0
  257. package/src/shaders/barMark.glsl.generated.ts +6 -0
  258. package/src/shaders/barMark.iface.generated.ts +285 -0
  259. package/src/shaders/barMark.slang +167 -0
  260. package/src/shaders/barMark.wgsl.generated.ts +4 -0
  261. package/src/shaders/capsule.js.generated.ts +14 -0
  262. package/src/shaders/capsule.slang +12 -4
  263. package/src/shaders/clipStrip.generated.ts +6 -0
  264. package/src/shaders/clipStrip.js.generated.ts +22 -0
  265. package/src/shaders/clipStrip.slang +34 -0
  266. package/src/shaders/clipStrip.test.ts +39 -0
  267. package/src/shaders/colorPack.slang +5 -1
  268. package/src/shaders/colorRampLut.js.generated.ts +22 -0
  269. package/src/shaders/colorRampLut.slang +15 -1
  270. package/src/shaders/coverageBand.slang +64 -32
  271. package/src/shaders/coverageBar.generated.ts +6 -5
  272. package/src/shaders/coverageBar.glsl.generated.ts +6 -0
  273. package/src/shaders/coverageBar.iface.generated.ts +1 -1
  274. package/src/shaders/coverageBar.slang +10 -10
  275. package/src/shaders/coverageBar.wgsl.generated.ts +4 -0
  276. package/src/shaders/coverageClip.generated.ts +11 -0
  277. package/src/shaders/coverageClip.glsl.generated.ts +6 -0
  278. package/src/shaders/coverageClip.iface.generated.ts +172 -0
  279. package/src/shaders/coverageClip.slang +38 -0
  280. package/src/shaders/coverageClip.wgsl.generated.ts +4 -0
  281. package/src/shaders/coverageIndicator.generated.ts +6 -5
  282. package/src/shaders/coverageIndicator.glsl.generated.ts +6 -0
  283. package/src/shaders/coverageIndicator.iface.generated.ts +1 -1
  284. package/src/shaders/coverageIndicator.wgsl.generated.ts +4 -0
  285. package/src/shaders/coverageInterbase.generated.ts +6 -5
  286. package/src/shaders/coverageInterbase.glsl.generated.ts +6 -0
  287. package/src/shaders/coverageInterbase.iface.generated.ts +1 -1
  288. package/src/shaders/coverageInterbase.wgsl.generated.ts +4 -0
  289. package/src/shaders/coverageMod.generated.ts +6 -5
  290. package/src/shaders/coverageMod.glsl.generated.ts +6 -0
  291. package/src/shaders/coverageMod.iface.generated.ts +1 -1
  292. package/src/shaders/coverageMod.wgsl.generated.ts +4 -0
  293. package/src/shaders/coverageSnp.generated.ts +6 -5
  294. package/src/shaders/coverageSnp.glsl.generated.ts +6 -0
  295. package/src/shaders/coverageSnp.iface.generated.ts +1 -1
  296. package/src/shaders/coverageSnp.wgsl.generated.ts +4 -0
  297. package/src/shaders/curveDistance.js.generated.ts +91 -0
  298. package/src/shaders/curveDistance.slang +265 -0
  299. package/src/shaders/hpClampFloor.test.ts +87 -0
  300. package/src/shaders/hpmath.js.generated.ts +6 -2
  301. package/src/shaders/hpmath.slang +100 -48
  302. package/src/shaders/insetValueScale.test.ts +67 -0
  303. package/src/shaders/lineCenterMark.generated.ts +11 -0
  304. package/src/shaders/lineCenterMark.glsl.generated.ts +6 -0
  305. package/src/shaders/lineCenterMark.iface.generated.ts +328 -0
  306. package/src/shaders/lineCenterMark.slang +127 -0
  307. package/src/shaders/lineCenterMark.wgsl.generated.ts +4 -0
  308. package/src/shaders/lineCommon.generated.ts +6 -0
  309. package/src/shaders/lineCommon.slang +102 -0
  310. package/src/shaders/lineStepMark.generated.ts +11 -0
  311. package/src/shaders/lineStepMark.glsl.generated.ts +6 -0
  312. package/src/shaders/lineStepMark.iface.generated.ts +311 -0
  313. package/src/shaders/lineStepMark.slang +125 -0
  314. package/src/shaders/lineStepMark.wgsl.generated.ts +4 -0
  315. package/src/shaders/linkMark.consts.generated.ts +30 -0
  316. package/src/shaders/linkMark.generated.ts +12 -0
  317. package/src/shaders/linkMark.glsl.generated.ts +6 -0
  318. package/src/shaders/linkMark.iface.generated.ts +1954 -0
  319. package/src/shaders/linkMark.js.generated.ts +167 -0
  320. package/src/shaders/linkMark.slang +439 -0
  321. package/src/shaders/linkMark.wgsl.generated.ts +4 -0
  322. package/src/shaders/markColor.generated.ts +20 -0
  323. package/src/shaders/markColor.slang +128 -0
  324. package/src/shaders/pointGlyph.js.generated.ts +20 -0
  325. package/src/shaders/pointGlyph.slang +23 -7
  326. package/src/shaders/pointGlyphPad.test.ts +242 -0
  327. package/src/shaders/pointMark.consts.generated.ts +16 -0
  328. package/src/shaders/pointMark.generated.ts +12 -0
  329. package/src/shaders/pointMark.glsl.generated.ts +6 -0
  330. package/src/shaders/pointMark.iface.generated.ts +304 -0
  331. package/src/shaders/pointMark.js.generated.ts +99 -0
  332. package/src/shaders/pointMark.slang +227 -0
  333. package/src/shaders/pointMark.wgsl.generated.ts +4 -0
  334. package/src/shaders/rowRect.generated.ts +0 -2
  335. package/src/shaders/rowRect.slang +39 -58
  336. package/src/shaders/rowTable.generated.ts +4 -0
  337. package/src/shaders/rowTable.js.generated.ts +37 -0
  338. package/src/shaders/rowTable.slang +98 -0
  339. package/src/shaders/scoreScale.generated.ts +6 -0
  340. package/src/shaders/scoreScale.js.generated.ts +48 -23
  341. package/src/shaders/scoreScale.slang +49 -55
  342. package/src/shaders/sdEllipse.test.ts +211 -0
  343. package/src/shaders/spanMark.generated.ts +11 -0
  344. package/src/shaders/spanMark.glsl.generated.ts +6 -0
  345. package/src/shaders/spanMark.iface.generated.ts +289 -0
  346. package/src/shaders/spanMark.slang +77 -0
  347. package/src/shaders/spanMark.wgsl.generated.ts +4 -0
  348. package/src/shaders/valueScale.slang +26 -0
  349. package/src/shaders/wideCircleLeg.test.ts +85 -0
  350. package/esm/globalRenderingBackend.d.ts +0 -90
  351. package/esm/globalRenderingBackend.js +0 -53
  352. package/esm/keyedRenderingBackend.d.ts +0 -41
@@ -0,0 +1,4 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from linkMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+
4
+ export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) canvasHeight_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n @align(8) rowHeight_0 : f32,\n @align(4) rowOffsetPx_0 : f32,\n @align(16) reverse_0 : i32,\n @align(4) stemPx_0 : f32,\n @align(8) dashPx_0 : f32,\n @align(4) gapPx_0 : f32,\n @align(16) footPx_0 : f32,\n @align(4) curveSegments_0 : u32,\n @align(8) insetPx_0 : f32,\n @align(4) domainMin_0 : f32,\n @align(16) domainMax_0 : f32,\n @align(4) valueScaleType_0 : i32,\n @align(8) valueSymlogConstant_0 : f32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n @align(16) valued_0 : i32,\n @align(4) linkShape_0 : i32,\n @align(8) sizeMode_0 : i32,\n @align(4) sizeConstantPx_0 : f32,\n @align(16) sizeDomainMin_0 : f32,\n @align(4) sizeDomainMax_0 : f32,\n @align(8) sizeScaleType_0 : i32,\n @align(4) sizeRangeMin_0 : f32,\n @align(16) sizeRangeMax_0 : f32,\n @align(4) canvasWidth_0 : f32,\n @align(8) regionCount_0 : u32,\n @align(4) zero_0 : f32,\n @align(16) ownEntry_0 : vec4<f32>,\n @align(16) ownSpan_0 : vec4<f32>,\n @align(16) regionTable_0 : array<vec4<f32>, i32(256)>,\n @align(16) regionSpan_0 : array<vec4<f32>, i32(128)>,\n @align(16) rowTableKeys_0 : i32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_2 : f32, domainMax_2 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn linkStrokeWidthPx_0( raw_0 : f32, sizeMode_1 : i32, constantPx_0 : f32, domainMin_3 : f32, domainMax_3 : f32, scaleType_2 : i32, rangeMin_0 : f32, rangeMax_0 : f32, dpr_0 : f32) -> f32\n{\n var w_1 : f32;\n if(sizeMode_1 == i32(1))\n {\n if(raw_0 > -1.00000001504746622e+29f)\n {\n w_1 = rangeMin_0 + normalizeScore_0(raw_0, domainMin_3, domainMax_3, scaleType_2, 1.0f) * (rangeMax_0 - rangeMin_0);\n }\n else\n {\n w_1 = rangeMin_0;\n }\n }\n else\n {\n w_1 = constantPx_0;\n }\n return max(w_1, 1.5f / dpr_0);\n}\n\nfn aaPx_0( dpr_1 : f32) -> f32\n{\n return 1.0f / max(dpr_1, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_2 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_2);\n}\n\nfn rowBandTopPx_0( rowOffsetPx_1 : f32, rowHeight_1 : f32, slot_1 : u32) -> f32\n{\n return rowOffsetPx_1 + rowHeight_1 * f32(slot_1);\n}\n\nfn linkBaseYPx_0( rowOffsetPx_2 : f32, rowHeight_2 : f32, row_0 : u32, reverse_1 : i32) -> f32\n{\n var _S15 : f32 = rowBandTopPx_0(rowOffsetPx_2, rowHeight_2, row_0);\n var _S16 : f32;\n if(reverse_1 != i32(0))\n {\n _S16 = 0.0f;\n }\n else\n {\n _S16 = rowHeight_2;\n }\n return _S15 + _S16;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpViewportOffsetBp_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n return max(bpRange_0.x - splitPos_0.x, floorBp_0) + max(bpRange_0.y - splitPos_0.y, floorBp_0);\n}\n\nfn entryPx_0( bp_0 : u32, r_0 : vec4<f32>, hpZero_1 : f32) -> f32\n{\n return r_0.x - hpViewportOffsetBp_0(hpSplitUint_0(bp_0), vec3<f32>(r_0.y, r_0.z, 0.0f), hpZero_1) * r_0.w;\n}\n\nfn valueToYPxScaled_0( value_2 : f32, domainMin_4 : f32, domainMax_4 : f32, h_1 : f32, scaleType_3 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_2, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_1;\n}\n\nfn insetValueYPx_0( value_3 : f32, domainMin_5 : f32, domainMax_5 : f32, h_2 : f32, scaleType_4 : i32, insetPx_1 : f32, symlogConstant_3 : f32) -> f32\n{\n var _S17 : f32 = min(insetPx_1, h_2 * 0.5f);\n return _S17 + valueToYPxScaled_0(value_3, domainMin_5, domainMax_5, h_2 - 2.0f * _S17, scaleType_4, symlogConstant_3);\n}\n\nfn linkValuePx_0( value_4 : f32, domainMin_6 : f32, domainMax_6 : f32, h_3 : f32, scaleType_5 : i32, insetPx_2 : f32, symlogConstant_4 : f32) -> f32\n{\n return h_3 - insetValueYPx_0(value_4, domainMin_6, domainMax_6, h_3, scaleType_5, insetPx_2, symlogConstant_4);\n}\n\nfn linkApexPx_0( halfWidthPx_0 : f32, reachPx_0 : f32, linkShape_1 : i32, valued_1 : i32, valuePx_0 : f32) -> f32\n{\n if(valued_1 != i32(0))\n {\n return valuePx_0;\n }\n if(linkShape_1 == i32(2))\n {\n return 0.0f;\n }\n if(linkShape_1 == i32(1))\n {\n return halfWidthPx_0;\n }\n return min(halfWidthPx_0, reachPx_0);\n}\n\nfn linkIsFar_0( halfWidthPx_1 : f32, screenWidthPx_0 : f32) -> bool\n{\n return (2.0f * halfWidthPx_1) > (3.0f * screenWidthPx_0);\n}\n\nfn linkRadiiPx_0( halfWidthPx_2 : f32, apexPx_0 : f32, screenWidthPx_1 : f32) -> vec2<f32>\n{\n if(linkIsFar_0(halfWidthPx_2, screenWidthPx_1))\n {\n return vec2<f32>(halfWidthPx_2, halfWidthPx_2);\n }\n return vec2<f32>(halfWidthPx_2, apexPx_0);\n}\n\nfn legSweepAngle_0( radiusPx_0 : f32, yReachPx_0 : f32) -> f32\n{\n return asin(clamp(yReachPx_0 / max(radiusPx_0, 9.99999997475242708e-07f), 0.0f, 1.0f));\n}\n\nfn wideCircleLeg_0( seg_0 : u32, segments_0 : u32, legSweep_0 : f32) -> vec2<f32>\n{\n var half_0 : u32 = segments_0 / u32(2);\n if(seg_0 <= half_0)\n {\n return vec2<f32>(1.0f, f32(seg_0) / f32(half_0) * legSweep_0);\n }\n return vec2<f32>(-1.0f, f32(segments_0 - seg_0) / f32(segments_0 - half_0 - u32(1)) * legSweep_0);\n}\n\nfn wideCircleLegStep_0( seg_1 : u32, segments_1 : u32, legSweep_1 : f32) -> f32\n{\n var half_1 : u32 = segments_1 / u32(2);\n var _S18 : u32;\n if(seg_1 <= half_1)\n {\n _S18 = half_1;\n }\n else\n {\n _S18 = segments_1 - half_1 - u32(1);\n }\n return legSweep_1 / f32(_S18);\n}\n\nfn wideCircleHullPoint_0( sinB_0 : f32, sinHalfB_0 : f32, cosHalf_0 : f32, radiusPx_1 : f32, padPx_0 : f32) -> vec2<f32>\n{\n var sec_0 : f32;\n if(padPx_0 > 0.0f)\n {\n sec_0 = 1.0f / max(cosHalf_0, 9.99999997475242708e-07f);\n }\n else\n {\n sec_0 = 1.0f;\n }\n var grow_0 : f32 = radiusPx_1 * (sec_0 - 1.0f) + sec_0 * padPx_0;\n var sh2_0 : f32 = sinHalfB_0 * sinHalfB_0;\n return vec2<f32>(grow_0 * (1.0f - 2.0f * sh2_0) - 2.0f * radiusPx_1 * sh2_0, (radiusPx_1 + grow_0) * sinB_0);\n}\n\nfn ellipseHullPoint_0( cosA_0 : f32, sinA_0 : f32, cosHalf_1 : f32, sinHalf_0 : f32, rx_0 : f32, ry_0 : f32, padPx_1 : f32) -> vec2<f32>\n{\n var px_0 : f32 = cosA_0 * rx_0;\n var py_0 : f32 = sinA_0 * ry_0;\n if(padPx_1 <= 0.0f)\n {\n var d_0 : f32 = - padPx_1;\n var gx_0 : f32 = ry_0 * cosA_0;\n var gy_0 : f32 = rx_0 * sinA_0;\n var glen_0 : f32 = sqrt(gx_0 * gx_0 + gy_0 * gy_0);\n var acrossX_0 : bool = (ry_0 * glen_0) < (d_0 * rx_0);\n var acrossY_0 : bool = (rx_0 * glen_0) < (d_0 * ry_0);\n var _S19 : bool;\n if(acrossX_0)\n {\n _S19 = acrossY_0;\n }\n else\n {\n _S19 = false;\n }\n if(_S19)\n {\n return vec2<f32>(0.0f, 0.0f);\n }\n if(acrossX_0)\n {\n var _S20 : f32 = ry_0 * ry_0;\n return vec2<f32>(f32((i32(sign((cosA_0))))) * sqrt(max(_S20 - d_0 * d_0, 0.0f) * max(rx_0 * rx_0 - _S20, 0.0f)) / max(ry_0, 9.99999997475242708e-07f), 0.0f);\n }\n if(acrossY_0)\n {\n var _S21 : f32 = rx_0 * rx_0;\n return vec2<f32>(0.0f, f32((i32(sign((sinA_0))))) * sqrt(max(_S21 - d_0 * d_0, 0.0f) * max(ry_0 * ry_0 - _S21, 0.0f)) / max(rx_0, 9.99999997475242708e-07f));\n }\n var k_0 : f32 = d_0 / max(glen_0, 9.99999997475242708e-07f);\n return vec2<f32>(px_0 - gx_0 * k_0, py_0 - gy_0 * k_0);\n }\n var _S22 : f32 = cosA_0 * cosHalf_1;\n var _S23 : f32 = sinA_0 * sinHalf_0;\n var ax_0 : f32 = ry_0 * (_S22 + _S23);\n var _S24 : f32 = sinA_0 * cosHalf_1;\n var _S25 : f32 = cosA_0 * sinHalf_0;\n var ay_0 : f32 = rx_0 * (_S24 - _S25);\n var bx_0 : f32 = ry_0 * (_S22 - _S23);\n var by_0 : f32 = rx_0 * (_S24 + _S25);\n var _S26 : f32 = max(sqrt(ax_0 * ax_0 + ay_0 * ay_0), 9.99999968265522539e-21f);\n var _S27 : f32 = max(sqrt(bx_0 * bx_0 + by_0 * by_0), 9.99999968265522539e-21f);\n var nx_0 : f32 = ax_0 / _S26 + bx_0 / _S27;\n var ny_0 : f32 = ay_0 / _S26 + by_0 / _S27;\n var m_0 : f32 = 2.0f * padPx_1 / max(nx_0 * nx_0 + ny_0 * ny_0, 0.00019999999494758f);\n return vec2<f32>(px_0 / cosHalf_1 + nx_0 * m_0, py_0 / cosHalf_1 + ny_0 * m_0);\n}\n\nstruct LinkVertex_0\n{\n screen_0 : vec2<f32>,\n local_0 : vec2<f32>,\n radii_0 : vec2<f32>,\n kind_0 : f32,\n legSide_0 : f32,\n};\n\nstruct LinkInstance_0\n{\n x_2 : u32,\n x2_0 : u32,\n x2Region_0 : u32,\n y_1 : f32,\n size_0 : f32,\n color_1 : u32,\n row_1 : u32,\n feet_0 : u32,\n};\n\nstruct LinkEnv_0\n{\n strokeHalf_0 : f32,\n hw_0 : f32,\n baseY_0 : f32,\n ySign_0 : f32,\n reach_0 : f32,\n xPx_0 : f32,\n x2Px_0 : f32,\n placed_0 : bool,\n};\n\nfn curveVertex_0( inst_0 : LinkInstance_0, e_0 : LinkEnv_0, seg_2 : u32, side_0 : f32) -> LinkVertex_0\n{\n var t_3 : f32 = f32(seg_2) / f32(u_0.curveSegments_0);\n var pad_0 : f32 = side_0 * e_0.hw_0;\n var v_0 : LinkVertex_0;\n v_0.legSide_0 = 1.0f;\n var legDir_0 : f32;\n var origin_0 : vec2<f32>;\n if(!e_0.placed_0)\n {\n v_0.kind_0 = 2.0f;\n v_0.radii_0 = vec2<f32>(0.0f, u_0.stemPx_0);\n v_0.local_0 = vec2<f32>(pad_0, - t_3 * (u_0.stemPx_0 + e_0.hw_0));\n origin_0 = vec2<f32>(e_0.xPx_0, e_0.baseY_0);\n legDir_0 = 1.0f;\n }\n else\n {\n var pairHalf_0 : f32 = abs(e_0.x2Px_0 - e_0.xPx_0) * 0.5f;\n var apex_0 : f32 = linkApexPx_0(pairHalf_0, e_0.reach_0, u_0.linkShape_0, u_0.valued_0, linkValuePx_0(inst_0.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0, u_0.insetPx_0, u_0.valueSymlogConstant_0));\n v_0.radii_0 = linkRadiiPx_0(pairHalf_0, apex_0, u_0.canvasWidth_0);\n var _S28 : f32 = min(e_0.xPx_0, e_0.x2Px_0);\n var _S29 : f32 = max(e_0.xPx_0, e_0.x2Px_0);\n if((u_0.linkShape_0) == i32(2))\n {\n v_0.kind_0 = 3.0f;\n var _S30 : f32 = max(2.0f * pairHalf_0, 2.5f);\n v_0.radii_0 = vec2<f32>(_S30, 0.0f);\n v_0.local_0 = vec2<f32>(t_3 * _S30, pad_0);\n origin_0 = vec2<f32>((e_0.xPx_0 + e_0.x2Px_0) * 0.5f - _S30 * 0.5f, e_0.baseY_0 - apex_0 * e_0.ySign_0);\n legDir_0 = 1.0f;\n }\n else\n {\n if(linkIsFar_0(pairHalf_0, u_0.canvasWidth_0))\n {\n v_0.kind_0 = 1.0f;\n var legSweep_2 : f32 = legSweepAngle_0(v_0.radii_0.x, e_0.reach_0 + e_0.hw_0);\n var leg_0 : vec2<f32> = wideCircleLeg_0(seg_2, u_0.curveSegments_0, legSweep_2);\n var b_0 : f32 = leg_0.y;\n var _S31 : vec2<f32> = wideCircleHullPoint_0(sin(b_0), sin(b_0 * 0.5f), cos(0.5f * wideCircleLegStep_0(seg_2, u_0.curveSegments_0, legSweep_2)), v_0.radii_0.x, pad_0);\n v_0.local_0 = _S31;\n v_0.local_0[i32(1)] = - _S31.y;\n var _S32 : f32 = leg_0.x;\n if(_S32 > 0.0f)\n {\n legDir_0 = _S29;\n }\n else\n {\n legDir_0 = _S28;\n }\n var _S33 : vec2<f32> = vec2<f32>(legDir_0, e_0.baseY_0);\n v_0.legSide_0 = _S32;\n origin_0 = _S33;\n legDir_0 = _S32;\n }\n else\n {\n v_0.kind_0 = 0.0f;\n var a_0 : f32 = t_3 * 3.14159274101257324f;\n var halfStep_0 : f32 = 3.14159274101257324f / (2.0f * f32(u_0.curveSegments_0));\n var _S34 : vec2<f32> = ellipseHullPoint_0(cos(a_0), sin(a_0), cos(halfStep_0), sin(halfStep_0), v_0.radii_0.x, v_0.radii_0.y, pad_0);\n v_0.local_0 = _S34;\n v_0.local_0[i32(1)] = - _S34.y;\n origin_0 = vec2<f32>((e_0.xPx_0 + e_0.x2Px_0) * 0.5f, e_0.baseY_0);\n legDir_0 = 1.0f;\n }\n }\n }\n v_0.screen_0 = origin_0 + vec2<f32>(legDir_0 * v_0.local_0.x, v_0.local_0.y * e_0.ySign_0);\n return v_0;\n}\n\nfn regionSpanPx_0( region_0 : u32) -> vec2<f32>\n{\n var s_0 : vec4<f32> = u_0.regionSpan_0[region_0 / u32(2)];\n var _S35 : vec2<f32>;\n if((region_0 % u32(2)) == u32(0))\n {\n _S35 = s_0.xy;\n }\n else\n {\n _S35 = s_0.zw;\n }\n return _S35;\n}\n\nfn linkFootDir_0( feet_1 : u32, shift_0 : u32) -> f32\n{\n var d_1 : u32 = (((feet_1 >> (shift_0))) & (u32(3)));\n var _S36 : f32;\n if(d_1 == u32(1))\n {\n _S36 = 1.0f;\n }\n else\n {\n if(d_1 == u32(2))\n {\n _S36 = -1.0f;\n }\n else\n {\n _S36 = 0.0f;\n }\n }\n return _S36;\n}\n\nfn linkFootLenPx_0( x_3 : f32, dir_0 : f32, leftPx_0 : f32, rightPx_0 : f32, footPx_1 : f32) -> f32\n{\n var _S37 : f32;\n if(dir_0 > 0.0f)\n {\n _S37 = rightPx_0 - x_3;\n }\n else\n {\n _S37 = x_3 - leftPx_0;\n }\n return max(0.0f, min(footPx_1, _S37));\n}\n\nfn footCorner_0( inst_1 : LinkInstance_0, e_1 : LinkEnv_0, f_0 : u32, c_2 : u32, present_0 : ptr<function, bool>) -> LinkVertex_0\n{\n var _S38 : bool = f_0 == u32(0);\n var x_4 : f32;\n if(_S38)\n {\n x_4 = e_1.xPx_0;\n }\n else\n {\n x_4 = e_1.x2Px_0;\n }\n var _S39 : u32 = min(inst_1.x2Region_0, u32(255));\n var entry_0 : vec4<f32>;\n if(_S38)\n {\n entry_0 = u_0.ownEntry_0;\n }\n else\n {\n entry_0 = u_0.regionTable_0[_S39];\n }\n var span_0 : vec2<f32>;\n if(_S38)\n {\n span_0 = u_0.ownSpan_0.xy;\n }\n else\n {\n span_0 = regionSpanPx_0(_S39);\n }\n var dir_1 : f32 = linkFootDir_0(inst_1.feet_0, f_0 * u32(2)) * f32((i32(sign((entry_0.w)))));\n var len_0 : f32 = linkFootLenPx_0(x_4, dir_1, span_0.x, span_0.y, u_0.footPx_0);\n var _S40 : bool;\n if(dir_1 != 0.0f)\n {\n _S40 = len_0 > 0.0f;\n }\n else\n {\n _S40 = false;\n }\n if(_S40)\n {\n if(_S38)\n {\n _S40 = true;\n }\n else\n {\n _S40 = e_1.placed_0;\n }\n }\n else\n {\n _S40 = false;\n }\n (*present_0) = _S40;\n var along_0 : f32;\n if(c_2 >= u32(2))\n {\n along_0 = len_0;\n }\n else\n {\n along_0 = 0.0f;\n }\n var across_0 : f32;\n if((c_2 % u32(2)) == u32(0))\n {\n across_0 = - e_1.hw_0;\n }\n else\n {\n across_0 = e_1.hw_0;\n }\n var v_1 : LinkVertex_0;\n v_1.kind_0 = 4.0f;\n v_1.radii_0 = vec2<f32>(len_0, 0.0f);\n v_1.legSide_0 = 1.0f;\n v_1.local_0 = vec2<f32>(along_0, across_0);\n v_1.screen_0 = vec2<f32>(x_4 + dir_1 * along_0, e_1.baseY_0 - e_1.ySign_0 * e_1.strokeHalf_0 + across_0);\n return v_1;\n}\n\nfn footCorner_1( inst_2 : LinkInstance_0, e_2 : LinkEnv_0, f_1 : u32, c_3 : u32, present_1 : ptr<function, bool>) -> LinkVertex_0\n{\n var _S41 : bool = f_1 == u32(0);\n var x_5 : f32;\n if(_S41)\n {\n x_5 = e_2.xPx_0;\n }\n else\n {\n x_5 = e_2.x2Px_0;\n }\n var _S42 : u32 = min(inst_2.x2Region_0, u32(255));\n var entry_1 : vec4<f32>;\n if(_S41)\n {\n entry_1 = u_0.ownEntry_0;\n }\n else\n {\n entry_1 = u_0.regionTable_0[_S42];\n }\n var span_1 : vec2<f32>;\n if(_S41)\n {\n span_1 = u_0.ownSpan_0.xy;\n }\n else\n {\n span_1 = regionSpanPx_0(_S42);\n }\n var dir_2 : f32 = linkFootDir_0(inst_2.feet_0, f_1 * u32(2)) * f32((i32(sign((entry_1.w)))));\n var len_1 : f32 = linkFootLenPx_0(x_5, dir_2, span_1.x, span_1.y, u_0.footPx_0);\n var _S43 : bool;\n if(dir_2 != 0.0f)\n {\n _S43 = len_1 > 0.0f;\n }\n else\n {\n _S43 = false;\n }\n if(_S43)\n {\n if(_S41)\n {\n _S43 = true;\n }\n else\n {\n _S43 = e_2.placed_0;\n }\n }\n else\n {\n _S43 = false;\n }\n (*present_1) = _S43;\n var along_1 : f32;\n if(c_3 >= u32(2))\n {\n along_1 = len_1;\n }\n else\n {\n along_1 = 0.0f;\n }\n var across_1 : f32;\n if((c_3 % u32(2)) == u32(0))\n {\n across_1 = - e_2.hw_0;\n }\n else\n {\n across_1 = e_2.hw_0;\n }\n var v_2 : LinkVertex_0;\n v_2.kind_0 = 4.0f;\n v_2.radii_0 = vec2<f32>(len_1, 0.0f);\n v_2.legSide_0 = 1.0f;\n v_2.local_0 = vec2<f32>(along_1, across_1);\n v_2.screen_0 = vec2<f32>(x_5 + dir_2 * along_1, e_2.baseY_0 - e_2.ySign_0 * e_2.strokeHalf_0 + across_1);\n return v_2;\n}\n\nfn footBlockStart_0( inst_3 : LinkInstance_0, e_3 : LinkEnv_0, f_2 : u32) -> LinkVertex_0\n{\n var tail_0 : LinkVertex_0 = curveVertex_0(inst_3, e_3, u_0.curveSegments_0, 1.0f);\n if(f_2 == u32(0))\n {\n return tail_0;\n }\n var first_0 : bool;\n var last_0 : LinkVertex_0 = footCorner_0(inst_3, e_3, u32(0), u32(3), &(first_0));\n var _S44 : LinkVertex_0;\n if(first_0)\n {\n _S44 = last_0;\n }\n else\n {\n _S44 = tail_0;\n }\n return _S44;\n}\n\nfn footVertex_0( inst_4 : LinkInstance_0, e_4 : LinkEnv_0, f_3 : u32, k_1 : u32) -> LinkVertex_0\n{\n var start_0 : LinkVertex_0 = footBlockStart_0(inst_4, e_4, f_3);\n if(k_1 == u32(0))\n {\n return start_0;\n }\n var present_2 : bool;\n var _S45 : u32;\n if(k_1 <= u32(2))\n {\n _S45 = u32(0);\n }\n else\n {\n _S45 = k_1 - u32(2);\n }\n var v_3 : LinkVertex_0 = footCorner_1(inst_4, e_4, f_3, _S45, &(present_2));\n var _S46 : LinkVertex_0;\n if(present_2)\n {\n _S46 = v_3;\n }\n else\n {\n _S46 = start_0;\n }\n return _S46;\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_2 : vec4<f32>,\n @location(1) local_1 : vec2<f32>,\n @interpolate(flat) @location(2) radii_1 : vec2<f32>,\n @interpolate(flat) @location(3) kind_1 : f32,\n @interpolate(flat) @location(4) halfWidthPx_3 : f32,\n @location(5) legSide_1 : f32,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_6 : u32,\n @location(1) x2_1 : u32,\n @location(2) x2Region_1 : u32,\n @location(3) y_2 : f32,\n @location(4) size_1 : f32,\n @location(5) color_3 : u32,\n @location(6) row_2 : u32,\n @location(7) feet_2 : u32,\n};\n\nfn markScaleColor_0( _S47 : texture_2d<f32>, _S48 : sampler, _S49 : u32, _S50 : i32, _S51 : f32, _S52 : f32, _S53 : f32, _S54 : i32, _S55 : vec4<f32>, _S56 : vec4<f32>) -> vec4<f32>\n{\n if(_S50 == i32(0))\n {\n return unpackRGBA_0(_S49);\n }\n if(_S49 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_6 : i32;\n if(((_S49 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S49 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S49 & (u32(2147483648)))) != u32(0);\n if(_S50 == i32(3))\n {\n if(negative_0)\n {\n scaleType_6 = i32(0);\n }\n else\n {\n scaleType_6 = _S54;\n }\n return u_0.colorBands_0[scaleType_6];\n }\n var _S57 : f32;\n if(negative_0)\n {\n _S57 = 0.0f;\n }\n else\n {\n _S57 = 1.0f;\n }\n return rampColor_0(_S47, _S48, rampMidT_0(_S57, _S53));\n }\n var value_5 : f32 = (bitcast<f32>((_S49)));\n if(_S50 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_5, _S54, _S55, _S56)];\n }\n if(_S50 == i32(2))\n {\n scaleType_6 = i32(1);\n }\n else\n {\n scaleType_6 = i32(0);\n }\n return rampColor_0(_S47, _S48, rampMidT_0(normalizeScore_0(value_5, _S51, _S52, scaleType_6, 1.0f), _S53));\n}\n\n@vertex\nfn vs_main( _S58 : vertexInput_0, @builtin(vertex_index) vid_0 : u32) -> VsOut_0\n{\n var _S59 : LinkInstance_0 = LinkInstance_0( _S58.x_6, _S58.x2_1, _S58.x2Region_1, _S58.y_2, _S58.size_1, _S58.color_3, _S58.row_2, _S58.feet_2 );\n var _S60 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S58.row_2, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S58.color_3, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var e_5 : LinkEnv_0;\n var _S61 : f32 = 0.5f * linkStrokeWidthPx_0(_S58.size_1, u_0.sizeMode_0, u_0.sizeConstantPx_0, u_0.sizeDomainMin_0, u_0.sizeDomainMax_0, u_0.sizeScaleType_0, u_0.sizeRangeMin_0, u_0.sizeRangeMax_0, u_0.devicePixelRatio_0);\n e_5.strokeHalf_0 = _S61;\n e_5.hw_0 = _S61 + aaHalfPx_0(u_0.devicePixelRatio_0);\n e_5.baseY_0 = linkBaseYPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S60.slot_0, u_0.reverse_0);\n var _S62 : f32;\n if((u_0.reverse_0) != i32(0))\n {\n _S62 = -1.0f;\n }\n else\n {\n _S62 = 1.0f;\n }\n e_5.ySign_0 = _S62;\n e_5.reach_0 = max(u_0.rowHeight_0 - u_0.insetPx_0, 0.0f);\n e_5.xPx_0 = entryPx_0(_S58.x_6, u_0.ownEntry_0, u_0.zero_0);\n var _S63 : bool = (_S58.x2Region_1) < (u_0.regionCount_0);\n e_5.placed_0 = _S63;\n if(_S63)\n {\n _S62 = entryPx_0(_S58.x2_1, u_0.regionTable_0[_S58.x2Region_1], u_0.zero_0);\n }\n else\n {\n _S62 = e_5.xPx_0;\n }\n e_5.x2Px_0 = _S62;\n var curveVerts_0 : u32 = (u_0.curveSegments_0 + u32(1)) * u32(2);\n var v_4 : LinkVertex_0;\n if(vid_0 < curveVerts_0)\n {\n var _S64 : LinkEnv_0 = e_5;\n var _S65 : u32 = vid_0 / u32(2);\n if((vid_0 % u32(2)) == u32(0))\n {\n _S62 = -1.0f;\n }\n else\n {\n _S62 = 1.0f;\n }\n v_4 = curveVertex_0(_S59, _S64, _S65, _S62);\n }\n else\n {\n var j_0 : u32 = vid_0 - curveVerts_0;\n v_4 = footVertex_0(_S59, e_5, j_0 / u32(6), j_0 % u32(6));\n }\n var o_0 : VsOut_0;\n var _S66 : bool;\n if((_S58.x2Region_1) == u32(4294967294))\n {\n _S66 = true;\n }\n else\n {\n _S66 = _S60.hidden_0;\n }\n var _S67 : vec4<f32>;\n if(_S66)\n {\n _S67 = vec4<f32>(-2.0f, -2.0f, 0.0f, 1.0f);\n }\n else\n {\n _S67 = vec4<f32>(v_4.screen_0.x / u_0.canvasWidth_0 * 2.0f - 1.0f, yPxToClipY_0(v_4.screen_0.y, u_0.canvasHeight_0), 0.0f, 1.0f);\n }\n o_0.position_0 = _S67;\n o_0.color_2 = _S60.color_0;\n o_0.local_1 = v_4.local_0;\n o_0.radii_1 = v_4.radii_0;\n o_0.kind_1 = v_4.kind_0;\n o_0.halfWidthPx_3 = e_5.strokeHalf_0;\n o_0.legSide_1 = v_4.legSide_0;\n return o_0;\n}\n\nfn distToWideCirclePx_0( x_7 : f32, y_3 : f32, r_1 : f32) -> f32\n{\n var rk_0 : f32 = 2.0f * x_7 + (x_7 * x_7 + y_3 * y_3) / r_1;\n return abs(rk_0 / (sqrt(max(1.0f + rk_0 / r_1, 0.0f)) + 1.0f));\n}\n\nfn distToWideCircle_0( legLocal_0 : vec2<f32>, r_2 : f32) -> f32\n{\n return distToWideCirclePx_0(legLocal_0.x, legLocal_0.y, r_2);\n}\n\nfn nearCircleDistancePx_0( qx_0 : f32, qy_0 : f32, ax_1 : f32, ay_1 : f32) -> f32\n{\n var kx_0 : f32 = qx_0 / ax_1;\n var ky_0 : f32 = qy_0 / ay_1;\n var k_2 : f32 = sqrt(kx_0 * kx_0 + ky_0 * ky_0);\n var gx_1 : f32 = qx_0 / (ax_1 * ax_1);\n var gy_1 : f32 = qy_0 / (ay_1 * ay_1);\n return abs(k_2 * (k_2 - 1.0f) / max(sqrt(gx_1 * gx_1 + gy_1 * gy_1), 9.99999968265522539e-21f));\n}\n\nfn sdEllipse_0( p_1 : vec2<f32>, radii_2 : vec2<f32>) -> f32\n{\n var q_0 : vec2<f32> = abs(p_1);\n var ab_0 : vec2<f32>;\n var q_1 : vec2<f32>;\n if((q_0.x) > (q_0.y))\n {\n var _S68 : vec2<f32> = q_0.yx;\n ab_0 = radii_2.yx;\n q_1 = _S68;\n }\n else\n {\n ab_0 = radii_2;\n q_1 = q_0;\n }\n if((dot(ab_0, ab_0)) <= 0.0f)\n {\n return length(q_1);\n }\n var _S69 : f32 = ab_0.y;\n var _S70 : f32 = ab_0.x;\n var l_0 : f32 = _S69 * _S69 - _S70 * _S70;\n if((abs(l_0)) < (0.05000000074505806f * _S69 * _S69))\n {\n return nearCircleDistancePx_0(q_1.x, q_1.y, _S70, _S69);\n }\n var m_1 : f32 = _S70 * q_1.x / l_0;\n var m2_0 : f32 = m_1 * m_1;\n var n_1 : f32 = _S69 * q_1.y / l_0;\n var n2_0 : f32 = n_1 * n_1;\n var c_4 : f32 = (m2_0 + n2_0 - 1.0f) / 3.0f;\n var c3_0 : f32 = c_4 * c_4 * c_4;\n var _S71 : f32 = m2_0 * n2_0;\n var d_2 : f32 = c3_0 + _S71;\n var g_0 : f32 = m_1 + m_1 * n2_0;\n var co_0 : f32;\n if(d_2 < 0.0f)\n {\n var h_4 : f32 = acos(clamp((c3_0 + _S71 * 2.0f) / c3_0, -1.0f, 1.0f)) / 3.0f;\n var s_1 : f32 = cos(h_4);\n var t_4 : f32 = sin(h_4) * sqrt(3.0f);\n var _S72 : f32 = - c_4;\n var rx_1 : f32 = sqrt(max(_S72 * (s_1 + t_4 + 2.0f) + m2_0, 0.0f));\n var ry_1 : f32 = sqrt(max(_S72 * (s_1 - t_4 + 2.0f) + m2_0, 0.0f));\n co_0 = (ry_1 + f32((i32(sign((l_0))))) * rx_1 + abs(g_0) / max(rx_1 * ry_1, 9.99999968265522539e-21f) - m_1) / 2.0f;\n }\n else\n {\n var w_2 : f32 = c3_0 + _S71 * 2.0f + 2.0f * m_1 * n_1 * sqrt(d_2);\n var aw_0 : f32 = abs(w_2);\n var _S73 : f32 = f32((i32(sign((w_2)))));\n var s_2 : f32 = _S73 * pow(aw_0, 0.3333333432674408f);\n if(aw_0 > 0.0f)\n {\n co_0 = _S73 * pow(c3_0 * (c3_0 / aw_0), 0.3333333432674408f);\n }\n else\n {\n co_0 = 0.0f;\n }\n var rx_2 : f32 = - s_2 - co_0 - c_4 * 4.0f + 2.0f * m2_0;\n var ry_2 : f32 = (s_2 - co_0) * sqrt(3.0f);\n var rm_0 : f32 = sqrt(rx_2 * rx_2 + ry_2 * ry_2);\n co_0 = (ry_2 / sqrt(max(rm_0 - rx_2, 9.99999968265522539e-21f)) + 2.0f * g_0 / max(rm_0, 9.99999968265522539e-21f) - m_1) / 2.0f;\n }\n var co_1 : f32 = clamp(co_0, -1.0f, 1.0f);\n return length(ab_0 * vec2<f32>(co_1, sqrt(max(1.0f - co_1 * co_1, 0.0f))) - q_1);\n}\n\nfn linkDistance_0( i_2 : VsOut_0) -> f32\n{\n if((i_2.kind_1) >= 2.5f)\n {\n var _S74 : f32 = i_2.local_1.x;\n return length(vec2<f32>(_S74 - clamp(_S74, 0.0f, i_2.radii_1.x), i_2.local_1.y));\n }\n if((i_2.kind_1) >= 1.5f)\n {\n var _S75 : f32 = i_2.local_1.y;\n return length(vec2<f32>(i_2.local_1.x, _S75 - clamp(_S75, - i_2.radii_1.y, 0.0f)));\n }\n if((i_2.kind_1) >= 0.5f)\n {\n return distToWideCircle_0(i_2.local_1, i_2.radii_1.x);\n }\n return sdEllipse_0(i_2.local_1, i_2.radii_1);\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nfn edgeCoverage_0( signedInkCssPx_0 : f32, dpr_3 : f32) -> f32\n{\n return aaRamp_0(signedInkCssPx_0, aaPx_0(dpr_3));\n}\n\nfn linkDashAlong_0( i_3 : VsOut_0) -> f32\n{\n if((i_3.kind_1) >= 3.5f)\n {\n return -1.0f;\n }\n if((i_3.kind_1) >= 2.5f)\n {\n return i_3.local_1.x;\n }\n if((i_3.kind_1) >= 1.5f)\n {\n return - i_3.local_1.y;\n }\n return -1.0f;\n}\n\nfn dashCoverageAt_0( coord_0 : f32, dashPx_1 : f32, gapPx_1 : f32, aaPx_1 : f32) -> f32\n{\n var period_0 : f32 = dashPx_1 + gapPx_1;\n var shifted_0 : f32 = coord_0 + gapPx_1 * 0.5f;\n return aaRamp_0(dashPx_1 * 0.5f - abs(shifted_0 - period_0 * floor(shifted_0 / period_0) - period_0 * 0.5f), aaPx_1);\n}\n\nfn dashCoverage_0( coord_1 : f32, dashPx_2 : f32, gapPx_2 : f32, dpr_4 : f32) -> f32\n{\n return dashCoverageAt_0(coord_1, dashPx_2, gapPx_2, aaPx_0(dpr_4));\n}\n\nfn linkDash_0( i_4 : VsOut_0) -> f32\n{\n var along_2 : f32 = linkDashAlong_0(i_4);\n var _S76 : bool;\n if((u_0.dashPx_0) > 0.0f)\n {\n _S76 = along_2 >= 0.0f;\n }\n else\n {\n _S76 = false;\n }\n var _S77 : f32;\n if(_S76)\n {\n _S77 = dashCoverage_0(along_2, u_0.dashPx_0, u_0.gapPx_0, u_0.devicePixelRatio_0);\n }\n else\n {\n _S77 = 1.0f;\n }\n return _S77;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_4 : vec4<f32>,\n @location(1) local_2 : vec2<f32>,\n @interpolate(flat) @location(2) radii_3 : vec2<f32>,\n @interpolate(flat) @location(3) kind_2 : f32,\n @interpolate(flat) @location(4) halfWidthPx_4 : f32,\n @location(5) legSide_2 : f32,\n};\n\n@fragment\nfn fs_main( _S78 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S79 : VsOut_0 = VsOut_0( position_1, _S78.color_4, _S78.local_2, _S78.radii_3, _S78.kind_2, _S78.halfWidthPx_4, _S78.legSide_2 );\n if((abs(_S78.legSide_2)) < 0.99900001287460327f)\n {\n discard;\n }\n var _S80 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S78.color_4.xyz, _S78.color_4.w * (edgeCoverage_0(_S78.halfWidthPx_4 - linkDistance_0(_S79), u_0.devicePixelRatio_0) * linkDash_0(_S79))) );\n return _S80;\n}\n\n"
@@ -0,0 +1,20 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from markColor.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+
4
+ export const RAMP_NONE = 0
5
+
6
+ export const RAMP_LINEAR = 1
7
+
8
+ export const RAMP_LOG = 2
9
+
10
+ export const RAMP_THRESHOLD = 3
11
+
12
+ export const MAX_COLOR_CUTS = 8
13
+
14
+ export const MAX_COLOR_BANDS = 9
15
+
16
+ export const RAMP_NO_VALUE_BITS = 2143289345
17
+
18
+ export const RAMP_NO_VALUE_COLOR = 4289703855
19
+
20
+ export const RAMP_NOT_A_NUMBER_COLOR = 4286611584
@@ -0,0 +1,128 @@
1
+ // How a mark shape's colour channel resolves: a packed ABGR the worker already
2
+ // decided, or a raw value the frame's colour scale turns into one here.
3
+ //
4
+ // The two arms are the two places a scale can resolve, and the choice is the
5
+ // channel's cardinality rather than the shape's (ADR-094). A categorical or
6
+ // constant colour is data and travels packed with the instance; a quantitative
7
+ // one is a value through a scale that moves with the loaded regions or with an
8
+ // edit, so it rides uniforms — a domain pair and a 256-entry LUT for a ramp,
9
+ // up to MAX_COLOR_CUTS cut points and a colour per interval for a threshold —
10
+ // and a pan that widens the domain or an edit that moves a cut uploads no
11
+ // instance bytes, the property `valueScale` already gives y.
12
+ //
13
+ // The value arrives in the instance's colour slot, reinterpreted: one 4-byte
14
+ // lane carries either the packed colour or the value's float32 bits, and
15
+ // `rampMode` says which. The packer's side of that is `colorBits`
16
+ // (marks/markRamp.ts), which views the encoder's `Float32Array` as the
17
+ // `Uint32Array` the attribute is declared as, so a quantitative colour adds no
18
+ // lane to an instance and costs no bytes; a colour over the plotted value
19
+ // itself is the `y` lane's bits, so it costs no lane in the payload either.
20
+ //
21
+ // `normalizeScore` is `scoreScale`'s, so a ramp's domain is read exactly as the
22
+ // axis reads y's and as the Canvas2D twin reads both. A diverging ramp's middle
23
+ // stop is `rampMidNorm`, read through `colorRampLut`'s `rampMidT` over a
24
+ // straight table, so a domain that moves under a pinned middle moves uniforms
25
+ // and uploads no table. A threshold's interval is `thresholdBand`, the count of
26
+ // ascending cuts a value is at or past, which is `thresholdIndex`'s rule in
27
+ // `@jbrowse/core/util/thresholdScale` and the painter's.
28
+ //! export-consts: RAMP_NONE, RAMP_LINEAR, RAMP_LOG, RAMP_THRESHOLD, MAX_COLOR_CUTS, MAX_COLOR_BANDS, RAMP_NO_VALUE_BITS, RAMP_NO_VALUE_COLOR, RAMP_NOT_A_NUMBER_COLOR
29
+ module markColor;
30
+
31
+ import colorPack;
32
+ import colorRampLut;
33
+ import scoreScale;
34
+
35
+ // What `rampMode` is compared against. `RAMP_NONE` is the packed arm.
36
+ public static const int RAMP_NONE = 0;
37
+ public static const int RAMP_LINEAR = 1;
38
+ public static const int RAMP_LOG = 2;
39
+ public static const int RAMP_THRESHOLD = 3;
40
+
41
+ // The most cuts a threshold parts a plot at, and the intervals between them:
42
+ // the uniform block holds this many.
43
+ public static const int MAX_COLOR_CUTS = 8;
44
+ public static const int MAX_COLOR_BANDS = 9;
45
+
46
+ // What the lane carries for a feature with no value in the field: a NaN whose
47
+ // payload no arithmetic produces, so it stays apart from text that is no
48
+ // number, which the encoder writes as an ordinary NaN. The lane is tested as
49
+ // bits, since a NaN need not survive a vertex attribute through every driver's
50
+ // fast math.
51
+ public static const uint RAMP_NO_VALUE_BITS = 0x7FC00001u;
52
+ // The no-value grey and the misconfiguration grey, packed, as every other
53
+ // scale paints the two.
54
+ public static const uint RAMP_NO_VALUE_COLOR = 0xFFAFAFAFu;
55
+ public static const uint RAMP_NOT_A_NUMBER_COLOR = 0xFF808080u;
56
+
57
+ // The `cuts` slot `i` names, four to a vector.
58
+ public float colorCutAt(int i, float4 cutsLo, float4 cutsHi) {
59
+ return i < 4 ? cutsLo[i] : cutsHi[i - 4];
60
+ }
61
+
62
+ // The interval a value is in: how many of the ascending cuts it is at or past.
63
+ public int thresholdBand(float value, int cutCount, float4 cutsLo, float4 cutsHi) {
64
+ int band = 0;
65
+ for (int i = 0; i < cutCount; i++) {
66
+ if (value >= colorCutAt(i, cutsLo, cutsHi)) {
67
+ band = i + 1;
68
+ }
69
+ }
70
+ return band;
71
+ }
72
+
73
+ // The interval a fragment at `yPx` is in, given each cut's y in the band:
74
+ // screen y grows downward, so a value at or past a cut is at or above that
75
+ // cut's y. A line reads its colour this way, so a rise across a cut changes
76
+ // colour at the cut.
77
+ public int thresholdBandAtYPx(float yPx, int cutCount, float4 cutYsLo, float4 cutYsHi) {
78
+ int band = 0;
79
+ for (int i = 0; i < cutCount; i++) {
80
+ if (yPx <= colorCutAt(i, cutYsLo, cutYsHi)) {
81
+ band = i + 1;
82
+ }
83
+ }
84
+ return band;
85
+ }
86
+
87
+ public float4 markScaleColor(
88
+ Sampler2D<float4> ramp,
89
+ uint packed,
90
+ int rampMode,
91
+ float rampMin,
92
+ float rampMax,
93
+ float rampMidNorm,
94
+ int cutCount,
95
+ float4 cutsLo,
96
+ float4 cutsHi,
97
+ float4 bands[MAX_COLOR_BANDS],
98
+ ) {
99
+ if (rampMode == RAMP_NONE) {
100
+ return unpackRGBA(packed);
101
+ }
102
+ if (packed == RAMP_NO_VALUE_BITS) {
103
+ return unpackRGBA(RAMP_NO_VALUE_COLOR);
104
+ }
105
+ if ((packed & 0x7F800000u) == 0x7F800000u) {
106
+ if ((packed & 0x007FFFFFu) != 0u) {
107
+ return unpackRGBA(RAMP_NOT_A_NUMBER_COLOR);
108
+ }
109
+ // an infinity takes the end on its side, as a threshold places it
110
+ bool negative = (packed & 0x80000000u) != 0u;
111
+ if (rampMode == RAMP_THRESHOLD) {
112
+ return bands[negative ? 0 : cutCount];
113
+ }
114
+ return rampColor(ramp, rampMidT(negative ? 0.0 : 1.0, rampMidNorm));
115
+ }
116
+ float value = asfloat(packed);
117
+ if (rampMode == RAMP_THRESHOLD) {
118
+ return bands[thresholdBand(value, cutCount, cutsLo, cutsHi)];
119
+ }
120
+ int scaleType = rampMode == RAMP_LOG ? SCALE_TYPE_LOG : 0;
121
+ return rampColor(
122
+ ramp,
123
+ rampMidT(
124
+ normalizeScore(value, rampMin, rampMax, scaleType, 1.0),
125
+ rampMidNorm,
126
+ ),
127
+ );
128
+ }
@@ -4,6 +4,26 @@
4
4
  // Scalar twins of pointGlyph.slang, transliterated from slangc's WGSL so
5
5
  // the Canvas2D and SVG paths run the shader's own math. See adr-051.
6
6
 
7
+ function _max(a: number, b: number) {
8
+ return b > a || Number.isNaN(a) ? b : a
9
+ }
10
+
7
11
  export function crispSquareTopLeftPx(centerPx: number, diameterPx: number): number {
8
12
  return Math.floor(((centerPx - (diameterPx * 0.5)) + 0.5))
9
13
  }
14
+
15
+ function aaPx(dpr: number): number {
16
+ return (1.0 / _max(dpr, 1.0))
17
+ }
18
+
19
+ function aaHalfPx(dpr: number): number {
20
+ return (0.5 * aaPx(dpr))
21
+ }
22
+
23
+ export function glyphExpand(unitPx: number, reaches: number, dpr: number): number {
24
+ return (1.0 + ((reaches * aaHalfPx(dpr)) / _max(unitPx, 0.00100000004749745)))
25
+ }
26
+
27
+ export function discExpand(radiusPx: number, dpr: number): number {
28
+ return glyphExpand(radiusPx, 1.0, dpr)
29
+ }
@@ -8,8 +8,7 @@
8
8
  // `export-consts` emits the constant and `js-export` emits the snap, both
9
9
  // consumed by `pointMarker.ts` (adr-051).
10
10
  //! export-consts: SMALL_POINT_MAX_DIAMETER
11
- //! js-export: crispSquareTopLeftPx
12
- //! js-skip: discExpand — expands a quad so the fragment AA ramp is not clipped; Canvas2D draws ctx.arc and has no quad to expand
11
+ //! js-export: crispSquareTopLeftPx, discExpand, glyphExpand
13
12
  module pointGlyph;
14
13
 
15
14
  import antialias;
@@ -28,12 +27,29 @@ import hpmath;
28
27
  // crisp filled square instead.
29
28
  public static const float SMALL_POINT_MAX_DIAMETER = 3.0;
30
29
 
31
- // Quad scale factor that grows the disc's bounding quad by the ramp's reach so
32
- // its faded edge isn't clipped. localPos is scaled by the same factor so the
33
- // disc boundary stays at distance 1 (see discAlpha). `max(radiusPx, 0.5)` keeps
34
- // sub-pixel points from exploding the expansion.
30
+ // Below this the glyph is smaller than the pad it is asking for; the floor is
31
+ // only there so a radius of 0 cannot divide.
32
+ static const float MIN_GLYPH_RADIUS_PX = 1e-3;
33
+
34
+ // Quad scale factor that grows a glyph's bounding quad past its own half extent
35
+ // `unitPx` so the faded edge isn't clipped. localPos is scaled by the same
36
+ // factor, so the glyph boundary stays at distance 1 (see discAlpha) and the
37
+ // quad's half extent comes out at `unitPx + reaches * aaHalfPx(dpr)` px.
38
+ //
39
+ // `reaches` is how far past the boundary the SDF still inks where the quad
40
+ // binds, in ramp reaches. One wherever the boundary the quad touches is a
41
+ // single facet, more wherever two facets miter — see pointMark.slang's table.
42
+ //
43
+ // Clamping the DIVISOR instead under-pads every extent below the clamp, because
44
+ // the caller scales by the unclamped one. `pointGlyphPad.test.ts` holds each
45
+ // glyph's pad to its reach at the sub-pixel radii a diamond or a triangle
46
+ // reaches.
47
+ public float glyphExpand(float unitPx, float reaches, float dpr) {
48
+ return 1.0 + reaches * aaHalfPx(dpr) / max(unitPx, MIN_GLYPH_RADIUS_PX);
49
+ }
50
+
35
51
  public float discExpand(float radiusPx, float dpr) {
36
- return (radiusPx + aaHalfPx(dpr)) / max(radiusPx, 0.5);
52
+ return glyphExpand(radiusPx, 1.0, dpr);
37
53
  }
38
54
 
39
55
  // Pixel-grid-snapped top-left of the crisp small-point square, on one axis. The
@@ -0,0 +1,242 @@
1
+ // `glyphExpand` sizes the quad the vertex stage emits; `glyphEdgeAlpha` shades a
2
+ // ramp inside it. The two are sized from one number and nothing in the build
3
+ // holds them to each other, so this asserts the invariant directly: every point
4
+ // the fragment stage would give non-zero alpha lies inside the quad.
5
+ //
6
+ // `glyphEdgeAlpha.test.ts` is the fragment half — it pins the ramp at one output
7
+ // pixel for each SDF. This is the vertex half, and the two differ in what they
8
+ // import: that file models the pad, this one runs `glyphExpand` itself, because
9
+ // a pad test spelling its own copy of the expansion is a copy that agrees with
10
+ // itself. Same reason the scalars in dotplotCapsulePad.test.ts are imported.
11
+ //
12
+ // SYNC: keep the quad model in step with pointMark.slang's vs_main and
13
+ // wiggle.slang's scatter branch, and the pieces with the SDFs in fs_main.
14
+ import { aaHalfPx, aaRamp } from './antialias.js.generated.ts'
15
+ import { discExpand, glyphExpand } from './pointGlyph.js.generated.ts'
16
+ import {
17
+ DIAMOND_GLYPH_SCALE,
18
+ DIAMOND_MITER_REACHES,
19
+ TRIANGLE_MITER_REACHES,
20
+ } from './pointMark.consts.generated.ts'
21
+
22
+ const INV_SQRT5 = 1 / Math.sqrt(5)
23
+
24
+ type Piece = (x: number, y: number) => number
25
+
26
+ // Each glyph's SDF as the smooth pieces it is the minimum of, rather than the
27
+ // closed form the shader writes. A central difference across a crease reports
28
+ // neither facet's gradient — it reports 1 where the diamond's axis facets carry
29
+ // sqrt(2) — and the diamond's creases are exactly the four directions its quad
30
+ // binds in, so the composite form cannot answer the question this file asks.
31
+ const PIECES: Record<Shape, Piece[]> = {
32
+ disc: [(x, y) => 1 - Math.hypot(x, y)],
33
+ diamond: [
34
+ (x, y) => 1 - (x + y),
35
+ (x, y) => 1 - (x - y),
36
+ (x, y) => 1 - (y - x),
37
+ (x, y) => 1 + x + y,
38
+ ],
39
+ triangle: [
40
+ (_x, y) => 1 - y,
41
+ (x, y) => (2 * x + y + 1) * INV_SQRT5,
42
+ (x, y) => (-2 * x + y + 1) * INV_SQRT5,
43
+ ],
44
+ }
45
+
46
+ type Shape = 'disc' | 'diamond' | 'triangle'
47
+
48
+ function activePiece(shape: Shape, x: number, y: number) {
49
+ let best = PIECES[shape][0]!
50
+ for (const piece of PIECES[shape]) {
51
+ if (piece(x, y) < best(x, y)) {
52
+ best = piece
53
+ }
54
+ }
55
+ return best
56
+ }
57
+
58
+ function coverage(shape: Shape, x: number, y: number) {
59
+ return activePiece(shape, x, y)(x, y)
60
+ }
61
+
62
+ // `glyphEdgeAlpha` at a point `(xPx, yPx)` from the glyph centre. `sdfUnitPx` is
63
+ // how many CSS px one unit of the quad-local coord spans, which is what carries
64
+ // the measured gradient from SDF units to the screen.
65
+ function alphaAt(
66
+ shape: Shape,
67
+ xPx: number,
68
+ yPx: number,
69
+ sdfUnitPx: number,
70
+ dpr: number,
71
+ ) {
72
+ const x = xPx / sdfUnitPx
73
+ const y = yPx / sdfUnitPx
74
+ const piece = activePiece(shape, x, y)
75
+ const h = 1e-7
76
+ const gradient = Math.hypot(
77
+ (piece(x + h, y) - piece(x - h, y)) / (2 * h),
78
+ (piece(x, y + h) - piece(x, y - h)) / (2 * h),
79
+ )
80
+ return aaRamp(piece(x, y), gradient / (sdfUnitPx * dpr))
81
+ }
82
+
83
+ // Half-extent of the axis-aligned box holding every inked fragment, in CSS px —
84
+ // the smallest quad that would not clip the ramp. Radial, because the inked
85
+ // region is star-shaped about the centre for all three shapes; the angle count
86
+ // is a multiple of 4 so the axes and the triangle's apex are sampled exactly.
87
+ function inkedHalfExtentPx(shape: Shape, sdfUnitPx: number, dpr: number) {
88
+ let extent = 0
89
+ const angles = 512
90
+ for (let i = 0; i < angles; i++) {
91
+ const a = (2 * Math.PI * i) / angles
92
+ const cx = Math.cos(a)
93
+ const cy = Math.sin(a)
94
+ let lo = 0
95
+ let hi = sdfUnitPx * 4 + 4
96
+ for (let k = 0; k < 60; k++) {
97
+ const mid = (lo + hi) / 2
98
+ if (alphaAt(shape, cx * mid, cy * mid, sdfUnitPx, dpr) > 0) {
99
+ lo = mid
100
+ } else {
101
+ hi = mid
102
+ }
103
+ }
104
+ extent = Math.max(extent, Math.abs(cx * lo), Math.abs(cy * lo))
105
+ }
106
+ return extent
107
+ }
108
+
109
+ // pointMark.slang's `halfPx`, and with a scale and a reach of 1 also
110
+ // wiggle.slang's.
111
+ function quadHalfExtentPx(
112
+ radiusPx: number,
113
+ dpr: number,
114
+ glyphScale = 1,
115
+ reaches = 1,
116
+ ) {
117
+ const unitPx = sdfUnitPx(radiusPx, glyphScale)
118
+ return unitPx * glyphExpand(unitPx, reaches, dpr)
119
+ }
120
+
121
+ // One unit of `localPos` in CSS px: `halfPx / expand`, which is where the glyph
122
+ // boundary lands.
123
+ function sdfUnitPx(radiusPx: number, glyphScale = 1) {
124
+ return radiusPx * glyphScale
125
+ }
126
+
127
+ // Sub-pixel radii are reachable: `encoding.size` is an unfloored config number and
128
+ // pointMark.slang routes only GLYPH_DISC to the crisp-square fallback, so a
129
+ // 0.8 px diamond or triangle arrives here at radius 0.4.
130
+ const RADII_PX = [0.1, 0.4, 0.5, 1, 1.5, 4, 10]
131
+ const DPRS = [1, 2, 3]
132
+
133
+ describe('the pieces model the SDFs fs_main branches to', () => {
134
+ test.each([
135
+ [0.3, -0.2],
136
+ [-0.7, 0.1],
137
+ [0, 0.9],
138
+ [1.4, 0],
139
+ [-0.5, -0.5],
140
+ ])('at (%p, %p)', (x, y) => {
141
+ expect(coverage('disc', x, y)).toBeCloseTo(1 - Math.hypot(x, y), 12)
142
+ expect(coverage('diamond', x, y)).toBeCloseTo(
143
+ 1 - (Math.abs(x) + Math.abs(y)),
144
+ 12,
145
+ )
146
+ expect(coverage('triangle', x, y)).toBeCloseTo(
147
+ Math.min(
148
+ 1 - y,
149
+ (2 * x + y + 1) * INV_SQRT5,
150
+ (-2 * x + y + 1) * INV_SQRT5,
151
+ ),
152
+ 12,
153
+ )
154
+ })
155
+ })
156
+
157
+ describe('glyphExpand', () => {
158
+ // The regression. Clamping the divisor made this `radiusPx + aaHalfPx` only
159
+ // above the clamp, because the caller scales by the unclamped radius: at
160
+ // radius 0.4 and dpr 2 the pad came out 0.12 px against a 0.25 px reach.
161
+ test.each(DPRS)(
162
+ 'pads by exactly one ramp reach at every radius: dpr %p',
163
+ dpr => {
164
+ for (const radiusPx of RADII_PX) {
165
+ expect(quadHalfExtentPx(radiusPx, dpr) - radiusPx).toBeCloseTo(
166
+ aaHalfPx(dpr),
167
+ 12,
168
+ )
169
+ }
170
+ },
171
+ )
172
+
173
+ // wiggle.slang's scatter branch calls `discExpand`, which is the one-reach
174
+ // case of the same expansion rather than a second rule.
175
+ test.each(DPRS)('discExpand is the one-reach case: dpr %p', dpr => {
176
+ for (const radiusPx of RADII_PX) {
177
+ expect(discExpand(radiusPx, dpr)).toBe(glyphExpand(radiusPx, 1, dpr))
178
+ }
179
+ })
180
+
181
+ // The disc is what wiggle's scatter branch and pointMark's GLYPH_DISC draw,
182
+ // both at `halfPx = radiusPx * expand`. Its ramp is isotropic, so the quad is
183
+ // tight — equals, not merely holds.
184
+ test.each(DPRS)(
185
+ 'gives the disc a quad that is exactly its ink: dpr %p',
186
+ dpr => {
187
+ for (const radiusPx of RADII_PX) {
188
+ expect(inkedHalfExtentPx('disc', sdfUnitPx(radiusPx), dpr)).toBeCloseTo(
189
+ quadHalfExtentPx(radiusPx, dpr),
190
+ 6,
191
+ )
192
+ }
193
+ },
194
+ )
195
+ })
196
+
197
+ // Neither of the two carved glyphs binds its quad on a single facet, so neither
198
+ // pads by one reach. An L1 boundary's ramp runs perpendicular to a 45-degree
199
+ // facet, so at the diamond's four corners — on the axes, which is where its
200
+ // quad binds — two offset facets miter out sqrt(2) reaches. The triangle's apex
201
+ // is the same construction at a much sharper angle: sqrt(5).
202
+ describe.each([
203
+ ['diamond', DIAMOND_GLYPH_SCALE, DIAMOND_MITER_REACHES, Math.SQRT2],
204
+ ['triangle', 1, TRIANGLE_MITER_REACHES, Math.sqrt(5)],
205
+ ] as const)('the %s', (shape, glyphScale, reaches, miter) => {
206
+ test('pads by the miter its corners reach', () => {
207
+ expect(reaches).toBeCloseTo(miter, 6)
208
+ })
209
+
210
+ // Equals, not holds: the diamond's old quad padded 1.6 units where its miter
211
+ // reaches 1.4142, and any upper bound loose enough to pass held that too.
212
+ test.each(DPRS)('gets a quad that is exactly its ink: dpr %p', dpr => {
213
+ for (const radiusPx of RADII_PX) {
214
+ const unitPx = sdfUnitPx(radiusPx, glyphScale)
215
+ const inked = inkedHalfExtentPx(shape, unitPx, dpr)
216
+ expect(inked - unitPx).toBeCloseTo(miter * aaHalfPx(dpr), 6)
217
+ expect(quadHalfExtentPx(radiusPx, dpr, glyphScale, reaches)).toBeCloseTo(
218
+ inked,
219
+ 6,
220
+ )
221
+ }
222
+ })
223
+
224
+ // What a one-reach pad costs: the quad cuts the corner, and the fragment the
225
+ // rasterizer stops at is still well inside the ramp. 0.146 for the diamond,
226
+ // 0.276 for the triangle, at every radius and dpr — sub-pixel, and a hard
227
+ // edge on the one feature of the glyph a reader picks it out by.
228
+ test.each(DPRS)('a one-reach pad would cut that corner: dpr %p', dpr => {
229
+ for (const radiusPx of RADII_PX) {
230
+ const unitPx = sdfUnitPx(radiusPx, glyphScale)
231
+ const cut = quadHalfExtentPx(radiusPx, dpr, glyphScale) - unitPx
232
+ const alpha = alphaAt(
233
+ shape,
234
+ 0,
235
+ shape === 'diamond' ? unitPx + cut : -(unitPx + cut),
236
+ unitPx,
237
+ dpr,
238
+ )
239
+ expect(alpha).toBeCloseTo(shape === 'diamond' ? 0.146 : 0.276, 3)
240
+ }
241
+ })
242
+ })
@@ -0,0 +1,16 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+
4
+ export const DIAMOND_GLYPH_SCALE = 1.6
5
+
6
+ export const DIAMOND_MITER_REACHES = 1.4142136
7
+
8
+ export const TRIANGLE_MITER_REACHES = 2.236068
9
+
10
+ export const GLYPH_DISC = 0
11
+
12
+ export const GLYPH_TRIANGLE = 1
13
+
14
+ export const GLYPH_DIAMOND = 2
15
+
16
+ export const GLYPH_SQUARE = 3
@@ -0,0 +1,12 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+
4
+ import type { ShaderSource } from '@jbrowse/render-core/hal'
5
+
6
+ export * from './pointMark.iface.generated.ts'
7
+ export * from './pointMark.consts.generated.ts'
8
+
9
+ export const SOURCE: ShaderSource = {
10
+ wgsl: () => import('./pointMark.wgsl.generated.ts'),
11
+ glsl: () => import('./pointMark.glsl.generated.ts'),
12
+ }
@@ -0,0 +1,6 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+
4
+ export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float rowHeight_0;\n float rowOffsetPx_0;\n int reverse_0;\n float insetPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n int rule_0;\n float minWidthPx_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S5 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S5 - mid_0)) / (2.0 * _S5), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S6;\n if(i_0 < 4)\n {\n\n _S6 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S6 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S6;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S7;\n if(u_1 == 1.0)\n {\n\n _S7 = x_0;\n\n }\n else\n {\n\n _S7 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S7;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S8 = symlogTransform_0(score_0, symlogConstant_0);\n float _S9 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S9;\n\n t_1 = _S8;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S10 = log2(max(score_0, tMax_0));\n float _S11 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S11;\n\n t_1 = _S10;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S12 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S12, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S13 = key_0 % rowTableWidth_0(keys_2);\n\n return _S13;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S14 = key_1 / rowTableWidth_0(keys_3);\n\n return _S14;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_0, int scaleType_2, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, scaleType_2, symlogConstant_2)) * h_0;\n}\n\n\nfloat insetValueYPx_0(float value_3, float domainMin_4, float domainMax_4, float h_1, int scaleType_3, float insetPx_1, float symlogConstant_3)\n{\n\n float _S15 = min(insetPx_1, h_1 * 0.5);\n return _S15 + valueToYPxScaled_0(value_3, domainMin_4, domainMax_4, h_1 - 2.0 * _S15, scaleType_3, symlogConstant_3);\n}\n\n\nfloat pointYPx_0(float value_4, float domainMin_5, float domainMax_5, float h_2, int scaleType_4, float insetPx_2, float symlogConstant_4)\n{\n\n return insetValueYPx_0(value_4, domainMin_5, domainMax_5, h_2, scaleType_4, insetPx_2, symlogConstant_4);\n}\n\n\n\nfloat pointRowYPx_0(float bandTop_0, float h_3, int reverse_1, float valueYPx_0)\n{\n\n float _S16;\n if(reverse_1 != 0)\n {\n\n _S16 = h_3 - valueYPx_0;\n\n }\n else\n {\n\n _S16 = valueYPx_0;\n\n }\n\n return bandTop_0 + _S16;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S17;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S17 = - minWidth_0;\n\n }\n else\n {\n\n _S17 = minWidth_0;\n\n }\n\n _S17 = x1_0 + _S17;\n\n }\n else\n {\n\n _S17 = x2_0;\n\n }\n\n return _S17;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nfloat clipXToPx_0(float clipX_0, float canvasWidth_1)\n{\n\n return (clipX_0 + 1.0) * 0.5 * canvasWidth_1;\n}\n\n\nfloat crispSquareTopLeftPx_0(float centerPx_0, float diameterPx_0)\n{\n\n return floor(centerPx_0 - diameterPx_0 * 0.5 + 0.5);\n}\n\n\n\nvec2 crispSquareCornerPx_0(vec2 centerPx_1, float diameterPx_1, vec2 q_0)\n{\n\n\n\n return vec2(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * diameterPx_1;\n}\n\n\nfloat pxToClipX_0(float xPx_0, float canvasWidth_2)\n{\n\n return xPx_0 / canvasWidth_2 * 2.0 - 1.0;\n}\n\n\nvec4 crispSquareCornerClip_0(float centerClipX_0, float centerYPx_0, float diameterPx_2, vec2 q_1, float viewportWidth_1, float canvasHeight_2)\n{\n\n\n\n vec2 vPx_0 = crispSquareCornerPx_0(vec2(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0, 1.0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat glyphExpand_0(float unitPx_0, float reaches_0, float dpr_2)\n{\n\n return 1.0 + reaches_0 * aaHalfPx_0(dpr_2) / max(unitPx_0, 0.00100000004749745);\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_localPos;\n\n\nflat out float v_shape;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_glyph;\n\n\nlayout(location = 5)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 localPos_0;\n float shape_0;\n};\n\n\nvec4 rampColor_0(float _S18)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S18, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S19, int _S20, float _S21, float _S22, float _S23, int _S24, vec4 _S25, vec4 _S26)\n{\n\n if(_S20 == 0)\n {\n\n return unpackRGBA_0(_S19);\n }\n if(_S19 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_5;\n\n if((_S19 & 2139095040U) == 2139095040U)\n {\n\n if((_S19 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S19 & 2147483648U) != 0U;\n if(_S20 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_5 = 0;\n\n }\n else\n {\n\n scaleType_5 = _S24;\n\n }\n\n return u_0.colorBands_0[scaleType_5];\n }\n\n float _S27;\n\n if(negative_0)\n {\n\n _S27 = 0.0;\n\n }\n else\n {\n\n _S27 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S27, _S23));\n }\n float value_5 = uintBitsToFloat(_S19);\n if(_S20 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_5, _S24, _S25, _S26)];\n }\n if(_S20 == 2)\n {\n\n scaleType_5 = 1;\n\n }\n else\n {\n\n scaleType_5 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_5, _S21, _S22, scaleType_5, 1.0), _S23));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S28, int _S29, vec4 _S30)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S28;\n p_0.color_1 = _S30;\n if(_S29 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S29);\n if(_S28 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_4 = rowTablePlaneHeight_0(n_0);\n uint _S31 = rowTableTexelX_0(_S28, n_0);\n\n float u_2 = (float(_S31) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_4);\n uint y_0 = rowTableTexelY_0(_S28, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_4) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S32;\n if((c_2.w) > 0.0)\n {\n\n _S32 = c_2;\n\n }\n else\n {\n\n _S32 = _S30;\n\n }\n\n p_0.color_1 = _S32;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S33)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S33), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n\n vec2 q_2 = quadLocal_0(uint(gl_VertexID) % 6U);\n vec2 local_0 = q_2 * 2.0 - 1.0;\n bool xZero_0 = (q_2.x) < 0.5;\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S34 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S34.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.localPos_0 = vec2(0.0);\n o_0.shape_0 = 3.0;\n VsOut_0 _S35 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S35.color_0;\n\n v_localPos = _S35.localPos_0;\n\n v_shape = _S35.shape_0;\n\n return;\n }\n\n float _S36 = bpToClipX_0(a_x);\n\n float _S37 = bpToClipX_0(a_x2);\n\n float yPx_1 = pointRowYPx_0(rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_1), u_0.rowHeight_0, u_0.reverse_0, pointYPx_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0, u_0.insetPx_0, u_0.valueSymlogConstant_0));\n float centerClipY_0 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n\n o_0.color_0 = _S34.color_1;\n float centerClipX_1 = (_S36 + _S37) * 0.5;\n\n float x_2;\n if((u_0.rule_0) != 0)\n {\n\n float farClipX_0 = extendToMinWidthX_0(_S36, _S37, u_0.minWidthPx_0, u_0.viewportWidth_0);\n if(xZero_0)\n {\n\n x_2 = min(_S36, farClipX_0);\n\n }\n else\n {\n\n x_2 = max(_S36, farClipX_0);\n\n }\n\n o_0.position_0 = vec4(x_2, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0;\n\n }\n else\n {\n\n bool _S38;\n\n if(a_glyph == 3U)\n {\n\n _S38 = true;\n\n }\n else\n {\n\n if(a_glyph == 0U)\n {\n\n _S38 = (u_0.radiusPx_0 * 2.0) <= 3.0;\n\n }\n else\n {\n\n _S38 = false;\n\n }\n\n }\n\n if(_S38)\n {\n\n\n o_0.position_0 = crispSquareCornerClip_0(centerClipX_1, yPx_1, u_0.radiusPx_0 * 2.0, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0;\n\n }\n else\n {\n\n bool diamond_0 = a_glyph == 2U;\n float _S39 = u_0.radiusPx_0;\n\n if(diamond_0)\n {\n\n x_2 = 1.60000002384185791;\n\n }\n else\n {\n\n x_2 = 1.0;\n\n }\n\n float unitPx_1 = _S39 * x_2;\n if(a_glyph == 1U)\n {\n\n x_2 = 2.2360680103302002;\n\n }\n else\n {\n\n if(diamond_0)\n {\n\n x_2 = 1.41421365737915039;\n\n }\n else\n {\n\n x_2 = 1.0;\n\n }\n\n }\n\n float expand_0 = glyphExpand_0(unitPx_1, x_2, u_0.devicePixelRatio_0);\n float halfPx_0 = unitPx_1 * expand_0;\n\n\n o_0.position_0 = vec4(centerClipX_1 + pxToClipLen_0(local_0.x * halfPx_0, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * halfPx_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.localPos_0 = local_0 * expand_0;\n if(a_glyph == 1U)\n {\n\n x_2 = 2.0;\n\n }\n else\n {\n\n if(a_glyph == 2U)\n {\n\n x_2 = 1.0;\n\n }\n else\n {\n\n x_2 = 0.0;\n\n }\n\n }\n\n o_0.shape_0 = x_2;\n\n }\n\n }\n\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_localPos = _S40.localPos_0;\n\n v_shape = _S40.shape_0;\n\n return;\n}\n\n"
5
+
6
+ export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nfloat discCoverage_0(vec2 localPos_0)\n{\n\n return 1.0 - length(localPos_0);\n}\n\n\nfloat aaGradient_0(float d_0)\n{\n\n return max(length(vec2(dFdx(d_0), dFdy(d_0))), 0.00000999999974738);\n}\n\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nfloat glyphEdgeAlpha_0(float coverage_0)\n{\n\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_localPos;\n\n\nflat in float v_shape;\n\n\nvoid main()\n{\n\n float coverage_1;\n\n if(v_shape > 2.5)\n {\n\n coverage_1 = 1.0;\n\n }\n else\n {\n\n if(v_shape > 1.5)\n {\n\n float _S1 = v_localPos.y;\n float _S2 = v_localPos.x;\n\n coverage_1 = min(1.0 - _S1, min((2.0 * _S2 + _S1 + 1.0) * 0.44721359014511108, (-2.0 * _S2 + _S1 + 1.0) * 0.44721359014511108));\n\n }\n else\n {\n\n if(v_shape > 0.5)\n {\n\n coverage_1 = 1.0 - (abs(v_localPos.x) + abs(v_localPos.y));\n\n }\n else\n {\n\n coverage_1 = discCoverage_0(v_localPos);\n\n }\n\n }\n\n }\n\n float alpha_0 = glyphEdgeAlpha_0(coverage_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n"