@jbrowse/render-core 5.0.0-beta.11 → 5.0.0-beta.13

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 (80) hide show
  1. package/esm/hal/webgl2Hal.js +3 -0
  2. package/esm/marks/barMark.js +4 -2
  3. package/esm/marks/index.d.ts +3 -3
  4. package/esm/marks/index.js +2 -2
  5. package/esm/marks/lineMark.d.ts +6 -0
  6. package/esm/marks/lineMark.js +34 -21
  7. package/esm/marks/linkMark.d.ts +21 -1
  8. package/esm/marks/linkMark.js +25 -6
  9. package/esm/marks/markPlan.d.ts +4 -3
  10. package/esm/marks/markPlan.js +5 -4
  11. package/esm/marks/rowLane.d.ts +2 -0
  12. package/esm/marks/rowLane.js +7 -3
  13. package/esm/marks/spanMark.d.ts +4 -3
  14. package/esm/marks/spanMark.js +3 -3
  15. package/esm/marks/types.d.ts +4 -1
  16. package/esm/marks/types.js +3 -1
  17. package/esm/shaders/barMark.glsl.generated.d.ts +1 -1
  18. package/esm/shaders/barMark.glsl.generated.js +1 -1
  19. package/esm/shaders/barMark.wgsl.generated.d.ts +1 -1
  20. package/esm/shaders/barMark.wgsl.generated.js +1 -1
  21. package/esm/shaders/curveDistance.js.generated.d.ts +1 -0
  22. package/esm/shaders/curveDistance.js.generated.js +9 -0
  23. package/esm/shaders/insertionGlyph.generated.d.ts +6 -0
  24. package/esm/shaders/insertionGlyph.generated.js +8 -0
  25. package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -2
  26. package/esm/shaders/lineCenterMark.glsl.generated.js +2 -2
  27. package/esm/shaders/lineCenterMark.iface.generated.d.ts +11 -9
  28. package/esm/shaders/lineCenterMark.iface.generated.js +20 -18
  29. package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -1
  30. package/esm/shaders/lineCenterMark.wgsl.generated.js +1 -1
  31. package/esm/shaders/lineCommon.js.generated.d.ts +1 -0
  32. package/esm/shaders/lineCommon.js.generated.js +20 -0
  33. package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -2
  34. package/esm/shaders/lineStepMark.glsl.generated.js +2 -2
  35. package/esm/shaders/lineStepMark.iface.generated.d.ts +11 -9
  36. package/esm/shaders/lineStepMark.iface.generated.js +20 -18
  37. package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -1
  38. package/esm/shaders/lineStepMark.wgsl.generated.js +1 -1
  39. package/esm/shaders/linkMark.glsl.generated.d.ts +1 -1
  40. package/esm/shaders/linkMark.glsl.generated.js +1 -1
  41. package/esm/shaders/linkMark.js.generated.d.ts +2 -1
  42. package/esm/shaders/linkMark.js.generated.js +3 -3
  43. package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -1
  44. package/esm/shaders/linkMark.wgsl.generated.js +1 -1
  45. package/esm/shaders/pointMark.glsl.generated.d.ts +1 -1
  46. package/esm/shaders/pointMark.glsl.generated.js +1 -1
  47. package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -1
  48. package/esm/shaders/pointMark.wgsl.generated.js +1 -1
  49. package/esm/shaders/spanMark.glsl.generated.d.ts +1 -1
  50. package/esm/shaders/spanMark.glsl.generated.js +1 -1
  51. package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -1
  52. package/esm/shaders/spanMark.wgsl.generated.js +1 -1
  53. package/esm/slangPass.d.ts +5 -3
  54. package/esm/slangPass.js +2 -2
  55. package/package.json +2 -2
  56. package/src/shaders/barMark.glsl.generated.ts +1 -1
  57. package/src/shaders/barMark.wgsl.generated.ts +1 -1
  58. package/src/shaders/curveDistance.js.generated.ts +12 -0
  59. package/src/shaders/curveDistance.slang +1 -1
  60. package/src/shaders/insertionGlyph.generated.ts +14 -0
  61. package/src/shaders/insertionGlyph.slang +59 -0
  62. package/src/shaders/lineCenterMark.glsl.generated.ts +2 -2
  63. package/src/shaders/lineCenterMark.iface.generated.ts +21 -18
  64. package/src/shaders/lineCenterMark.slang +5 -1
  65. package/src/shaders/lineCenterMark.wgsl.generated.ts +1 -1
  66. package/src/shaders/lineCommon.js.generated.ts +20 -0
  67. package/src/shaders/lineCommon.slang +14 -4
  68. package/src/shaders/lineStepMark.glsl.generated.ts +2 -2
  69. package/src/shaders/lineStepMark.iface.generated.ts +21 -18
  70. package/src/shaders/lineStepMark.slang +5 -1
  71. package/src/shaders/lineStepMark.wgsl.generated.ts +1 -1
  72. package/src/shaders/linkMark.glsl.generated.ts +1 -1
  73. package/src/shaders/linkMark.js.generated.ts +3 -3
  74. package/src/shaders/linkMark.slang +10 -7
  75. package/src/shaders/linkMark.wgsl.generated.ts +1 -1
  76. package/src/shaders/pointMark.glsl.generated.ts +1 -1
  77. package/src/shaders/pointMark.wgsl.generated.ts +1 -1
  78. package/src/shaders/rowTable.slang +5 -1
  79. package/src/shaders/spanMark.glsl.generated.ts +1 -1
  80. package/src/shaders/spanMark.wgsl.generated.ts +1 -1
