@jbrowse/render-core 5.0.0-beta.11 → 5.0.0-beta.14
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.
- package/esm/OverlayCanvas.d.ts +3 -2
- package/esm/OverlayCanvas.js +4 -2
- package/esm/RenderCanvas.d.ts +4 -3
- package/esm/RenderCanvas.js +4 -2
- package/esm/ScrollLockedOverlay.d.ts +2 -2
- package/esm/ScrollLockedOverlay.js +3 -2
- package/esm/blockClipUtils.d.ts +5 -5
- package/esm/blockClipUtils.js +4 -3
- package/esm/canvas2dUtils.d.ts +15 -21
- package/esm/canvas2dUtils.js +25 -55
- package/esm/colorRampLut.d.ts +2 -2
- package/esm/colorRampLut.js +2 -2
- package/esm/coverageBand.d.ts +0 -1
- package/esm/coverageBand.js +0 -5
- package/esm/coverageBandBuffers.d.ts +8 -5
- package/esm/createRenderingBackend.d.ts +1 -1
- package/esm/displayPhase.d.ts +5 -9
- package/esm/displayPhase.js +2 -2
- package/esm/hal/mockHal.d.ts +3 -4
- package/esm/hal/mockHal.js +5 -4
- package/esm/hal/types.d.ts +5 -5
- package/esm/hal/webgl2Hal.d.ts +4 -1
- package/esm/hal/webgl2Hal.js +18 -6
- package/esm/hal/webgpuHal.js +2 -2
- package/esm/linkFeet.d.ts +4 -0
- package/esm/linkFeet.js +7 -0
- package/esm/marks/barMark.d.ts +1 -1
- package/esm/marks/barMark.js +4 -2
- package/esm/marks/colorFill.d.ts +4 -4
- package/esm/marks/colorFill.js +4 -4
- package/esm/marks/connectorMark.d.ts +48 -0
- package/esm/marks/connectorMark.js +285 -0
- package/esm/marks/drawAgainstHit.d.ts +1 -1
- package/esm/marks/drawAgainstHit.js +4 -4
- package/esm/marks/glyphPaint.d.ts +5 -4
- package/esm/marks/glyphPaint.js +17 -7
- package/esm/marks/index.d.ts +8 -5
- package/esm/marks/index.js +6 -4
- package/esm/marks/lineMark.d.ts +47 -7
- package/esm/marks/lineMark.js +53 -39
- package/esm/marks/linkMark.d.ts +43 -6
- package/esm/marks/linkMark.js +118 -21
- package/esm/marks/markBackend.d.ts +1 -1
- package/esm/marks/markBackend.js +1 -1
- package/esm/marks/markPlan.d.ts +4 -3
- package/esm/marks/markPlan.js +5 -4
- package/esm/marks/markRamp.d.ts +11 -11
- package/esm/marks/markRamp.js +9 -9
- package/esm/marks/pointMark.d.ts +11 -5
- package/esm/marks/pointMark.js +34 -9
- package/esm/marks/rowLane.d.ts +4 -2
- package/esm/marks/rowLane.js +7 -3
- package/esm/marks/rowTable.d.ts +5 -5
- package/esm/marks/rowTable.js +4 -4
- package/esm/marks/ruleMark.js +1 -0
- package/esm/marks/spanMark.d.ts +8 -7
- package/esm/marks/spanMark.js +3 -3
- package/esm/marks/types.d.ts +8 -5
- package/esm/marks/types.js +8 -1
- package/esm/perRegionRenderingBackend.d.ts +1 -1
- package/esm/perRegionRenderingBackend.js +1 -1
- package/esm/regionDataMap.d.ts +2 -2
- package/esm/regionDataMap.js +2 -2
- package/esm/shaders/barMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/barMark.glsl.generated.js +1 -1
- package/esm/shaders/barMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/barMark.wgsl.generated.js +1 -1
- package/esm/shaders/capsule.js.generated.d.ts +1 -1
- package/esm/shaders/capsule.js.generated.js +2 -2
- package/esm/shaders/connectorMark.consts.generated.d.ts +11 -0
- package/esm/shaders/connectorMark.consts.generated.js +13 -0
- package/esm/shaders/{coverageIndicator.generated.d.ts → connectorMark.generated.d.ts} +2 -1
- package/esm/shaders/connectorMark.generated.js +8 -0
- package/esm/shaders/connectorMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/connectorMark.glsl.generated.js +4 -0
- package/esm/shaders/connectorMark.iface.generated.d.ts +88 -0
- package/esm/shaders/connectorMark.iface.generated.js +1194 -0
- package/esm/shaders/connectorMark.js.generated.d.ts +5 -0
- package/esm/shaders/connectorMark.js.generated.js +47 -0
- package/esm/shaders/connectorMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/connectorMark.wgsl.generated.js +3 -0
- package/esm/shaders/coverageInterbase.glsl.generated.d.ts +1 -1
- package/esm/shaders/coverageInterbase.glsl.generated.js +1 -1
- package/esm/shaders/coverageInterbase.wgsl.generated.d.ts +1 -1
- package/esm/shaders/coverageInterbase.wgsl.generated.js +1 -1
- package/esm/shaders/curveDistance.js.generated.d.ts +4 -0
- package/esm/shaders/curveDistance.js.generated.js +113 -0
- package/esm/shaders/insertionGlyph.generated.d.ts +6 -0
- package/esm/shaders/insertionGlyph.generated.js +8 -0
- package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -2
- package/esm/shaders/lineCenterMark.glsl.generated.js +2 -2
- package/esm/shaders/lineCenterMark.iface.generated.d.ts +11 -9
- package/esm/shaders/lineCenterMark.iface.generated.js +20 -18
- package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/lineCenterMark.wgsl.generated.js +1 -1
- package/esm/shaders/lineCommon.js.generated.d.ts +1 -0
- package/esm/shaders/lineCommon.js.generated.js +20 -0
- package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -2
- package/esm/shaders/lineStepMark.glsl.generated.js +2 -2
- package/esm/shaders/lineStepMark.iface.generated.d.ts +11 -9
- package/esm/shaders/lineStepMark.iface.generated.js +20 -18
- package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/lineStepMark.wgsl.generated.js +1 -1
- package/esm/shaders/linkMark.consts.generated.d.ts +1 -0
- package/esm/shaders/linkMark.consts.generated.js +1 -0
- package/esm/shaders/linkMark.glsl.generated.d.ts +2 -2
- package/esm/shaders/linkMark.glsl.generated.js +2 -2
- package/esm/shaders/linkMark.js.generated.d.ts +4 -2
- package/esm/shaders/linkMark.js.generated.js +33 -4
- package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/linkMark.wgsl.generated.js +1 -1
- package/esm/shaders/pointMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/pointMark.glsl.generated.js +1 -1
- package/esm/shaders/pointMark.iface.generated.d.ts +10 -8
- package/esm/shaders/pointMark.iface.generated.js +18 -16
- package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/pointMark.wgsl.generated.js +1 -1
- package/esm/shaders/spanMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/spanMark.glsl.generated.js +1 -1
- package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/spanMark.wgsl.generated.js +1 -1
- package/esm/slangPass.d.ts +5 -3
- package/esm/slangPass.js +2 -2
- package/package.json +7 -4
- package/src/shaders/arcHull.test.ts +87 -0
- package/src/shaders/barMark.glsl.generated.ts +1 -1
- package/src/shaders/barMark.slang +2 -2
- package/src/shaders/barMark.wgsl.generated.ts +1 -1
- package/src/shaders/capsule.js.generated.ts +2 -2
- package/src/shaders/capsule.slang +69 -24
- package/src/shaders/clipStrip.slang +1 -1
- package/src/shaders/colorPack.slang +2 -2
- package/src/shaders/colorRampLut.slang +7 -7
- package/src/shaders/connectorMark.consts.generated.ts +24 -0
- package/src/shaders/connectorMark.generated.ts +12 -0
- package/src/shaders/connectorMark.glsl.generated.ts +6 -0
- package/src/shaders/connectorMark.iface.generated.ts +1270 -0
- package/src/shaders/connectorMark.js.generated.ts +52 -0
- package/src/shaders/connectorMark.slang +287 -0
- package/src/shaders/connectorMark.wgsl.generated.ts +4 -0
- package/src/shaders/coverageBand.slang +10 -12
- package/src/shaders/coverageInterbase.glsl.generated.ts +1 -1
- package/src/shaders/coverageInterbase.slang +24 -21
- package/src/shaders/coverageInterbase.wgsl.generated.ts +1 -1
- package/src/shaders/coverageSnp.slang +1 -1
- package/src/shaders/curveDistance.js.generated.ts +112 -0
- package/src/shaders/curveDistance.slang +104 -1
- package/src/shaders/farDome.test.ts +117 -0
- package/src/shaders/hpClampFloor.test.ts +0 -4
- package/src/shaders/insertionGlyph.generated.ts +14 -0
- package/src/shaders/insertionGlyph.slang +59 -0
- package/src/shaders/lineCenterMark.glsl.generated.ts +2 -2
- package/src/shaders/lineCenterMark.iface.generated.ts +21 -18
- package/src/shaders/lineCenterMark.slang +19 -23
- package/src/shaders/lineCenterMark.wgsl.generated.ts +1 -1
- package/src/shaders/lineCommon.js.generated.ts +20 -0
- package/src/shaders/lineCommon.slang +18 -8
- package/src/shaders/lineStepMark.glsl.generated.ts +2 -2
- package/src/shaders/lineStepMark.iface.generated.ts +21 -18
- package/src/shaders/lineStepMark.slang +10 -6
- package/src/shaders/lineStepMark.wgsl.generated.ts +1 -1
- package/src/shaders/linkMark.consts.generated.ts +2 -0
- package/src/shaders/linkMark.glsl.generated.ts +2 -2
- package/src/shaders/linkMark.js.generated.ts +30 -4
- package/src/shaders/linkMark.slang +67 -24
- package/src/shaders/linkMark.wgsl.generated.ts +1 -1
- package/src/shaders/markColor.slang +10 -10
- package/src/shaders/pointMark.glsl.generated.ts +1 -1
- package/src/shaders/pointMark.iface.generated.ts +19 -16
- package/src/shaders/pointMark.slang +12 -8
- package/src/shaders/pointMark.wgsl.generated.ts +1 -1
- package/src/shaders/rowRect.slang +3 -3
- package/src/shaders/rowTable.slang +12 -8
- package/src/shaders/scoreScale.slang +1 -1
- package/src/shaders/spanMark.glsl.generated.ts +1 -1
- package/src/shaders/spanMark.slang +5 -5
- package/src/shaders/spanMark.wgsl.generated.ts +1 -1
- package/src/shaders/viewRegion.slang +13 -0
- package/esm/shaders/coverageIndicator.generated.js +0 -7
- package/esm/shaders/coverageIndicator.glsl.generated.d.ts +0 -2
- package/esm/shaders/coverageIndicator.glsl.generated.js +0 -4
- package/esm/shaders/coverageIndicator.iface.generated.d.ts +0 -85
- package/esm/shaders/coverageIndicator.iface.generated.js +0 -114
- package/esm/shaders/coverageIndicator.wgsl.generated.d.ts +0 -1
- package/esm/shaders/coverageIndicator.wgsl.generated.js +0 -3
- package/src/shaders/coverageIndicator.generated.ts +0 -11
- package/src/shaders/coverageIndicator.glsl.generated.ts +0 -6
- package/src/shaders/coverageIndicator.iface.generated.ts +0 -172
- package/src/shaders/coverageIndicator.slang +0 -61
- package/src/shaders/coverageIndicator.wgsl.generated.ts +0 -4
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
// How a mark shape's
|
|
2
|
-
// decided, or a raw value the frame's
|
|
1
|
+
// How a mark shape's color channel resolves: a packed ABGR the worker already
|
|
2
|
+
// decided, or a raw value the frame's color scale turns into one here.
|
|
3
3
|
//
|
|
4
4
|
// The two arms are the two places a scale can resolve, and the choice is the
|
|
5
5
|
// channel's cardinality rather than the shape's (ADR-094). A categorical or
|
|
6
|
-
// constant
|
|
6
|
+
// constant color is data and travels packed with the instance; a quantitative
|
|
7
7
|
// one is a value through a scale that moves with the loaded regions or with an
|
|
8
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
|
|
9
|
+
// up to MAX_COLOR_CUTS cut points and a color per interval for a threshold —
|
|
10
10
|
// and a pan that widens the domain or an edit that moves a cut uploads no
|
|
11
11
|
// instance bytes, the property `valueScale` already gives y.
|
|
12
12
|
//
|
|
13
|
-
// The value arrives in the instance's
|
|
14
|
-
// lane carries either the packed
|
|
13
|
+
// The value arrives in the instance's color slot, reinterpreted: one 4-byte
|
|
14
|
+
// lane carries either the packed color or the value's float32 bits, and
|
|
15
15
|
// `rampMode` says which. The packer's side of that is `colorBits`
|
|
16
16
|
// (marks/markRamp.ts), which views the encoder's `Float32Array` as the
|
|
17
|
-
// `Uint32Array` the attribute is declared as, so a quantitative
|
|
18
|
-
// lane to an instance and costs no bytes; a
|
|
17
|
+
// `Uint32Array` the attribute is declared as, so a quantitative color adds no
|
|
18
|
+
// lane to an instance and costs no bytes; a color over the plotted value
|
|
19
19
|
// itself is the `y` lane's bits, so it costs no lane in the payload either.
|
|
20
20
|
//
|
|
21
21
|
// `normalizeScore` is `scoreScale`'s, so a ramp's domain is read exactly as the
|
|
@@ -72,8 +72,8 @@ public int thresholdBand(float value, int cutCount, float4 cutsLo, float4 cutsHi
|
|
|
72
72
|
|
|
73
73
|
// The interval a fragment at `yPx` is in, given each cut's y in the band:
|
|
74
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
|
|
76
|
-
//
|
|
75
|
+
// cut's y. A line reads its color this way, so a rise across a cut changes
|
|
76
|
+
// color at the cut.
|
|
77
77
|
public int thresholdBandAtYPx(float yPx, int cutCount, float4 cutYsLo, float4 cutYsHi) {
|
|
78
78
|
int band = 0;
|
|
79
79
|
for (int i = 0; i < cutCount; i++) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
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"
|
|
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 triangleRadiusYPx_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 bool overridden_0;\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 p_0.overridden_0 = false;\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 bool _S32 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S32;\n\n vec4 _S33;\n if(_S32)\n {\n\n _S33 = c_2;\n\n }\n else\n {\n\n _S33 = _S30;\n\n }\n\n p_0.color_1 = _S33;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S34)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S34), 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 _S35 = 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(_S35.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 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_localPos = _S36.localPos_0;\n\n v_shape = _S36.shape_0;\n\n return;\n }\n\n float _S37 = bpToClipX_0(a_x);\n\n float _S38 = bpToClipX_0(a_x2);\n\n float yPx_1 = pointRowYPx_0(rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S35.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 = _S35.color_1;\n float centerClipX_1 = (_S37 + _S38) * 0.5;\n\n float x_2;\n if((u_0.rule_0) != 0)\n {\n\n float farClipX_0 = extendToMinWidthX_0(_S37, _S38, u_0.minWidthPx_0, u_0.viewportWidth_0);\n if(xZero_0)\n {\n\n x_2 = min(_S37, farClipX_0);\n\n }\n else\n {\n\n x_2 = max(_S37, 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 _S39;\n\n if(a_glyph == 3U)\n {\n\n _S39 = true;\n\n }\n else\n {\n\n if(a_glyph == 0U)\n {\n\n _S39 = (u_0.radiusPx_0 * 2.0) <= 3.0;\n\n }\n else\n {\n\n _S39 = false;\n\n }\n\n }\n\n if(_S39)\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 _S40 = 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 = _S40 * 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 unitYPx_0;\n\n if(a_glyph == 1U)\n {\n\n unitYPx_0 = u_0.triangleRadiusYPx_0;\n\n }\n else\n {\n\n unitYPx_0 = unitPx_1;\n\n }\n float _S41 = glyphExpand_0(unitPx_1, x_2, u_0.devicePixelRatio_0);\n float _S42 = glyphExpand_0(unitYPx_0, x_2, u_0.devicePixelRatio_0);\n\n vec2 expand_0 = vec2(_S41, _S42);\n\n\n\n o_0.position_0 = vec4(centerClipX_1 + pxToClipLen_0(local_0.x * unitPx_1 * _S41, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * unitYPx_0 * _S42, 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 _S43 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S43.color_0;\n\n v_localPos = _S43.localPos_0;\n\n v_shape = _S43.shape_0;\n\n return;\n}\n\n"
|
|
5
5
|
|
|
6
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"
|
|
@@ -28,11 +28,12 @@ export const UNIFORM_OFFSET_F32 = {
|
|
|
28
28
|
zero: 60,
|
|
29
29
|
viewportWidth: 61,
|
|
30
30
|
radiusPx: 62,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
triangleRadiusYPx: 63,
|
|
32
|
+
rowHeight: 64,
|
|
33
|
+
rowOffsetPx: 65,
|
|
34
|
+
insetPx: 67,
|
|
35
|
+
devicePixelRatio: 68,
|
|
36
|
+
minWidthPx: 71,
|
|
36
37
|
} as const
|
|
37
38
|
|
|
38
39
|
// Word indices into a Int32Array view over the uniform buffer.
|
|
@@ -40,9 +41,9 @@ export const UNIFORM_OFFSET_I32 = {
|
|
|
40
41
|
valueScaleType: 6,
|
|
41
42
|
rampMode: 8,
|
|
42
43
|
colorCutCount: 12,
|
|
43
|
-
reverse:
|
|
44
|
-
rowTableKeys:
|
|
45
|
-
rule:
|
|
44
|
+
reverse: 66,
|
|
45
|
+
rowTableKeys: 69,
|
|
46
|
+
rule: 70,
|
|
46
47
|
} as const
|
|
47
48
|
|
|
48
49
|
|
|
@@ -105,6 +106,7 @@ export interface Uniforms {
|
|
|
105
106
|
zero: number
|
|
106
107
|
viewportWidth: number
|
|
107
108
|
radiusPx: number
|
|
109
|
+
triangleRadiusYPx: number
|
|
108
110
|
rowHeight: number
|
|
109
111
|
rowOffsetPx: number
|
|
110
112
|
reverse: number
|
|
@@ -178,14 +180,15 @@ export function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms) {
|
|
|
178
180
|
f32[60] = uniforms.zero
|
|
179
181
|
f32[61] = uniforms.viewportWidth
|
|
180
182
|
f32[62] = uniforms.radiusPx
|
|
181
|
-
f32[63] = uniforms.
|
|
182
|
-
f32[64] = uniforms.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
f32[67] = uniforms.
|
|
186
|
-
|
|
187
|
-
i32[69] = uniforms.
|
|
188
|
-
|
|
183
|
+
f32[63] = uniforms.triangleRadiusYPx
|
|
184
|
+
f32[64] = uniforms.rowHeight
|
|
185
|
+
f32[65] = uniforms.rowOffsetPx
|
|
186
|
+
i32[66] = uniforms.reverse
|
|
187
|
+
f32[67] = uniforms.insetPx
|
|
188
|
+
f32[68] = uniforms.devicePixelRatio
|
|
189
|
+
i32[69] = uniforms.rowTableKeys
|
|
190
|
+
i32[70] = uniforms.rule
|
|
191
|
+
f32[71] = uniforms.minWidthPx
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
export const INSTANCE_STRIDE_BYTES = 24
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Each is a 6-vertex quad; the fragment shader carves the glyph.
|
|
8
8
|
//
|
|
9
9
|
// `row` is read through the bound row table, as `spanMark` reads it: a key
|
|
10
|
-
// resolved to its band and
|
|
10
|
+
// resolved to its band and color, or dropped off clip space where the table
|
|
11
11
|
// hides it. A pass binding no table (`rowTableKeys` −1) draws `row` as the band.
|
|
12
12
|
//! targets: wgsl, glsl
|
|
13
13
|
//! export-consts: DIAMOND_GLYPH_SCALE, DIAMOND_MITER_REACHES, TRIANGLE_MITER_REACHES, GLYPH_DISC, GLYPH_TRIANGLE, GLYPH_DIAMOND, GLYPH_SQUARE
|
|
@@ -42,20 +42,23 @@ struct Uniforms {
|
|
|
42
42
|
int valueScaleType;
|
|
43
43
|
// Already resolved from the domain (`resolveSymlogConstant`); read by symlog alone.
|
|
44
44
|
float valueSymlogConstant;
|
|
45
|
-
// `markColor`'s: 0 packs the instance's
|
|
45
|
+
// `markColor`'s: 0 packs the instance's color, 1 and 2 read its slot as a
|
|
46
46
|
// value through the ramp below.
|
|
47
47
|
int rampMode;
|
|
48
48
|
float rampMin;
|
|
49
49
|
float rampMax;
|
|
50
50
|
float rampMidNorm;
|
|
51
51
|
// `markColor`'s threshold: how many cuts are in use, the cuts four to a
|
|
52
|
-
// vector, and the
|
|
52
|
+
// vector, and the color of each interval between them.
|
|
53
53
|
int colorCutCount;
|
|
54
54
|
float4 colorCuts[2];
|
|
55
55
|
float4 colorBands[MAX_COLOR_BANDS];
|
|
56
56
|
float zero;
|
|
57
57
|
float viewportWidth;
|
|
58
58
|
float radiusPx;
|
|
59
|
+
// Half the triangle's height, which is `radiusPx` but where a mark draws a
|
|
60
|
+
// triangle wider than it is tall.
|
|
61
|
+
float triangleRadiusYPx;
|
|
59
62
|
// CSS px per row band, the value scale ruling each on its own; the canvas
|
|
60
63
|
// height where every instance is on row 0 (ADR-126).
|
|
61
64
|
float rowHeight;
|
|
@@ -101,7 +104,7 @@ static const float SHAPE_BAR = 3.0;
|
|
|
101
104
|
static const float INV_SQRT5 = 0.4472136;
|
|
102
105
|
// The diamond is the shape's "singled out" glyph and draws visibly larger than
|
|
103
106
|
// the others, so it reads as the one that matters at a glance rather than as a
|
|
104
|
-
//
|
|
107
|
+
// color swap. LocusZoom's lead-SNP convention, generalized.
|
|
105
108
|
static const float DIAMOND_GLYPH_SCALE = 1.6;
|
|
106
109
|
|
|
107
110
|
// How far past its boundary each glyph still inks where its quad binds, in ramp
|
|
@@ -180,10 +183,11 @@ VsOut vs_main(PointMarkInstance inst, uint vid : SV_VertexID) {
|
|
|
180
183
|
float unitPx = u.radiusPx * (diamond ? DIAMOND_GLYPH_SCALE : 1.0);
|
|
181
184
|
float reaches = inst.glyph == GLYPH_TRIANGLE ? TRIANGLE_MITER_REACHES
|
|
182
185
|
: (diamond ? DIAMOND_MITER_REACHES : 1.0);
|
|
183
|
-
float
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
float
|
|
186
|
+
float unitYPx = inst.glyph == GLYPH_TRIANGLE ? u.triangleRadiusYPx : unitPx;
|
|
187
|
+
float2 expand = float2(glyphExpand(unitPx, reaches, u.devicePixelRatio),
|
|
188
|
+
glyphExpand(unitYPx, reaches, u.devicePixelRatio));
|
|
189
|
+
float dx = pxToClipLen(local.x * unitPx * expand.x, u.viewportWidth);
|
|
190
|
+
float dy = pxToClipLen(local.y * unitYPx * expand.y, u.canvasHeight);
|
|
187
191
|
o.position = float4(centerClipX + dx, centerClipY + dy, 0.0, 1.0);
|
|
188
192
|
o.localPos = local * expand;
|
|
189
193
|
o.shape = inst.glyph == GLYPH_TRIANGLE ? SHAPE_TRI
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
3
|
|
|
4
|
-
export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) valueSymlogConstant_0 : f32,\n @align(16) rampMode_0 : i32,\n @align(4) rampMin_0 : f32,\n @align(8) rampMax_0 : f32,\n @align(4) rampMidNorm_0 : f32,\n @align(16) 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) zero_0 : f32,\n @align(4) viewportWidth_0 : f32,\n @align(8) radiusPx_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowOffsetPx_0 : f32,\n @align(4) reverse_0 : i32,\n @align(8) insetPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n @align(16) rowTableKeys_0 : i32,\n @align(4) rule_0 : i32,\n @align(8) minWidthPx_0 : f32,\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 quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\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 _S5 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S5 - mid_0)) / (2.0f * _S5), 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 _S6 : f32;\n if(i_0 < i32(4))\n {\n _S6 = cutsLo_0[i_0];\n }\n else\n {\n _S6 = cutsHi_0[i_0 - i32(4)];\n }\n return _S6;\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 _S7 : f32;\n if(u_1 == 1.0f)\n {\n _S7 = x_0;\n }\n else\n {\n _S7 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S7;\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 _S8 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S9 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S9;\n t_2 = _S8;\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 _S10 : f32 = log2(max(score_0, tMax_0));\n var _S11 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S11;\n t_2 = _S10;\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 _S12 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S12, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S13 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S13;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S14 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S14;\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 _S15 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S15) + 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 _S16 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S16.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S16.x)) | ((((byteOf_0(_S16.y)) << (u32(8))))))) | ((((byteOf_0(_S16.z)) << (u32(16))))));\n var _S17 : 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 _S18 : vec4<f32>;\n if((_S17.w) > 0.0f)\n {\n _S18 = _S17;\n }\n else\n {\n _S18 = own_0;\n }\n p_0.color_0 = _S18;\n return p_0;\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 hpToClipX_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 var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\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 valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_2 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, scaleType_2, symlogConstant_2)) * h_1;\n}\n\nfn insetValueYPx_0( value_3 : f32, domainMin_4 : f32, domainMax_4 : f32, h_2 : f32, scaleType_3 : i32, insetPx_1 : f32, symlogConstant_3 : f32) -> f32\n{\n var _S19 : f32 = min(insetPx_1, h_2 * 0.5f);\n return _S19 + valueToYPxScaled_0(value_3, domainMin_4, domainMax_4, h_2 - 2.0f * _S19, scaleType_3, symlogConstant_3);\n}\n\nfn pointYPx_0( value_4 : f32, domainMin_5 : f32, domainMax_5 : f32, h_3 : f32, scaleType_4 : i32, insetPx_2 : f32, symlogConstant_4 : f32) -> f32\n{\n return insetValueYPx_0(value_4, domainMin_5, domainMax_5, h_3, scaleType_4, insetPx_2, symlogConstant_4);\n}\n\nfn pointRowYPx_0( bandTop_0 : f32, h_4 : f32, reverse_1 : i32, valueYPx_0 : f32) -> f32\n{\n var _S20 : f32;\n if(reverse_1 != i32(0))\n {\n _S20 = h_4 - valueYPx_0;\n }\n else\n {\n _S20 = valueYPx_0;\n }\n return bandTop_0 + _S20;\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\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S21 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S21 = - minWidth_0;\n }\n else\n {\n _S21 = minWidth_0;\n }\n _S21 = x1_0 + _S21;\n }\n else\n {\n _S21 = x2_0;\n }\n return _S21;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\nfn clipXToPx_0( clipX_0 : f32, canvasWidth_1 : f32) -> f32\n{\n return (clipX_0 + 1.0f) * 0.5f * canvasWidth_1;\n}\n\nfn crispSquareTopLeftPx_0( centerPx_0 : f32, diameterPx_0 : f32) -> f32\n{\n return floor(centerPx_0 - diameterPx_0 * 0.5f + 0.5f);\n}\n\nfn crispSquareCornerPx_0( centerPx_1 : vec2<f32>, diameterPx_1 : f32, q_0 : vec2<f32>) -> vec2<f32>\n{\n return vec2<f32>(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * vec2<f32>(diameterPx_1);\n}\n\nfn pxToClipX_0( xPx_0 : f32, canvasWidth_2 : f32) -> f32\n{\n return xPx_0 / canvasWidth_2 * 2.0f - 1.0f;\n}\n\nfn crispSquareCornerClip_0( centerClipX_0 : f32, centerYPx_0 : f32, diameterPx_2 : f32, q_1 : vec2<f32>, viewportWidth_1 : f32, canvasHeight_2 : f32) -> vec4<f32>\n{\n var vPx_0 : vec2<f32> = crispSquareCornerPx_0(vec2<f32>(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4<f32>(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0f, 1.0f);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn glyphExpand_0( unitPx_0 : f32, reaches_0 : f32, dpr_2 : f32) -> f32\n{\n return 1.0f + reaches_0 * aaHalfPx_0(dpr_2) / max(unitPx_0, 0.00100000004749745f);\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n @location(2) localPos_0 : vec2<f32>,\n @interpolate(flat) @location(1) shape_0 : f32,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_1 : f32,\n @location(3) color_2 : u32,\n @location(4) glyph_0 : u32,\n @location(5) row_0 : u32,\n};\n\nfn markScaleColor_0( _S22 : texture_2d<f32>, _S23 : sampler, _S24 : u32, _S25 : i32, _S26 : f32, _S27 : f32, _S28 : f32, _S29 : i32, _S30 : vec4<f32>, _S31 : vec4<f32>) -> vec4<f32>\n{\n if(_S25 == i32(0))\n {\n return unpackRGBA_0(_S24);\n }\n if(_S24 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_5 : i32;\n if(((_S24 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S24 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S24 & (u32(2147483648)))) != u32(0);\n if(_S25 == i32(3))\n {\n if(negative_0)\n {\n scaleType_5 = i32(0);\n }\n else\n {\n scaleType_5 = _S29;\n }\n return u_0.colorBands_0[scaleType_5];\n }\n var _S32 : f32;\n if(negative_0)\n {\n _S32 = 0.0f;\n }\n else\n {\n _S32 = 1.0f;\n }\n return rampColor_0(_S22, _S23, rampMidT_0(_S32, _S28));\n }\n var value_5 : f32 = (bitcast<f32>((_S24)));\n if(_S25 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_5, _S29, _S30, _S31)];\n }\n if(_S25 == i32(2))\n {\n scaleType_5 = i32(1);\n }\n else\n {\n scaleType_5 = i32(0);\n }\n return rampColor_0(_S22, _S23, rampMidT_0(normalizeScore_0(value_5, _S26, _S27, scaleType_5, 1.0f), _S28));\n}\n\nfn bpToClipX_0( _S33 : u32) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(_S33), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n@vertex\nfn vs_main( _S34 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var q_2 : vec2<f32> = quadLocal_0(vid_1 % u32(6));\n var local_0 : vec2<f32> = q_2 * vec2<f32>(2.0f) - vec2<f32>(1.0f);\n var xZero_0 : bool = (q_2.x) < 0.5f;\n var o_0 : VsOut_0;\n var _S35 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S34.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S34.color_2, 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 if(_S35.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n o_0.localPos_0 = vec2<f32>(0.0f);\n o_0.shape_0 = 3.0f;\n return o_0;\n }\n var _S36 : f32 = bpToClipX_0(_S34.x_2);\n var _S37 : f32 = bpToClipX_0(_S34.x2_2);\n var yPx_1 : f32 = pointRowYPx_0(rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S35.slot_0), u_0.rowHeight_0, u_0.reverse_0, pointYPx_0(_S34.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 var centerClipY_0 : f32 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n o_0.color_1 = _S35.color_0;\n var centerClipX_1 : f32 = (_S36 + _S37) * 0.5f;\n var x_3 : f32;\n if((u_0.rule_0) != i32(0))\n {\n var farClipX_0 : f32 = extendToMinWidthX_0(_S36, _S37, u_0.minWidthPx_0, u_0.viewportWidth_0);\n if(xZero_0)\n {\n x_3 = min(_S36, farClipX_0);\n }\n else\n {\n x_3 = max(_S36, farClipX_0);\n }\n o_0.position_0 = vec4<f32>(x_3, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var _S38 : bool;\n if((_S34.glyph_0) == u32(3))\n {\n _S38 = true;\n }\n else\n {\n if((_S34.glyph_0) == u32(0))\n {\n _S38 = (u_0.radiusPx_0 * 2.0f) <= 3.0f;\n }\n else\n {\n _S38 = false;\n }\n }\n if(_S38)\n {\n o_0.position_0 = crispSquareCornerClip_0(centerClipX_1, yPx_1, u_0.radiusPx_0 * 2.0f, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var diamond_0 : bool = (_S34.glyph_0) == u32(2);\n var _S39 : f32 = u_0.radiusPx_0;\n if(diamond_0)\n {\n x_3 = 1.60000002384185791f;\n }\n else\n {\n x_3 = 1.0f;\n }\n var unitPx_1 : f32 = _S39 * x_3;\n var _S40 : bool = (_S34.glyph_0) == u32(1);\n if(_S40)\n {\n x_3 = 2.2360680103302002f;\n }\n else\n {\n if(diamond_0)\n {\n x_3 = 1.41421365737915039f;\n }\n else\n {\n x_3 = 1.0f;\n }\n }\n var expand_0 : f32 = glyphExpand_0(unitPx_1, x_3, u_0.devicePixelRatio_0);\n var halfPx_0 : f32 = unitPx_1 * expand_0;\n o_0.position_0 = vec4<f32>(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.0f, 1.0f);\n o_0.localPos_0 = local_0 * vec2<f32>(expand_0);\n if(_S40)\n {\n x_3 = 2.0f;\n }\n else\n {\n if(diamond_0)\n {\n x_3 = 1.0f;\n }\n else\n {\n x_3 = 0.0f;\n }\n }\n o_0.shape_0 = x_3;\n }\n }\n return o_0;\n}\n\nfn discCoverage_0( localPos_1 : vec2<f32>) -> f32\n{\n return 1.0f - length(localPos_1);\n}\n\nfn aaGradient_0( d_0 : f32) -> f32\n{\n return max(length(vec2<f32>(dpdx(d_0), dpdy(d_0))), 0.00000999999974738f);\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 glyphEdgeAlpha_0( coverage_0 : f32) -> f32\n{\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n @location(2) localPos_2 : vec2<f32>,\n @interpolate(flat) @location(1) shape_1 : f32,\n};\n\n@fragment\nfn fs_main( _S41 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var coverage_1 : f32;\n if((_S41.shape_1) > 2.5f)\n {\n coverage_1 = 1.0f;\n }\n else\n {\n if((_S41.shape_1) > 1.5f)\n {\n var _S42 : f32 = _S41.localPos_2.y;\n var _S43 : f32 = _S41.localPos_2.x;\n coverage_1 = min(1.0f - _S42, min((2.0f * _S43 + _S42 + 1.0f) * 0.44721359014511108f, (-2.0f * _S43 + _S42 + 1.0f) * 0.44721359014511108f));\n }\n else\n {\n if((_S41.shape_1) > 0.5f)\n {\n coverage_1 = 1.0f - (abs(_S41.localPos_2.x) + abs(_S41.localPos_2.y));\n }\n else\n {\n coverage_1 = discCoverage_0(_S41.localPos_2);\n }\n }\n }\n var alpha_0 : f32 = glyphEdgeAlpha_0(coverage_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S44 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S41.color_3.xyz, _S41.color_3.w * alpha_0) );\n return _S44;\n}\n\n"
|
|
4
|
+
export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) valueSymlogConstant_0 : f32,\n @align(16) rampMode_0 : i32,\n @align(4) rampMin_0 : f32,\n @align(8) rampMax_0 : f32,\n @align(4) rampMidNorm_0 : f32,\n @align(16) 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) zero_0 : f32,\n @align(4) viewportWidth_0 : f32,\n @align(8) radiusPx_0 : f32,\n @align(4) triangleRadiusYPx_0 : f32,\n @align(16) rowHeight_0 : f32,\n @align(4) rowOffsetPx_0 : f32,\n @align(8) reverse_0 : i32,\n @align(4) insetPx_0 : f32,\n @align(16) devicePixelRatio_0 : f32,\n @align(4) rowTableKeys_0 : i32,\n @align(8) rule_0 : i32,\n @align(4) minWidthPx_0 : f32,\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 quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\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 _S5 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S5 - mid_0)) / (2.0f * _S5), 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 _S6 : f32;\n if(i_0 < i32(4))\n {\n _S6 = cutsLo_0[i_0];\n }\n else\n {\n _S6 = cutsHi_0[i_0 - i32(4)];\n }\n return _S6;\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 _S7 : f32;\n if(u_1 == 1.0f)\n {\n _S7 = x_0;\n }\n else\n {\n _S7 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S7;\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 _S8 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S9 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S9;\n t_2 = _S8;\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 _S10 : f32 = log2(max(score_0, tMax_0));\n var _S11 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S11;\n t_2 = _S10;\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 _S12 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S12, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S13 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S13;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S14 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S14;\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 overridden_0 : bool,\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 p_0.overridden_0 = false;\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 _S15 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S15) + 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 _S16 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S16.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S16.x)) | ((((byteOf_0(_S16.y)) << (u32(8))))))) | ((((byteOf_0(_S16.z)) << (u32(16))))));\n var _S17 : 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 _S18 : bool = (_S17.w) > 0.0f;\n p_0.overridden_0 = _S18;\n var _S19 : vec4<f32>;\n if(_S18)\n {\n _S19 = _S17;\n }\n else\n {\n _S19 = own_0;\n }\n p_0.color_0 = _S19;\n return p_0;\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 hpToClipX_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 var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\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 valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_2 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, scaleType_2, symlogConstant_2)) * h_1;\n}\n\nfn insetValueYPx_0( value_3 : f32, domainMin_4 : f32, domainMax_4 : f32, h_2 : f32, scaleType_3 : i32, insetPx_1 : f32, symlogConstant_3 : f32) -> f32\n{\n var _S20 : f32 = min(insetPx_1, h_2 * 0.5f);\n return _S20 + valueToYPxScaled_0(value_3, domainMin_4, domainMax_4, h_2 - 2.0f * _S20, scaleType_3, symlogConstant_3);\n}\n\nfn pointYPx_0( value_4 : f32, domainMin_5 : f32, domainMax_5 : f32, h_3 : f32, scaleType_4 : i32, insetPx_2 : f32, symlogConstant_4 : f32) -> f32\n{\n return insetValueYPx_0(value_4, domainMin_5, domainMax_5, h_3, scaleType_4, insetPx_2, symlogConstant_4);\n}\n\nfn pointRowYPx_0( bandTop_0 : f32, h_4 : f32, reverse_1 : i32, valueYPx_0 : f32) -> f32\n{\n var _S21 : f32;\n if(reverse_1 != i32(0))\n {\n _S21 = h_4 - valueYPx_0;\n }\n else\n {\n _S21 = valueYPx_0;\n }\n return bandTop_0 + _S21;\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\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S22 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S22 = - minWidth_0;\n }\n else\n {\n _S22 = minWidth_0;\n }\n _S22 = x1_0 + _S22;\n }\n else\n {\n _S22 = x2_0;\n }\n return _S22;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\nfn clipXToPx_0( clipX_0 : f32, canvasWidth_1 : f32) -> f32\n{\n return (clipX_0 + 1.0f) * 0.5f * canvasWidth_1;\n}\n\nfn crispSquareTopLeftPx_0( centerPx_0 : f32, diameterPx_0 : f32) -> f32\n{\n return floor(centerPx_0 - diameterPx_0 * 0.5f + 0.5f);\n}\n\nfn crispSquareCornerPx_0( centerPx_1 : vec2<f32>, diameterPx_1 : f32, q_0 : vec2<f32>) -> vec2<f32>\n{\n return vec2<f32>(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * vec2<f32>(diameterPx_1);\n}\n\nfn pxToClipX_0( xPx_0 : f32, canvasWidth_2 : f32) -> f32\n{\n return xPx_0 / canvasWidth_2 * 2.0f - 1.0f;\n}\n\nfn crispSquareCornerClip_0( centerClipX_0 : f32, centerYPx_0 : f32, diameterPx_2 : f32, q_1 : vec2<f32>, viewportWidth_1 : f32, canvasHeight_2 : f32) -> vec4<f32>\n{\n var vPx_0 : vec2<f32> = crispSquareCornerPx_0(vec2<f32>(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4<f32>(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0f, 1.0f);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn glyphExpand_0( unitPx_0 : f32, reaches_0 : f32, dpr_2 : f32) -> f32\n{\n return 1.0f + reaches_0 * aaHalfPx_0(dpr_2) / max(unitPx_0, 0.00100000004749745f);\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n @location(2) localPos_0 : vec2<f32>,\n @interpolate(flat) @location(1) shape_0 : f32,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_1 : f32,\n @location(3) color_2 : u32,\n @location(4) glyph_0 : u32,\n @location(5) row_0 : u32,\n};\n\nfn markScaleColor_0( _S23 : texture_2d<f32>, _S24 : sampler, _S25 : u32, _S26 : i32, _S27 : f32, _S28 : f32, _S29 : f32, _S30 : i32, _S31 : vec4<f32>, _S32 : vec4<f32>) -> vec4<f32>\n{\n if(_S26 == i32(0))\n {\n return unpackRGBA_0(_S25);\n }\n if(_S25 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_5 : i32;\n if(((_S25 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S25 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S25 & (u32(2147483648)))) != u32(0);\n if(_S26 == i32(3))\n {\n if(negative_0)\n {\n scaleType_5 = i32(0);\n }\n else\n {\n scaleType_5 = _S30;\n }\n return u_0.colorBands_0[scaleType_5];\n }\n var _S33 : f32;\n if(negative_0)\n {\n _S33 = 0.0f;\n }\n else\n {\n _S33 = 1.0f;\n }\n return rampColor_0(_S23, _S24, rampMidT_0(_S33, _S29));\n }\n var value_5 : f32 = (bitcast<f32>((_S25)));\n if(_S26 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_5, _S30, _S31, _S32)];\n }\n if(_S26 == i32(2))\n {\n scaleType_5 = i32(1);\n }\n else\n {\n scaleType_5 = i32(0);\n }\n return rampColor_0(_S23, _S24, rampMidT_0(normalizeScore_0(value_5, _S27, _S28, scaleType_5, 1.0f), _S29));\n}\n\nfn bpToClipX_0( _S34 : u32) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(_S34), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n@vertex\nfn vs_main( _S35 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var q_2 : vec2<f32> = quadLocal_0(vid_1 % u32(6));\n var local_0 : vec2<f32> = q_2 * vec2<f32>(2.0f) - vec2<f32>(1.0f);\n var xZero_0 : bool = (q_2.x) < 0.5f;\n var o_0 : VsOut_0;\n var _S36 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S35.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S35.color_2, 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 if(_S36.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n o_0.localPos_0 = vec2<f32>(0.0f);\n o_0.shape_0 = 3.0f;\n return o_0;\n }\n var _S37 : f32 = bpToClipX_0(_S35.x_2);\n var _S38 : f32 = bpToClipX_0(_S35.x2_2);\n var yPx_1 : f32 = pointRowYPx_0(rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S36.slot_0), u_0.rowHeight_0, u_0.reverse_0, pointYPx_0(_S35.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 var centerClipY_0 : f32 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n o_0.color_1 = _S36.color_0;\n var centerClipX_1 : f32 = (_S37 + _S38) * 0.5f;\n var x_3 : f32;\n if((u_0.rule_0) != i32(0))\n {\n var farClipX_0 : f32 = extendToMinWidthX_0(_S37, _S38, u_0.minWidthPx_0, u_0.viewportWidth_0);\n if(xZero_0)\n {\n x_3 = min(_S37, farClipX_0);\n }\n else\n {\n x_3 = max(_S37, farClipX_0);\n }\n o_0.position_0 = vec4<f32>(x_3, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var _S39 : bool;\n if((_S35.glyph_0) == u32(3))\n {\n _S39 = true;\n }\n else\n {\n if((_S35.glyph_0) == u32(0))\n {\n _S39 = (u_0.radiusPx_0 * 2.0f) <= 3.0f;\n }\n else\n {\n _S39 = false;\n }\n }\n if(_S39)\n {\n o_0.position_0 = crispSquareCornerClip_0(centerClipX_1, yPx_1, u_0.radiusPx_0 * 2.0f, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var diamond_0 : bool = (_S35.glyph_0) == u32(2);\n var _S40 : f32 = u_0.radiusPx_0;\n if(diamond_0)\n {\n x_3 = 1.60000002384185791f;\n }\n else\n {\n x_3 = 1.0f;\n }\n var unitPx_1 : f32 = _S40 * x_3;\n var _S41 : bool = (_S35.glyph_0) == u32(1);\n if(_S41)\n {\n x_3 = 2.2360680103302002f;\n }\n else\n {\n if(diamond_0)\n {\n x_3 = 1.41421365737915039f;\n }\n else\n {\n x_3 = 1.0f;\n }\n }\n var unitYPx_0 : f32;\n if(_S41)\n {\n unitYPx_0 = u_0.triangleRadiusYPx_0;\n }\n else\n {\n unitYPx_0 = unitPx_1;\n }\n var _S42 : f32 = glyphExpand_0(unitPx_1, x_3, u_0.devicePixelRatio_0);\n var _S43 : f32 = glyphExpand_0(unitYPx_0, x_3, u_0.devicePixelRatio_0);\n var expand_0 : vec2<f32> = vec2<f32>(_S42, _S43);\n o_0.position_0 = vec4<f32>(centerClipX_1 + pxToClipLen_0(local_0.x * unitPx_1 * _S42, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * unitYPx_0 * _S43, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0 * expand_0;\n if(_S41)\n {\n x_3 = 2.0f;\n }\n else\n {\n if(diamond_0)\n {\n x_3 = 1.0f;\n }\n else\n {\n x_3 = 0.0f;\n }\n }\n o_0.shape_0 = x_3;\n }\n }\n return o_0;\n}\n\nfn discCoverage_0( localPos_1 : vec2<f32>) -> f32\n{\n return 1.0f - length(localPos_1);\n}\n\nfn aaGradient_0( d_0 : f32) -> f32\n{\n return max(length(vec2<f32>(dpdx(d_0), dpdy(d_0))), 0.00000999999974738f);\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 glyphEdgeAlpha_0( coverage_0 : f32) -> f32\n{\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n @location(2) localPos_2 : vec2<f32>,\n @interpolate(flat) @location(1) shape_1 : f32,\n};\n\n@fragment\nfn fs_main( _S44 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var coverage_1 : f32;\n if((_S44.shape_1) > 2.5f)\n {\n coverage_1 = 1.0f;\n }\n else\n {\n if((_S44.shape_1) > 1.5f)\n {\n var _S45 : f32 = _S44.localPos_2.y;\n var _S46 : f32 = _S44.localPos_2.x;\n coverage_1 = min(1.0f - _S45, min((2.0f * _S46 + _S45 + 1.0f) * 0.44721359014511108f, (-2.0f * _S46 + _S45 + 1.0f) * 0.44721359014511108f));\n }\n else\n {\n if((_S44.shape_1) > 0.5f)\n {\n coverage_1 = 1.0f - (abs(_S44.localPos_2.x) + abs(_S44.localPos_2.y));\n }\n else\n {\n coverage_1 = discCoverage_0(_S44.localPos_2);\n }\n }\n }\n var alpha_0 : f32 = glyphEdgeAlpha_0(coverage_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S47 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S44.color_3.xyz, _S44.color_3.w * alpha_0) );\n return _S47;\n}\n\n"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// The `span` mark draws exactly this for MAF (run-merged per-base cells) and
|
|
6
6
|
// the multi-row feature painter (features are already intervals), and wiggle
|
|
7
|
-
// density composes the same rect over a
|
|
7
|
+
// density composes the same rect over a color of its own.
|
|
8
8
|
//
|
|
9
9
|
// Row placement comes from uniforms rather than the instance data, so a
|
|
10
10
|
// rowHeight / rowProportion change re-renders without a refetch.
|
|
@@ -116,9 +116,9 @@ public RowBand rowBandPx(float rowHeight, float rowProportion) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// The shape's geometry alone — row band, hp clip-x span, min-width widening —
|
|
119
|
-
// so a consumer whose
|
|
119
|
+
// so a consumer whose color is not a per-instance packed value (wiggle
|
|
120
120
|
// density: a per-instance score through a uniform scale) composes the same
|
|
121
|
-
// rect without routing a resolved
|
|
121
|
+
// rect without routing a resolved color through the instance buffer.
|
|
122
122
|
// `rowIndex` is float here because the row transform is float arithmetic;
|
|
123
123
|
// each caller converts at its own boundary (`RowRectInstance` stores uint,
|
|
124
124
|
// wiggle's fill record stores float).
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// The row axis resolved on the GPU. An instance carries a stable row KEY in its
|
|
2
2
|
// `row` lane, and the pass binds a table mapping each key to the slot it is
|
|
3
|
-
// drawn on, or to hidden, with an optional
|
|
4
|
-
// focus, a hide or a
|
|
3
|
+
// drawn on, or to hidden, with an optional color override — so a reorder, a
|
|
4
|
+
// focus, a hide or a recolor uploads this table and no instance bytes, the
|
|
5
5
|
// property a y domain already has as a uniform (GRAMMAR_OF_GRAPHICS.md, rule 3).
|
|
6
6
|
//
|
|
7
7
|
// The table is an RGBA8 texture of two planes, one texel per key, keys wrapped
|
|
8
8
|
// onto rows of ROW_TABLE_MAX_WIDTH past it (the WebGL2 floor on a texture
|
|
9
9
|
// dimension). The slot plane holds the slot's low 24 bits in rgb and 255 in
|
|
10
|
-
// alpha where the key is drawn, 0 where it is hidden; the
|
|
10
|
+
// alpha where the key is drawn, 0 where it is hidden; the color plane below it
|
|
11
11
|
// holds the override, straight alpha, and alpha 0 where the instance keeps its
|
|
12
|
-
// own
|
|
12
|
+
// own color. `marks/rowTable.ts` writes it through the texel twins exported
|
|
13
13
|
// here, and is the painter's and hit test's reading of the same bytes.
|
|
14
14
|
//
|
|
15
15
|
// Sampled at texel centres with `SampleLevel`, never `Load`: this slangc emits
|
|
@@ -34,6 +34,8 @@ public struct RowPlacement {
|
|
|
34
34
|
public bool hidden;
|
|
35
35
|
public uint slot;
|
|
36
36
|
public float4 color;
|
|
37
|
+
// Whether `color` is the table's override rather than the instance's own.
|
|
38
|
+
public bool overridden;
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
public uint rowTableWidth(uint keys) {
|
|
@@ -49,7 +51,7 @@ public uint rowTableTexelX(uint key, uint keys) {
|
|
|
49
51
|
return key % rowTableWidth(keys);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
// The key's row in the slot plane; the
|
|
54
|
+
// The key's row in the slot plane; the color plane's is one plane height on.
|
|
53
55
|
public uint rowTableTexelY(uint key, uint keys) {
|
|
54
56
|
return key / rowTableWidth(keys);
|
|
55
57
|
}
|
|
@@ -64,8 +66,8 @@ uint byteOf(float channel) {
|
|
|
64
66
|
return uint(channel * 255.0 + 0.5);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
// The key's placement: its slot and
|
|
68
|
-
// or the identity — its `row` as the slot, its own
|
|
69
|
+
// The key's placement: its slot and color through the table of `keys` keys,
|
|
70
|
+
// or the identity — its `row` as the slot, its own color — where `keys` is
|
|
69
71
|
// negative, which is what a pass with no table binds.
|
|
70
72
|
public RowPlacement rowTableLookup(
|
|
71
73
|
Sampler2D<float4> table, uint key, int keys, float4 own
|
|
@@ -74,6 +76,7 @@ public RowPlacement rowTableLookup(
|
|
|
74
76
|
p.hidden = false;
|
|
75
77
|
p.slot = key;
|
|
76
78
|
p.color = own;
|
|
79
|
+
p.overridden = false;
|
|
77
80
|
if (keys < 0) {
|
|
78
81
|
return p;
|
|
79
82
|
}
|
|
@@ -93,6 +96,7 @@ public RowPlacement rowTableLookup(
|
|
|
93
96
|
}
|
|
94
97
|
p.slot = byteOf(s.r) | (byteOf(s.g) << 8) | (byteOf(s.b) << 16);
|
|
95
98
|
float4 c = table.SampleLevel(float2(u, (float(y + h) + 0.5) / rows), 0.0);
|
|
96
|
-
p.
|
|
99
|
+
p.overridden = c.a > 0.0;
|
|
100
|
+
p.color = p.overridden ? c : own;
|
|
97
101
|
return p;
|
|
98
102
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The score → [0,1] normalizer every score-scaled mark is placed and
|
|
1
|
+
// The score → [0,1] normalizer every score-scaled mark is placed and colored
|
|
2
2
|
// by — wiggle, the coverage band, the bar and point shapes, their ramps — and
|
|
3
3
|
// the scale-type vocabulary its branches switch on. `makeScoreNormalizer`
|
|
4
4
|
// (render-core's scoreScale.ts) is its loop-hoisted twin.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
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 minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_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}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_0, float domainMax_0, 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_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, 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_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\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_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\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_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, 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 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\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 _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_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\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (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_0 = ((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_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S30;\n if((c_2.w) > 0.0)\n {\n\n _S30 = c_2;\n\n }\n else\n {\n\n _S30 = _S28;\n\n }\n\n p_0.color_0 = _S30;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S31 = 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 RowRectVsOut_0 o_0;\n if(_S31.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S32 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S32.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S31.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S31.color_0;\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n}\n\n"
|
|
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 minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_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}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_0, float domainMax_0, 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_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, 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_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\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_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\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_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, 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 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\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 _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_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\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n p_0.overridden_0 = false;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (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_0 = ((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_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n bool _S30 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S30;\n\n vec4 _S31;\n if(_S30)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S28;\n\n }\n\n p_0.color_0 = _S31;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S32 = 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 RowRectVsOut_0 o_0;\n if(_S32.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S32.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S32.color_0;\n RowRectVsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_1;\n\n return;\n}\n\n"
|
|
5
5
|
|
|
6
6
|
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// The `span` mark shape: one instance is a
|
|
1
|
+
// The `span` mark shape: one instance is a colored rectangle spanning
|
|
2
2
|
// [x, x2) in absolute genomic coords, on the row band given by the `row`
|
|
3
3
|
// channel. The geometry — row band, hp clip-x span, min-width widening — is
|
|
4
4
|
// `rowRect`'s; this is the entry point that makes it a pass a mark can draw.
|
|
5
5
|
//
|
|
6
6
|
// `row` is read through the bound row table (`rowTable`): a key resolved to
|
|
7
|
-
// its drawn slot and
|
|
7
|
+
// its drawn slot and color, or collapsed to a zero-area quad off clip space
|
|
8
8
|
// where the table hides it. A pass binding no table (`rowTableKeys` −1) draws
|
|
9
9
|
// `row` as the slot, which is what every consumer did before the table.
|
|
10
10
|
//
|
|
11
|
-
// The
|
|
11
|
+
// The color slot is `markColor`'s: a packed ABGR, or under a ramp or a
|
|
12
12
|
// threshold the value's bits resolved here through the uniforms, which is
|
|
13
|
-
// what makes a span
|
|
13
|
+
// what makes a span colored by a field a heatmap whose domain moves as a
|
|
14
14
|
// uniform.
|
|
15
15
|
//! targets: wgsl, glsl
|
|
16
16
|
//! instance-writer
|
|
@@ -32,7 +32,7 @@ struct SpanMarkUniforms {
|
|
|
32
32
|
float rowProportion;
|
|
33
33
|
float scrollTop;
|
|
34
34
|
int rowTableKeys;
|
|
35
|
-
// `markColor`'s: 0 packs the instance's
|
|
35
|
+
// `markColor`'s: 0 packs the instance's color, 1 and 2 read its slot as a
|
|
36
36
|
// value through the ramp, 3 through the threshold below.
|
|
37
37
|
int rampMode;
|
|
38
38
|
float rampMin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
3
|
|
|
4
|
-
export const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\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};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_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_0 : f32, domainMax_0 : 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_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\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_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\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_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, 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 quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S15 : bool = v_0 == u32(0);\n var _S16 : bool;\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(2);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(3);\n }\n var _S17 : f32;\n if(_S16)\n {\n _S17 = 0.0f;\n }\n else\n {\n _S17 = 1.0f;\n }\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(1);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(4);\n }\n var _S18 : f32;\n if(_S16)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n return vec2<f32>(_S17, _S18);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\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 hpToClipX_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 var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S19 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S19 = - minWidth_0;\n }\n else\n {\n _S19 = minWidth_0;\n }\n _S19 = x1_0 + _S19;\n }\n else\n {\n _S19 = x2_0;\n }\n return _S19;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\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 RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S20 : texture_2d<f32>, _S21 : sampler, _S22 : u32, _S23 : i32, _S24 : f32, _S25 : f32, _S26 : f32, _S27 : i32, _S28 : vec4<f32>, _S29 : vec4<f32>) -> vec4<f32>\n{\n if(_S23 == i32(0))\n {\n return unpackRGBA_0(_S22);\n }\n if(_S22 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S22 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S22 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S22 & (u32(2147483648)))) != u32(0);\n if(_S23 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S27;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S30 : f32;\n if(negative_0)\n {\n _S30 = 0.0f;\n }\n else\n {\n _S30 = 1.0f;\n }\n return rampColor_0(_S20, _S21, rampMidT_0(_S30, _S26));\n }\n var value_2 : f32 = (bitcast<f32>((_S22)));\n if(_S23 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S27, _S28, _S29)];\n }\n if(_S23 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S20, _S21, rampMidT_0(normalizeScore_0(value_2, _S24, _S25, scaleType_2, 1.0f), _S26));\n}\n\n@vertex\nfn vs_main( _S31 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S32 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S31.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S31.color_2, 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 o_0 : RowRectVsOut_0;\n if(_S32.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S31.x_2, _S31.x2_2, f32(_S32.slot_0), vid_2, r_0);\n o_0.color_1 = _S32.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S33 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S34 : pixelOutput_0 = pixelOutput_0( _S33.color_3 );\n return _S34;\n}\n\n"
|
|
4
|
+
export const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\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};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_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_0 : f32, domainMax_0 : 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_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\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_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\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_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, 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 overridden_0 : bool,\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 p_0.overridden_0 = false;\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 : bool = (_S13.w) > 0.0f;\n p_0.overridden_0 = _S14;\n var _S15 : vec4<f32>;\n if(_S14)\n {\n _S15 = _S13;\n }\n else\n {\n _S15 = own_0;\n }\n p_0.color_0 = _S15;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S16 : bool = v_0 == u32(0);\n var _S17 : bool;\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(2);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(3);\n }\n var _S18 : f32;\n if(_S17)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(1);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(4);\n }\n var _S19 : f32;\n if(_S17)\n {\n _S19 = 0.0f;\n }\n else\n {\n _S19 = 1.0f;\n }\n return vec2<f32>(_S18, _S19);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\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 hpToClipX_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 var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S20 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S20 = - minWidth_0;\n }\n else\n {\n _S20 = minWidth_0;\n }\n _S20 = x1_0 + _S20;\n }\n else\n {\n _S20 = x2_0;\n }\n return _S20;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\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 RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S21 : texture_2d<f32>, _S22 : sampler, _S23 : u32, _S24 : i32, _S25 : f32, _S26 : f32, _S27 : f32, _S28 : i32, _S29 : vec4<f32>, _S30 : vec4<f32>) -> vec4<f32>\n{\n if(_S24 == i32(0))\n {\n return unpackRGBA_0(_S23);\n }\n if(_S23 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S23 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S23 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S23 & (u32(2147483648)))) != u32(0);\n if(_S24 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S28;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S31 : f32;\n if(negative_0)\n {\n _S31 = 0.0f;\n }\n else\n {\n _S31 = 1.0f;\n }\n return rampColor_0(_S21, _S22, rampMidT_0(_S31, _S27));\n }\n var value_2 : f32 = (bitcast<f32>((_S23)));\n if(_S24 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S28, _S29, _S30)];\n }\n if(_S24 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S21, _S22, rampMidT_0(normalizeScore_0(value_2, _S25, _S26, scaleType_2, 1.0f), _S27));\n}\n\n@vertex\nfn vs_main( _S32 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S33 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S32.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S32.color_2, 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 o_0 : RowRectVsOut_0;\n if(_S33.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S32.x_2, _S32.x2_2, f32(_S33.slot_0), vid_2, r_0);\n o_0.color_1 = _S33.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S34 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S35 : pixelOutput_0 = pixelOutput_0( _S34.color_3 );\n return _S35;\n}\n\n"
|