@@ -181,6 +181,9 @@ export class WebGL2Hal extends GpuHalBase {
181
181
  // Programs link on first draw (`getPass`). The first links here as a
182
182
  // canary, so a GL stack that cannot compile our shaders throws while
183
183
  // `createGpuHal` can still fall back to Canvas2D.
184
+ // Starting every pass's compile here was a loss (headed Chrome, Intel UHD
185
+ // 630): the GPU process ran all 17 programs before the 10 a first BAM draw
186
+ // needs, and a first visit drew at 1094 ms against 907.
184
187
  const canary = descriptors[0];
185
188
  if (canary) {
186
189
  this.passes.set(canary.id, {
@@ -94,6 +94,8 @@ export const barMark = {
94
94
  const yScale = valueScaleUniforms(params);
95
95
  const table = params.rowTable;
96
96
  const [domainMin, domainMax] = params.domain;
97
+ const { seamPx } = params;
98
+ const seamLeft = block.reversed ? seamPx : 0;
97
99
  let clipped = false;
98
100
  for (let i = 0; i < count; i++) {
99
101
  const slot = rowSlot(row, i, table);
@@ -104,7 +106,7 @@ export const barMark = {
104
106
  const r = barRect(bpToPx, x[i], x2[i], y[i], top, band, params, yScale);
105
107
  if (r) {
106
108
  setFill(rowColor(color[i], row, i, table));
107
- ctx.fillRect(r.left, r.top, r.width + params.seamPx, r.height);
109
+ ctx.fillRect(r.left - seamLeft, r.top, r.width + seamPx, r.height);
108
110
  }
109
111
  clipped ||=
110
112
  clipSide(y[i], domainMin, domainMax, yScale.valueScaleType) !== 0;
@@ -123,7 +125,7 @@ export const barMark = {
123
125
  const { top, band } = barBand(params, frame.canvasHeight, slot);
124
126
  const s = stripRect(bpToPx, x[i], x2[i], y[i], top, band, params, yScale);
125
127
  if (s) {
126
- ctx.fillRect(s.left, s.top, s.width + params.seamPx, s.height);
128
+ ctx.fillRect(s.left - seamLeft, s.top, s.width + seamPx, s.height);
127
129
  }
128
130
  }
129
131
  },
@@ -8,7 +8,7 @@ export { pointMark } from './pointMark.ts';
8
8
  export { ruleMark } from './ruleMark.ts';
9
9
  export { spanMark } from './spanMark.ts';
10
10
  export { lineCenterMark, lineMarkOf, lineStepMark } from './lineMark.ts';
11
- export { linkFeet, linkMark, LINK_ELSEWHERE, LINK_NO_REGION, } from './linkMark.ts';
11
+ export { linkApex, linkFeet, linkMark, LINK_ELSEWHERE, LINK_NO_REGION, } from './linkMark.ts';
12
12
  export { ellipseDistance, ellipseNearest } from './ellipseDistance.ts';
13
13
  export { appendGlyph, pointInsetPx } from './glyphPaint.ts';
14
14
  export { recordPath } from './pathRecorder.ts';
@@ -16,7 +16,7 @@ export { abgrToCssRgba, makeAbgrFill } from './colorFill.ts';
16
16
  export { RAMP_NOT_A_NUMBER_COLOR, RAMP_NO_VALUE_BITS, RAMP_NO_VALUE_COLOR, } from '../shaders/markColor.generated.ts';
17
17
  export { instanceColor, isThreshold, keepRampValues, paintColors, rampUniforms, rampValueBits, thresholdBandOf, } from './markRamp.ts';
18
18
  export { HIDDEN_ROW, NO_ROW_COLOR, RowKeys, buildRowTable } from './rowTable.ts';
19
- export { keySlot, rowColor, rowSlot } from './rowLane.ts';
19
+ export { keySlot, rowColor, rowSlot, rowTableKeys, rowTableTextures, } from './rowLane.ts';
20
20
  export { rowSpanIndex, spansInRow } from './rowSpanIndex.ts';
21
21
  export type { MarkPlan } from './markPlan.ts';
22
22
  export type { MarkInstance } from './markInk.ts';
@@ -27,7 +27,7 @@ export type { PointChannels, PointParams } from './pointMark.ts';
27
27
  export type { RuleChannels, RuleParams } from './ruleMark.ts';
28
28
  export type { SpanChannels, SpanParams } from './spanMark.ts';
29
29
  export type { LineChannels, LineInterpolate, LineParams } from './lineMark.ts';
30
- export type { LinkChannels, LinkParams, LinkRegion, LinkSizeScale, } from './linkMark.ts';
30
+ export type { LinkApex, LinkChannels, LinkParams, LinkRegion, LinkSizeScale, } from './linkMark.ts';
31
31
  export type { RowTable } from './rowTable.ts';
32
32
  export type { RowSpanIndex } from './rowSpanIndex.ts';
33
33
  export type { ColorChannel } from './markRamp.ts';
@@ -8,7 +8,7 @@ export { pointMark } from './pointMark.js';
8
8
  export { ruleMark } from './ruleMark.js';
9
9
  export { spanMark } from './spanMark.js';
10
10
  export { lineCenterMark, lineMarkOf, lineStepMark } from './lineMark.js';
11
- export { linkFeet, linkMark, LINK_ELSEWHERE, LINK_NO_REGION, } from './linkMark.js';
11
+ export { linkApex, linkFeet, linkMark, LINK_ELSEWHERE, LINK_NO_REGION, } from './linkMark.js';
12
12
  export { ellipseDistance, ellipseNearest } from './ellipseDistance.js';
13
13
  export { appendGlyph, pointInsetPx } from './glyphPaint.js';
14
14
  export { recordPath } from './pathRecorder.js';
@@ -16,5 +16,5 @@ export { abgrToCssRgba, makeAbgrFill } from './colorFill.js';
16
16
  export { RAMP_NOT_A_NUMBER_COLOR, RAMP_NO_VALUE_BITS, RAMP_NO_VALUE_COLOR, } from '../shaders/markColor.generated.js';
17
17
  export { instanceColor, isThreshold, keepRampValues, paintColors, rampUniforms, rampValueBits, thresholdBandOf, } from './markRamp.js';
18
18
  export { HIDDEN_ROW, NO_ROW_COLOR, RowKeys, buildRowTable } from './rowTable.js';
19
- export { keySlot, rowColor, rowSlot } from './rowLane.js';
19
+ export { keySlot, rowColor, rowSlot, rowTableKeys, rowTableTextures, } from './rowLane.js';
20
20
  export { rowSpanIndex, spansInRow } from './rowSpanIndex.js';
@@ -20,6 +20,12 @@ export interface LineChannels extends ColorChannel, RowChannel {
20
20
  export interface LineParams extends RowParams, MarkValueScale {
21
21
  /** The quantitative colour scale, for a line whose colour is a ramp or a threshold. */
22
22
  colorScale?: MarkColorScale;
23
+ /**
24
+ * Whether the colour field is the plotted `y`. Only then does a threshold's
25
+ * cut sit on the y scale, so the line changes colour where it crosses one;
26
+ * otherwise each instance takes its own value's colour.
27
+ */
28
+ colorFromY?: boolean;
23
29
  /** The value a step drops to across a gap. */
24
30
  origin: number;
25
31
  /** Stroke width in CSS px. */
@@ -2,6 +2,7 @@ import { bpRangeXTuple } from '../blockClipUtils.js';
2
2
  import { CappedPath, getDpr, makeBpMapper } from '../canvas2dUtils.js';
3
3
  import * as centerShader from '../shaders/lineCenterMark.generated.js';
4
4
  import { GAP_Y, NO_PREV_X } from '../shaders/lineCommon.generated.js';
5
+ import { lineColorAlongY } from '../shaders/lineCommon.js.generated.js';
5
6
  import * as stepShader from '../shaders/lineStepMark.generated.js';
6
7
  import { valueToYPxScaled } from '../shaders/pointMark.js.generated.js';
7
8
  import { rowBandTopPx } from '../shaders/rowTable.js.generated.js';
@@ -9,7 +10,7 @@ import { normalizeScoreUnclamped } from '../shaders/scoreScale.js.generated.js';
9
10
  import { slangPass } from '../slangPass.js';
10
11
  import { abgrToCssRgba } from './colorFill.js';
11
12
  import { colorBits, isThreshold, paintColors, rampUniforms, } from './markRamp.js';
12
- import { bandHeightPx, rowColor, rowLane, rowSlot, rowTableKeys, rowTableTextures, } from './rowLane.js';
13
+ import { bandHeightPx, rowColor, rowColorOverride, rowLane, rowSlot, rowTableKeys, rowTableTextures, } from './rowLane.js';
13
14
  import { valueScaleUniforms } from './valueScale.js';
14
15
  const NO_GAP = Number.POSITIVE_INFINITY;
15
16
  function sameRow(row, a, b) {
@@ -66,6 +67,7 @@ function writeLineUniforms(scratch, clip, block, frame, params) {
66
67
  domainMax: params.domain[1],
67
68
  ...valueScaleUniforms(params),
68
69
  ...rampUniforms(params.colorScale),
70
+ colorFromY: params.colorFromY ? 1 : 0,
69
71
  rowHeight,
70
72
  rowBandPx: params.rowBandPx ?? rowHeight,
71
73
  rowOffsetPx: params.rowOffsetPx ?? 0,
@@ -281,26 +283,36 @@ function traceCenter(pen, c, g, rows, indices) {
281
283
  pen.lineTo(cx, cy, colorY);
282
284
  }
283
285
  }
284
- // Under a threshold the line is stroked once per band per row, each pass
285
- // keeping the parts of the polyline inside its band; otherwise once, in each
286
- // instance's own colour.
286
+ // Along y, the line is stroked once per band per row, each pass keeping the
287
+ // parts of the polyline inside its band; otherwise once, in each instance's
288
+ // own colour. A row the table recolours takes its override either way.
287
289
  function paintLine(ctx, c, g, params, trace) {
288
290
  const { row, count } = c;
289
291
  const scale = params.colorScale;
290
- if (scale && isThreshold(scale) && c.colorValue) {
291
- const bySlot = new Map();
292
- for (let i = 0; i < count; i++) {
293
- const slot = rowSlot(row, i, g.table);
294
- if (slot !== undefined) {
295
- const held = bySlot.get(slot);
296
- if (held) {
297
- held.push(i);
298
- }
299
- else {
300
- bySlot.set(slot, [i]);
301
- }
292
+ const bySlot = new Map();
293
+ const own = [];
294
+ const { rampMode } = rampUniforms(scale);
295
+ const colorFromY = params.colorFromY ? 1 : 0;
296
+ for (let i = 0; i < count; i++) {
297
+ const slot = rowSlot(row, i, g.table);
298
+ if (slot === undefined) {
299
+ continue;
300
+ }
301
+ const overridden = rowColorOverride(row, i, g.table) !== undefined;
302
+ if (lineColorAlongY(rampMode, colorFromY, overridden)) {
303
+ const held = bySlot.get(slot);
304
+ if (held) {
305
+ held.push(i);
306
+ }
307
+ else {
308
+ bySlot.set(slot, [i]);
302
309
  }
303
310
  }
311
+ else {
312
+ own.push(i);
313
+ }
314
+ }
315
+ if (scale && isThreshold(scale)) {
304
316
  const { cuts, colors } = scale;
305
317
  for (const [slot, indices] of bySlot) {
306
318
  const cutYs = cuts.map(cut => colorYPx(g, cut, slot));
@@ -311,12 +323,13 @@ function paintLine(ctx, c, g, params, trace) {
311
323
  pen.end();
312
324
  }
313
325
  }
314
- return;
315
326
  }
316
- const color = paintColors(c, count, scale);
317
- const pen = new InstancePen(ctx, i => rowColor(color[i], row, i, g.table));
318
- trace(pen, Array.from({ length: count }, (_, i) => i));
319
- pen.end();
327
+ if (own.length > 0) {
328
+ const color = paintColors(c, count, scale);
329
+ const pen = new InstancePen(ctx, i => rowColor(color[i], row, i, g.table));
330
+ trace(pen, own);
331
+ pen.end();
332
+ }
320
333
  }
321
334
  function paintStep(ctx, c, block, frame, params) {
322
335
  if (c.count === 0) {
@@ -1,7 +1,8 @@
1
1
  import { LINK_ELSEWHERE, LINK_NO_REGION } from '../shaders/linkMark.consts.generated.ts';
2
+ import type { RenderBlock } from '../renderBlock.ts';
2
3
  import type { ColorChannel } from './markRamp.ts';
3
4
  import type { RowChannel, RowParams } from './rowLane.ts';
4
- import type { MarkColorScale, MarkShape } from './types.ts';
5
+ import type { MarkFrame, MarkColorScale, MarkShape } from './types.ts';
5
6
  import type { MarkValueScale } from './valueScale.ts';
6
7
  /**
7
8
  * The `link` shape's channels: a stroked curve from `x`, on the displayed
@@ -72,5 +73,24 @@ export interface LinkParams extends RowParams, MarkValueScale {
72
73
  /** How far inside the band the value range ends, the axis's own. */
73
74
  insetPx?: number;
74
75
  }
76
+ /**
77
+ * Where an instance's curve peaks as the painter and the shader draw it: the
78
+ * centreline's apex in canvas px and how far it stands off its baseline.
79
+ */
80
+ export interface LinkApex {
81
+ x: number;
82
+ y: number;
83
+ rise: number;
84
+ /** The curve's half-span at its baseline; 0 for a line or a stem, which enclose nothing. */
85
+ halfWidth: number;
86
+ strokePx: number;
87
+ /** Canvas y per px toward the baseline: 1 standing on the band's foot, -1 hanging from its top. */
88
+ inward: 1 | -1;
89
+ }
90
+ /**
91
+ * Instance `i`'s apex, undefined where it draws none on the band: no curve
92
+ * at all, or a far pair's circle, which the band clips to its legs.
93
+ */
94
+ export declare function linkApex(c: LinkChannels, block: RenderBlock, frame: MarkFrame, params: LinkParams, i: number): LinkApex | undefined;
75
95
  export declare const linkMark: MarkShape<LinkChannels, LinkParams>;
76
96
  export { LINK_ELSEWHERE, LINK_NO_REGION };
@@ -1,9 +1,9 @@
1
1
  import { getDpr } from '../canvas2dUtils.js';
2
2
  import { SCALE_TYPE_LOG } from '../scoreScale.js';
3
- import { distToWideCirclePx } from '../shaders/curveDistance.js.generated.js';
4
- import { LINK_CURVE_SEGMENTS, LINK_ELSEWHERE, LINK_FAR_SCREEN_WIDTHS, LINK_FOOT_PX, LINK_MAX_REGIONS, LINK_NO_REGION, LINK_NO_SIZE, LINK_LINE_MIN_PX, LINK_SHAPE_ARC, LINK_SHAPE_DOME, LINK_SHAPE_LINE, LINK_SIZE_CONSTANT, LINK_SIZE_SCALED, LINK_STEM_PX, } from '../shaders/linkMark.consts.generated.js';
3
+ import { distToWideCirclePx, legSweepAngle, } from '../shaders/curveDistance.js.generated.js';
4
+ import { LINK_CURVE_SEGMENTS, LINK_ELSEWHERE, LINK_FOOT_PX, LINK_MAX_REGIONS, LINK_NO_REGION, LINK_NO_SIZE, LINK_LINE_MIN_PX, LINK_SHAPE_ARC, LINK_SHAPE_DOME, LINK_SHAPE_LINE, LINK_SIZE_CONSTANT, LINK_SIZE_SCALED, LINK_STEM_PX, } from '../shaders/linkMark.consts.generated.js';
5
5
  import * as shader from '../shaders/linkMark.generated.js';
6
- import { linkApexPx, linkBaseYPx, linkFootDir, linkFootLenPx, linkRadiiPx, linkStrokeWidthPx, linkValuePx, } from '../shaders/linkMark.js.generated.js';
6
+ import { linkApexPx, linkBaseYPx, linkFootDir, linkFootLenPx, linkIsFar, linkRadiiPx, linkStrokeWidthPx, linkValuePx, } from '../shaders/linkMark.js.generated.js';
7
7
  import { slangPass } from '../slangPass.js';
8
8
  import { abgrToCssRgba } from './colorFill.js';
9
9
  import { ellipseNearest } from './ellipseDistance.js';
@@ -164,7 +164,7 @@ function placeCurve(c, g, i) {
164
164
  g.x2Px = regionPx(regions, region, c.x2[i]);
165
165
  const pairHalf = Math.abs(g.x2Px - g.xPx) / 2;
166
166
  const valuePx = linkValuePx(c.y ? c.y[i] : 0, g.domainMin, g.domainMax, g.band, g.scaleType, g.insetPx, g.symlogConstant);
167
- const apex = linkApexPx(pairHalf, g.reach, g.shape, g.valued, valuePx);
167
+ const apex = linkApexPx(pairHalf, g.reach, g.strokePx / 2, g.shape, g.valued, valuePx);
168
168
  if (g.shape === LINK_SHAPE_LINE) {
169
169
  g.kind = KIND_LINE;
170
170
  g.rx = Math.max(2 * pairHalf, LINK_LINE_MIN_PX);
@@ -174,15 +174,34 @@ function placeCurve(c, g, i) {
174
174
  const [rx, ry] = linkRadiiPx(pairHalf, apex, g.screenW);
175
175
  g.rx = rx;
176
176
  g.ry = ry;
177
- if (2 * pairHalf > LINK_FAR_SCREEN_WIDTHS * g.screenW) {
177
+ if (linkIsFar(pairHalf, g.screenW)) {
178
178
  g.kind = KIND_CIRCLE;
179
- g.legSweep = Math.asin(Math.min(1, Math.max(0, (g.reach + g.strokePx / 2) / Math.max(rx, 1e-6))));
179
+ g.legSweep = legSweepAngle(rx, g.reach + g.strokePx / 2);
180
180
  g.legHeight = rx * Math.sin(g.legSweep);
181
181
  }
182
182
  else {
183
183
  g.kind = KIND_ELLIPSE;
184
184
  }
185
185
  }
186
+ /**
187
+ * Instance `i`'s apex, undefined where it draws none on the band: no curve
188
+ * at all, or a far pair's circle, which the band clips to its legs.
189
+ */
190
+ export function linkApex(c, block, frame, params, i) {
191
+ const g = linkFrame(block, frame, params);
192
+ placeCurve(c, g, i);
193
+ if (g.kind === KIND_NONE || g.kind === KIND_CIRCLE) {
194
+ return undefined;
195
+ }
196
+ return {
197
+ x: (g.xPx + g.x2Px) / 2,
198
+ y: yAt(g, g.ry),
199
+ rise: g.ry,
200
+ halfWidth: g.kind === KIND_ELLIPSE ? g.rx : 0,
201
+ strokePx: g.strokePx,
202
+ inward: g.reverse ? -1 : 1,
203
+ };
204
+ }
186
205
  function sizeLane(c) {
187
206
  const lane = new Float32Array(c.count);
188
207
  for (let i = 0; i < c.count; i++) {
@@ -18,8 +18,9 @@ export interface MarkPlan<TRegion, TState extends MarkFrame> {
18
18
  }
19
19
  /**
20
20
  * Resolve which marks draw this frame. Throws for an enabled mark the plan
21
- * form cannot carry — one with a `band` or a `paintsBlock` — since a plan
22
- * neither scissors nor asks the block anything, and without the throw the GPU
23
- * would draw what Canvas2D declines.
21
+ * form cannot carry — one with a `band`, a `paintsBlock` or a per-draw
22
+ * `verticesPerInstance` — since a plan neither scissors, asks the block
23
+ * anything nor sizes a draw, and without the throw the GPU would draw what
24
+ * Canvas2D declines, or a chevron a line.
24
25
  */
25
26
  export declare function planMarks<TRegion, TState extends MarkFrame>(marks: readonly Mark<TRegion, TState>[], state: TState): MarkPlan<TRegion, TState>;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Resolve which marks draw this frame. Throws for an enabled mark the plan
3
- * form cannot carry — one with a `band` or a `paintsBlock` — since a plan
4
- * neither scissors nor asks the block anything, and without the throw the GPU
5
- * would draw what Canvas2D declines.
3
+ * form cannot carry — one with a `band`, a `paintsBlock` or a per-draw
4
+ * `verticesPerInstance` — since a plan neither scissors, asks the block
5
+ * anything nor sizes a draw, and without the throw the GPU would draw what
6
+ * Canvas2D declines, or a chevron a line.
6
7
  */
7
8
  export function planMarks(marks, state) {
8
9
  const enabled = [];
@@ -10,7 +11,7 @@ export function planMarks(marks, state) {
10
11
  for (const mark of marks) {
11
12
  if (!mark.enabled || mark.enabled(state)) {
12
13
  if (!mark.planned) {
13
- throw new Error(`mark ${mark.pass.id} declares a band or a block gate, which a frame plan does not carry; draw it through drawMarks`);
14
+ throw new Error(`mark ${mark.pass.id} declares a band, a block gate or a per-draw vertex count, which a frame plan does not carry; draw it through drawMarks`);
14
15
  }
15
16
  enabled.push(mark);
16
17
  passes.push(mark.planned);
@@ -35,5 +35,7 @@ export declare function bandHeightPx(params: RowParams, canvasHeight: number): n
35
35
  export declare function keySlot(key: number, table: RowTable | undefined): number | undefined;
36
36
  /** The slot instance `i` is drawn on, undefined where the table hides its key. */
37
37
  export declare function rowSlot(row: Uint32Array | undefined, i: number, table: RowTable | undefined): number | undefined;
38
+ /** Instance `i`'s key's colour override, undefined where it keeps its own. */
39
+ export declare function rowColorOverride(row: Uint32Array | undefined, i: number, table: RowTable | undefined): number | undefined;
38
40
  /** The colour instance `i` is drawn in: its key's override, else `color`. */
39
41
  export declare function rowColor(color: number, row: Uint32Array | undefined, i: number, table: RowTable | undefined): number;
@@ -33,9 +33,13 @@ export function keySlot(key, table) {
33
33
  export function rowSlot(row, i, table) {
34
34
  return keySlot(rowKey(row, i), table);
35
35
  }
36
- /** The colour instance `i` is drawn in: its key's override, else `color`. */
37
- export function rowColor(color, row, i, table) {
36
+ /** Instance `i`'s key's colour override, undefined where it keeps its own. */
37
+ export function rowColorOverride(row, i, table) {
38
38
  const key = rowKey(row, i);
39
39
  const override = table && key < table.keys ? table.color[key] : NO_ROW_COLOR;
40
- return override >>> 24 === 0 ? color : override;
40
+ return override >>> 24 === 0 ? undefined : override;
41
+ }
42
+ /** The colour instance `i` is drawn in: its key's override, else `color`. */
43
+ export function rowColor(color, row, i, table) {
44
+ return rowColorOverride(row, i, table) ?? color;
41
45
  }
@@ -26,9 +26,10 @@ export interface SpanParams {
26
26
  */
27
27
  minWidthPx: number;
28
28
  /**
29
- * CSS px the **painter alone** adds to each span's right edge, closing the
30
- * hairline two antialiased `fillRect`s leave where tiling runs meet on a
31
- * fractional pixel. The GPU pass needs none, and the ink excludes it.
29
+ * CSS px the **painter alone** adds to each span's edge facing the next span
30
+ * painted — the left edge on a reversed block — closing the hairline two
31
+ * antialiased `fillRect`s leave where tiling runs meet on a fractional pixel.
32
+ * The GPU pass needs none, and the ink excludes it.
32
33
  */
33
34
  seamPx: number;
34
35
  /** Rows-area scroll offset in CSS px; 0 for a canvas sized to its content. */
@@ -25,7 +25,7 @@ function spanFrame(block, params) {
25
25
  height: drawnRowHeightPx(rowHeight, rowProportion),
26
26
  };
27
27
  }
28
- function placeSpan(c, g, i) {
28
+ function placeSpan(c, g, i, seamPx = 0) {
29
29
  const slot = rowSlot(c.row, i, g.table);
30
30
  if (slot === undefined) {
31
31
  return false;
@@ -33,7 +33,7 @@ function placeSpan(c, g, i) {
33
33
  const xa = projectBp(g, c.x[i]);
34
34
  const xb = projectBp(g, c.x2[i]);
35
35
  const width = Math.max(g.minWidthPx, Math.abs(xb - xa));
36
- g.left = spanLeft(xa, xb, width);
36
+ g.left = spanLeft(xa, xb, width + seamPx);
37
37
  g.top = g.bandOffsetPx + g.rowHeight * slot - g.scrollTop;
38
38
  g.width = width;
39
39
  return true;
@@ -66,7 +66,7 @@ export const spanMark = {
66
66
  const g = spanFrame(block, params);
67
67
  const setFill = makeAbgrFill(ctx);
68
68
  for (let i = 0; i < count; i++) {
69
- if (placeSpan(channels, g, i)) {
69
+ if (placeSpan(channels, g, i, seamPx)) {
70
70
  setFill(rowColor(color[i], row, i, g.table));
71
71
  ctx.fillRect(g.left, g.top, g.width + seamPx, g.height);
72
72
  }
@@ -220,7 +220,10 @@ export interface Mark<TRegion, TState extends MarkFrame> {
220
220
  * frame and every other consumer per block, before any lens.
221
221
  */
222
222
  readonly enabled?: (state: TState) => boolean;
223
- /** The pass a frame plan draws; undefined with a `band` or `paintsBlock`. */
223
+ /**
224
+ * The pass a frame plan draws; undefined with a `band`, a `paintsBlock` or
225
+ * a per-draw `verticesPerInstance`, none of which a plan carries.
226
+ */
224
227
  readonly planned?: PlannedPass;
225
228
  drawRegion(hal: GpuHal, scratch: ArrayBuffer, block: RenderBlock, clip: BlockClipResult, region: TRegion, state: TState, regionKey: number, staged?: StagedUniforms, textures?: TextureBinder): void;
226
229
  paintBlock(ctx: MarkContext2D, region: TRegion, block: RenderBlock, state: TState): void;
@@ -37,7 +37,9 @@ export function defineMark(spec) {
37
37
  throw new Error(`mark ${shape.id} draws off ${lender.id}'s buffer but declares a different instance struct`);
38
38
  }
39
39
  const bufferOf = lender?.id;
40
- const planned = band || shape.paintsBlock ? undefined : { id: shape.pass.id, bufferOf };
40
+ const planned = band || shape.paintsBlock || shape.verticesPerInstance
41
+ ? undefined
42
+ : { id: shape.pass.id, bufferOf };
41
43
  // `channels` gates `params`: a union payload's params lens may only read its
42
44
  // own kind of region.
43
45
  function resolve(region, block, state) {
@@ -1,2 +1,2 @@
1
- export declare 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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\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 _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\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 _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\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 _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\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 _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\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 _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\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 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 _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\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\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\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 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 barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\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 valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\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_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\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 _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, 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_1) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S31;\n if((c_2.w) > 0.0)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S29;\n\n }\n\n p_0.color_1 = _S31;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S32)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S33 = 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(_S33.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.barInkPx_0 = vec2(0.0);\n VsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_0;\n\n v_barInkPx = _S34.barInkPx_0;\n\n return;\n }\n\n float _S35 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S35, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S33.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 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.barInkPx_0 = vec2(0.0);\n VsOut_0 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_barInkPx = _S36.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S38 = min(valueY_0, originY_0);\n float _S39 = max(valueY_0, originY_0);\n float vy_0 = mix(_S39 + padPx_0, _S38 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S33.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S38, vy_0 - _S39);\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_barInkPx = _S40.barInkPx_0;\n\n return;\n}\n\n";
1
+ export declare 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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\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 _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\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 _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\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 _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\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 _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\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 _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\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 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 _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\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\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\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 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 barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\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 valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\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_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n p_0.overridden_0 = false;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, 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_1) + 0.5) / rows_0)), (0.0)));\n bool _S31 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S31;\n\n vec4 _S32;\n if(_S31)\n {\n\n _S32 = c_2;\n\n }\n else\n {\n\n _S32 = _S29;\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 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.barInkPx_0 = vec2(0.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_barInkPx = _S35.barInkPx_0;\n\n return;\n }\n\n float _S36 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S36, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 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.barInkPx_0 = vec2(0.0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S38 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S38.color_0;\n\n v_barInkPx = _S38.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S39 = min(valueY_0, originY_0);\n float _S40 = max(valueY_0, originY_0);\n float vy_0 = mix(_S40 + padPx_0, _S39 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S34.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S39, vy_0 - _S40);\n VsOut_0 _S41 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S41.color_0;\n\n v_barInkPx = _S41.barInkPx_0;\n\n return;\n}\n\n";
2
2
  export declare const GLSL_FRAGMENT = "#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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\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 barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\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\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_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";
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
2
2
  // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
- 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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\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 _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\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 _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\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 _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\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 _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\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 _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\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 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 _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\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\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\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 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 barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\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 valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\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_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\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 _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, 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_1) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S31;\n if((c_2.w) > 0.0)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S29;\n\n }\n\n p_0.color_1 = _S31;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S32)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S33 = 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(_S33.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.barInkPx_0 = vec2(0.0);\n VsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_0;\n\n v_barInkPx = _S34.barInkPx_0;\n\n return;\n }\n\n float _S35 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S35, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S33.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 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.barInkPx_0 = vec2(0.0);\n VsOut_0 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_barInkPx = _S36.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S38 = min(valueY_0, originY_0);\n float _S39 = max(valueY_0, originY_0);\n float vy_0 = mix(_S39 + padPx_0, _S38 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S33.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S38, vy_0 - _S39);\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_barInkPx = _S40.barInkPx_0;\n\n return;\n}\n\n";
3
+ 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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\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 _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\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 _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\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 _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\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 _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\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 _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\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 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 _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\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\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\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 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 barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\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 valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\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_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n p_0.overridden_0 = false;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, 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_1) + 0.5) / rows_0)), (0.0)));\n bool _S31 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S31;\n\n vec4 _S32;\n if(_S31)\n {\n\n _S32 = c_2;\n\n }\n else\n {\n\n _S32 = _S29;\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 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.barInkPx_0 = vec2(0.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_barInkPx = _S35.barInkPx_0;\n\n return;\n }\n\n float _S36 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S36, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 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.barInkPx_0 = vec2(0.0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S38 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S38.color_0;\n\n v_barInkPx = _S38.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S39 = min(valueY_0, originY_0);\n float _S40 = max(valueY_0, originY_0);\n float vy_0 = mix(_S40 + padPx_0, _S39 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S34.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S39, vy_0 - _S40);\n VsOut_0 _S41 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S41.color_0;\n\n v_barInkPx = _S41.barInkPx_0;\n\n return;\n}\n\n";
4
4
  export const GLSL_FRAGMENT = "#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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\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 barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\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\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_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";