@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,6 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_1) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S31;\n if((c_2.w) > 0.0)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S29;\n\n }\n\n p_0.color_1 = _S31;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S32)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S33 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S33.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_0;\n\n v_barInkPx = _S34.barInkPx_0;\n\n return;\n }\n\n float _S35 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S35, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S33.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_barInkPx = _S36.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S38 = min(valueY_0, originY_0);\n float _S39 = max(valueY_0, originY_0);\n float vy_0 = mix(_S39 + padPx_0, _S38 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S33.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S38, vy_0 - _S39);\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_barInkPx = _S40.barInkPx_0;\n\n return;\n}\n\n"
|
|
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 originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n p_0.overridden_0 = false;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_1) + 0.5) / rows_0)), (0.0)));\n bool _S31 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S31;\n\n vec4 _S32;\n if(_S31)\n {\n\n _S32 = c_2;\n\n }\n else\n {\n\n _S32 = _S29;\n\n }\n\n p_0.color_1 = _S32;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S33)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S33), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S34 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S34.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S35 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S35.color_0;\n\n v_barInkPx = _S35.barInkPx_0;\n\n return;\n }\n\n float _S36 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S36, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S38 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S38.color_0;\n\n v_barInkPx = _S38.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S39 = min(valueY_0, originY_0);\n float _S40 = max(valueY_0, originY_0);\n float vy_0 = mix(_S40 + padPx_0, _S39 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S34.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S39, vy_0 - _S40);\n VsOut_0 _S41 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S41.color_0;\n\n v_barInkPx = _S41.barInkPx_0;\n\n return;\n}\n\n"
|
|
5
5
|
|
|
6
6
|
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n"
|
|
@@ -57,14 +57,14 @@ struct Uniforms {
|
|
|
57
57
|
int valueScaleType;
|
|
58
58
|
// Already resolved from the domain (`resolveSymlogConstant`); read by symlog alone.
|
|
59
59
|
float valueSymlogConstant;
|
|
60
|
-
// `markColor`'s: 0 packs the instance's
|
|
60
|
+
// `markColor`'s: 0 packs the instance's color, 1 and 2 read its slot as a
|
|
61
61
|
// value through the ramp below.
|
|
62
62
|
int rampMode;
|
|
63
63
|
float rampMin;
|
|
64
64
|
float rampMax;
|
|
65
65
|
float rampMidNorm;
|
|
66
66
|
// `markColor`'s threshold: how many cuts are in use, the cuts four to a
|
|
67
|
-
// vector, and the
|
|
67
|
+
// vector, and the color of each interval between them.
|
|
68
68
|
int colorCutCount;
|
|
69
69
|
float4 colorCuts[2];
|
|
70
70
|
float4 colorBands[MAX_COLOR_BANDS];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
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) originYPx_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(8) rowBandPx_0 : f32,\n @align(4) rowOffsetPx_0 : f32,\n @align(16) zero_0 : f32,\n @align(4) minCellDenomPx_0 : f32,\n @align(8) minWidthPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n @align(16) rowTableKeys_0 : i32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_2 : f32, domainMax_2 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn 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 _S15 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S15 = - minWidth_0;\n }\n else\n {\n _S15 = minWidth_0;\n }\n _S15 = x1_0 + _S15;\n }\n else\n {\n _S15 = x2_0;\n }\n return _S15;\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 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 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 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 barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn clipSide_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, scaleType_2 : i32) -> i32\n{\n var tolerance_0 : f32 = (domainMax_3 - domainMin_3) * 0.00000999999974738f;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n return i32(1);\n }\n var _S20 : bool;\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n _S20 = scaleType_2 != i32(1);\n }\n else\n {\n _S20 = false;\n }\n if(_S20)\n {\n return i32(-1);\n }\n return i32(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\nfn valueToYPxScaled_0( value_3 : f32, domainMin_4 : f32, domainMax_4 : f32, h_1 : f32, scaleType_3 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_1;\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<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) row_0 : 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_4 : 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_4 = i32(0);\n }\n else\n {\n scaleType_4 = _S28;\n }\n return u_0.colorBands_0[scaleType_4];\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_4 : f32 = (bitcast<f32>((_S23)));\n if(_S24 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_4, _S28, _S29, _S30)];\n }\n if(_S24 == i32(2))\n {\n scaleType_4 = i32(1);\n }\n else\n {\n scaleType_4 = i32(0);\n }\n return rampColor_0(_S21, _S22, rampMidT_0(normalizeScore_0(value_4, _S25, _S26, scaleType_4, 1.0f), _S27));\n}\n\nfn bpToClipX_0( _S32 : u32) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n@vertex\nfn vs_main( _S33 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var o_0 : VsOut_0;\n var _S34 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S33.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S33.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(_S34.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.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var _S35 : f32 = bpToClipX_0(_S33.x_2);\n var sx2_0 : f32 = extendToMinWidthX_0(_S35, bpToClipX_0(_S33.x2_2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var bandTop_0 : f32 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_0);\n var padPx_0 : f32 = barAaPx_0();\n if(vid_1 >= u32(6))\n {\n var side_0 : i32 = clipSide_0(_S33.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == i32(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.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var stripTop_0 : f32;\n if(side_0 > i32(0))\n {\n stripTop_0 = bandTop_0;\n }\n else\n {\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0f;\n }\n var stripBot_0 : f32 = stripTop_0 + 2.0f;\n var sy_0 : f32 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(unpackRGBA_0(u32(4280821958)).xyz, 1.0f);\n o_0.barInkPx_0 = vec2<f32>(sy_0 - stripTop_0, sy_0 - stripBot_0);\n return o_0;\n }\n var valueY_0 : f32 = bandTop_0 + valueToYPxScaled_0(_S33.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n var originY_0 : f32 = bandTop_0 + u_0.originYPx_0;\n var _S36 : f32 = min(valueY_0, originY_0);\n var _S37 : f32 = max(valueY_0, originY_0);\n var vy_0 : f32 = mix(_S37 + padPx_0, _S36 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = _S34.color_0;\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S36, vy_0 - _S37);\n return o_0;\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\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(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S38 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S38.barInkPx_1.x, aaPx_1) - aaRamp_0(_S38.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S39 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S38.color_3.xyz, _S38.color_3.w * alpha_0) );\n return _S39;\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) originYPx_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(8) rowBandPx_0 : f32,\n @align(4) rowOffsetPx_0 : f32,\n @align(16) zero_0 : f32,\n @align(4) minCellDenomPx_0 : f32,\n @align(8) minWidthPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n @align(16) rowTableKeys_0 : i32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_2 : f32, domainMax_2 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n 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 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 _S16 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S16 = - minWidth_0;\n }\n else\n {\n _S16 = minWidth_0;\n }\n _S16 = x1_0 + _S16;\n }\n else\n {\n _S16 = x2_0;\n }\n return _S16;\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 quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S17 : bool = v_0 == u32(0);\n var _S18 : bool;\n if(_S17)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(2);\n }\n if(_S18)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(3);\n }\n var _S19 : f32;\n if(_S18)\n {\n _S19 = 0.0f;\n }\n else\n {\n _S19 = 1.0f;\n }\n if(_S17)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(1);\n }\n if(_S18)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(4);\n }\n var _S20 : f32;\n if(_S18)\n {\n _S20 = 0.0f;\n }\n else\n {\n _S20 = 1.0f;\n }\n return vec2<f32>(_S19, _S20);\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 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 barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn clipSide_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, scaleType_2 : i32) -> i32\n{\n var tolerance_0 : f32 = (domainMax_3 - domainMin_3) * 0.00000999999974738f;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n return i32(1);\n }\n var _S21 : bool;\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n _S21 = scaleType_2 != i32(1);\n }\n else\n {\n _S21 = false;\n }\n if(_S21)\n {\n return i32(-1);\n }\n return i32(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\nfn valueToYPxScaled_0( value_3 : f32, domainMin_4 : f32, domainMax_4 : f32, h_1 : f32, scaleType_3 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_1;\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<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) 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_4 : 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_4 = i32(0);\n }\n else\n {\n scaleType_4 = _S29;\n }\n return u_0.colorBands_0[scaleType_4];\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_4 : f32 = (bitcast<f32>((_S24)));\n if(_S25 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_4, _S29, _S30, _S31)];\n }\n if(_S25 == i32(2))\n {\n scaleType_4 = i32(1);\n }\n else\n {\n scaleType_4 = i32(0);\n }\n return rampColor_0(_S22, _S23, rampMidT_0(normalizeScore_0(value_4, _S26, _S27, scaleType_4, 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 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.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var _S36 : f32 = bpToClipX_0(_S34.x_2);\n var sx2_0 : f32 = extendToMinWidthX_0(_S36, bpToClipX_0(_S34.x2_2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var bandTop_0 : f32 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S35.slot_0);\n var padPx_0 : f32 = barAaPx_0();\n if(vid_1 >= u32(6))\n {\n var side_0 : i32 = clipSide_0(_S34.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == i32(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.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var stripTop_0 : f32;\n if(side_0 > i32(0))\n {\n stripTop_0 = bandTop_0;\n }\n else\n {\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0f;\n }\n var stripBot_0 : f32 = stripTop_0 + 2.0f;\n var sy_0 : f32 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(unpackRGBA_0(u32(4280821958)).xyz, 1.0f);\n o_0.barInkPx_0 = vec2<f32>(sy_0 - stripTop_0, sy_0 - stripBot_0);\n return o_0;\n }\n var valueY_0 : f32 = bandTop_0 + valueToYPxScaled_0(_S34.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n var originY_0 : f32 = bandTop_0 + u_0.originYPx_0;\n var _S37 : f32 = min(valueY_0, originY_0);\n var _S38 : f32 = max(valueY_0, originY_0);\n var vy_0 : f32 = mix(_S38 + padPx_0, _S37 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = _S35.color_0;\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S37, vy_0 - _S38);\n return o_0;\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\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(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S39 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S39.barInkPx_1.x, aaPx_1) - aaRamp_0(_S39.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S40 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S39.color_3.xyz, _S39.color_3.w * alpha_0) );\n return _S40;\n}\n\n"
|
|
@@ -8,7 +8,7 @@ function _max(a: number, b: number) {
|
|
|
8
8
|
return b > a || Number.isNaN(a) ? b : a
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function capsuleDistPx(
|
|
12
|
-
let _t0 = _max((
|
|
11
|
+
export function capsuleDistPx(fromStartPx: number, fromEndPx: number, acrossPx: number): number {
|
|
12
|
+
let _t0 = _max(_max(-fromStartPx, -fromEndPx), 0.0)
|
|
13
13
|
return Math.sqrt(((_t0 * _t0) + (acrossPx * acrossPx)))
|
|
14
14
|
}
|
|
@@ -4,12 +4,19 @@
|
|
|
4
4
|
// tree. Consumers, and which half each takes:
|
|
5
5
|
// agent-docs/reference/SHADER_JS_CODEGEN.md.
|
|
6
6
|
//
|
|
7
|
-
// `
|
|
7
|
+
// `capsuleCorner` pads by exactly `aaHalfPx(dpr)` past the ink. Pad less and
|
|
8
8
|
// the ramp is clipped at the quad edge — coverage falls to 0.5 at the boundary,
|
|
9
9
|
// the rasterizer cuts it to 0, and the line reads a hard 50%-alpha edge about a
|
|
10
10
|
// pixel narrower than `lineWidth` asked for. Pad more and the surplus fragments
|
|
11
11
|
// shade to alpha 0.
|
|
12
12
|
//
|
|
13
|
+
// Every corner hangs off its own endpoint, and the fragment measures along the
|
|
14
|
+
// segment from each end rather than from the middle. A segment with one end on
|
|
15
|
+
// screen and the other 1e7 px away is ordinary in a zoomed-in dotplot or a
|
|
16
|
+
// linked read with a distant mate; anchored at the centre, its visible corners
|
|
17
|
+
// were `centre ± halfLen` with both terms at 1e7, and float32 put them pixels
|
|
18
|
+
// off. Off its endpoint, a visible corner is a small offset from a small number.
|
|
19
|
+
//
|
|
13
20
|
// The distance is Euclidean in CSS px, so |grad d| = 1 at every angle and the
|
|
14
21
|
// ramp is analytic rather than differentiated — which it has to be, since `d`
|
|
15
22
|
// comes off a clamp and the 2x2 quads straddling the cap/body junction would be
|
|
@@ -23,15 +30,10 @@ import hpmath;
|
|
|
23
30
|
|
|
24
31
|
// Below this length a segment has no direction to speak of and `delta / len`
|
|
25
32
|
// is 0/0. Any positive threshold under a visible fraction of a pixel behaves
|
|
26
|
-
// the same
|
|
27
|
-
// and `1e-4` in the two others, and takes the majority spelling, which is also
|
|
28
|
-
// the one leaving the fallback the smallest reach.
|
|
33
|
+
// the same: at that length the mark IS its cap.
|
|
29
34
|
public static const float CAPSULE_MIN_LEN_PX = 1e-4;
|
|
30
35
|
|
|
31
|
-
// The segment's own frame — x along it, y across it.
|
|
32
|
-
// what lets the butt-capped linkedReadLine orient its diagonal through it. The
|
|
33
|
-
// degenerate guard exists only to keep a zero-length segment's 0/0 out of the
|
|
34
|
-
// frame.
|
|
36
|
+
// The segment's own frame — x along it, y across it.
|
|
35
37
|
public struct CapsuleFrame {
|
|
36
38
|
public float2 tangent;
|
|
37
39
|
public float2 normal;
|
|
@@ -44,27 +46,70 @@ public CapsuleFrame capsuleFrame(float2 delta, float len) {
|
|
|
44
46
|
return f;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
// Quad corner `vid`
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
// Quad corner `vid` of the segment p1 -> p1 + deltaPx, grown by `alongPadPx`
|
|
50
|
+
// past each end and `acrossPadPx` either side. The caller places it at
|
|
51
|
+
// `(atEnd ? p2 : p1) + offsetPx` in whatever space it holds the endpoints in.
|
|
52
|
+
// `local` is (along from p1, along back from p2, across), the varying
|
|
53
|
+
// `capsuleDist` and `buttSegmentCoverage` read; both along terms are positive
|
|
54
|
+
// over the body and the larger one is never consulted.
|
|
55
|
+
public struct SegmentCorner {
|
|
56
|
+
public bool atEnd;
|
|
57
|
+
public float2 offsetPx;
|
|
58
|
+
public float3 local;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
public SegmentCorner segmentCorner(
|
|
62
|
+
uint vid, float2 deltaPx, float alongPadPx, float acrossPadPx
|
|
52
63
|
) {
|
|
53
|
-
float
|
|
64
|
+
float len = length(deltaPx);
|
|
65
|
+
CapsuleFrame f = capsuleFrame(deltaPx, len);
|
|
54
66
|
float2 q = quadLocal(vid) * 2.0 - 1.0;
|
|
55
|
-
|
|
67
|
+
float across = q.y * acrossPadPx;
|
|
68
|
+
SegmentCorner c;
|
|
69
|
+
c.atEnd = q.x > 0.0;
|
|
70
|
+
c.offsetPx = f.tangent * (q.x * alongPadPx) + f.normal * across;
|
|
71
|
+
float far = len + alongPadPx;
|
|
72
|
+
c.local = c.atEnd
|
|
73
|
+
? float3(far, -alongPadPx, across)
|
|
74
|
+
: float3(-alongPadPx, far, across);
|
|
75
|
+
return c;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// The round-capped stroke's corner: the cap is a half-width, so the pad is the
|
|
79
|
+
// same on both axes.
|
|
80
|
+
public SegmentCorner capsuleCorner(
|
|
81
|
+
uint vid, float2 deltaPx, float halfWidthPx, float dpr
|
|
82
|
+
) {
|
|
83
|
+
float ext = halfWidthPx + aaHalfPx(dpr);
|
|
84
|
+
return segmentCorner(vid, deltaPx, ext, ext);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The butt-capped stroke, which is what Canvas2D's default lineCap draws: the
|
|
88
|
+
// ink stops at each endpoint, so the pad along is the ramp's reach alone.
|
|
89
|
+
public SegmentCorner buttSegmentCorner(
|
|
90
|
+
uint vid, float2 deltaPx, float halfWidthPx, float dpr
|
|
91
|
+
) {
|
|
92
|
+
float aa = aaHalfPx(dpr);
|
|
93
|
+
return segmentCorner(vid, deltaPx, aa, halfWidthPx + aa);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Box-filter coverage of a rectangle separates per axis, so the product is
|
|
97
|
+
// exact and the ends are exactly as soft as the sides.
|
|
98
|
+
public float buttSegmentCoverage(float3 local, float halfWidthPx, float dpr) {
|
|
99
|
+
return edgeCoverage(halfWidthPx - abs(local.z), dpr)
|
|
100
|
+
* edgeCoverage(min(local.x, local.y), dpr);
|
|
56
101
|
}
|
|
57
102
|
|
|
58
|
-
// CSS-px distance from a point
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
// the
|
|
63
|
-
public float capsuleDistPx(float
|
|
64
|
-
float beyond = max(
|
|
103
|
+
// CSS-px distance from a point to the segment, given how far along it the
|
|
104
|
+
// point is from each end. A degenerate segment collapses to the distance from
|
|
105
|
+
// its one point — the circular dot of radius halfWidth. Scalar so
|
|
106
|
+
// `//! js-export` can lift it: the dotplot's pick measures the cursor against
|
|
107
|
+
// the same capsule the fragment inks, end caps included.
|
|
108
|
+
public float capsuleDistPx(float fromStartPx, float fromEndPx, float acrossPx) {
|
|
109
|
+
float beyond = max(max(-fromStartPx, -fromEndPx), 0.0);
|
|
65
110
|
return sqrt(beyond * beyond + acrossPx * acrossPx);
|
|
66
111
|
}
|
|
67
112
|
|
|
68
|
-
public float capsuleDist(
|
|
69
|
-
return capsuleDistPx(local.x, local.y,
|
|
113
|
+
public float capsuleDist(float3 local) {
|
|
114
|
+
return capsuleDistPx(local.x, local.y, local.z);
|
|
70
115
|
}
|
|
@@ -10,7 +10,7 @@ module clipStrip;
|
|
|
10
10
|
import scoreScale;
|
|
11
11
|
|
|
12
12
|
public static const float CLIP_STRIP_PX = 2.0;
|
|
13
|
-
// #c62828, packed ABGR as every instance
|
|
13
|
+
// #c62828, packed ABGR as every instance color is: a red a shade darker than
|
|
14
14
|
// the coverage band's hard-clip triangles, which stand just above the strip.
|
|
15
15
|
public static const uint CLIP_STRIP_COLOR = 0xFF2828C6u;
|
|
16
16
|
|
|
@@ -15,10 +15,10 @@ module colorPack;
|
|
|
15
15
|
//
|
|
16
16
|
// Declare such a palette as `float4[N]` instead — a vector element needs no
|
|
17
17
|
// wrapper struct, lowers correctly, AND costs the same 16 bytes per slot that
|
|
18
|
-
// std140 was padding the uint to anyway, so packing one
|
|
18
|
+
// std140 was padding the uint to anyway, so packing one color per element
|
|
19
19
|
// bought nothing here. FOUR to a `uint4` element, read as `p[i >> 2][i & 3]`,
|
|
20
20
|
// does compile and does save — it is the only form that beats the padding — and
|
|
21
|
-
// on alignments' 23-
|
|
21
|
+
// on alignments' 23-color palette it was measured and declined:
|
|
22
22
|
// agent-docs/reference/ARCHITECTURAL_LIMITS.md §"The uniform ring". Packing
|
|
23
23
|
// still earns its keep in VERTEX ATTRIBUTES, which is what this is for.
|
|
24
24
|
public float4 unpackRGBA(uint c) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Sampling a 256×1
|
|
1
|
+
// Sampling a 256×1 color-ramp LUT texture by a [0,1] scalar — the mechanism
|
|
2
2
|
// HiC's contact map and both LD heatmap variants reached independently, down to
|
|
3
3
|
// the binding slot, and wiggle density's third spelling. The module owns ONLY
|
|
4
|
-
// the sampling: each consumer keeps its own scale (`
|
|
5
|
-
//
|
|
4
|
+
// the sampling: each consumer keeps its own scale (`normalizeScore` for all
|
|
5
|
+
// three, LD adding its `ldValueComputed` sentinel gate and wiggle its
|
|
6
6
|
// `densityGradientT`) and declares its own `[[vk::binding(2, 0)]]
|
|
7
7
|
// Sampler2D<float4> colorRamp;` — a module can take a sampler as a parameter
|
|
8
8
|
// but not declare the binding for its importer, and inherits the `linear`
|
|
@@ -27,7 +27,7 @@ module colorRampLut;
|
|
|
27
27
|
// Where a normalized value `t` reads the ramp when its middle stop sits at
|
|
28
28
|
// `mid`: both sides of the middle on one scale, the farther end reaching its
|
|
29
29
|
// end stop and the nearer stopping short, so equal distances from the middle
|
|
30
|
-
// take equal
|
|
30
|
+
// take equal colors — ggplot2's `rescale_mid`. A `mid` of 0.5 reads `t`
|
|
31
31
|
// itself, exactly, so a ramp with no middle declared reads its table as it
|
|
32
32
|
// always did, and a moving domain moves one uniform and no table.
|
|
33
33
|
public float rampMidT(float t, float mid) {
|
|
@@ -40,12 +40,12 @@ public float rampMidT(float t, float mid) {
|
|
|
40
40
|
// and sampled by another is a half-shade of drift at every entry.
|
|
41
41
|
public static const float RAMP_LUT_ENTRIES = 256.0;
|
|
42
42
|
|
|
43
|
-
// The
|
|
43
|
+
// The color at `t` in [0, 1], straight (non-premultiplied) alpha. Sampled at
|
|
44
44
|
// the texture's vertical center, mip level 0 — the ramp has no other row and no
|
|
45
45
|
// other level.
|
|
46
46
|
//
|
|
47
47
|
// `t` is remapped into texel space rather than passed through. The builder
|
|
48
|
-
// defines entry i as the
|
|
48
|
+
// defines entry i as the color at `i / (N - 1)`, while a linear-filtered
|
|
49
49
|
// texture puts entry i's center at `(i + 0.5) / N`, so sampling at `t` returns
|
|
50
50
|
// a blend of two neighbours at every entry but the ends — half a step off the
|
|
51
51
|
// table the Canvas2D and SVG twins index. `clamp` lands an out-of-range scalar
|
|
@@ -55,7 +55,7 @@ public float4 rampColor(Sampler2D<float4> ramp, float t) {
|
|
|
55
55
|
return ramp.SampleLevel(float2(u, 0.5), 0.0);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// The same sample with its
|
|
58
|
+
// The same sample with its color multiplied through its alpha, for a fragment
|
|
59
59
|
// returned under `//! blend: premultiplied`. Alpha itself is unchanged, so a
|
|
60
60
|
// consumer's own alpha test (HiC's MIN_VISIBLE_ALPHA discard) reads the same
|
|
61
61
|
// number either side of this call.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from connectorMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
|
|
4
|
+
export const CONNECTOR_CURVE_SEGMENTS = 48
|
|
5
|
+
|
|
6
|
+
export const CONNECTOR_BOW = -1e+30
|
|
7
|
+
|
|
8
|
+
export const CONNECTOR_MAX_REACH_PX = 110
|
|
9
|
+
|
|
10
|
+
export const CONNECTOR_APEX_RATIO = 0.75
|
|
11
|
+
|
|
12
|
+
export const CONNECTOR_MAX_HANDLE_PX = 200
|
|
13
|
+
|
|
14
|
+
export const CONNECTOR_MINUS_1 = 1
|
|
15
|
+
|
|
16
|
+
export const CONNECTOR_MINUS_2 = 2
|
|
17
|
+
|
|
18
|
+
export const CONNECTOR_LEADING_2 = 4
|
|
19
|
+
|
|
20
|
+
export const CONNECTOR_STRAIGHT = 8
|
|
21
|
+
|
|
22
|
+
export const CONNECTOR_DASHED = 16
|
|
23
|
+
|
|
24
|
+
export const CONNECTOR_ARROW = 32
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from connectorMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
|
|
4
|
+
import type { ShaderSource } from '@jbrowse/render-core/hal'
|
|
5
|
+
|
|
6
|
+
export * from './connectorMark.iface.generated.ts'
|
|
7
|
+
export * from './connectorMark.consts.generated.ts'
|
|
8
|
+
|
|
9
|
+
export const SOURCE: ShaderSource = {
|
|
10
|
+
wgsl: () => import('./connectorMark.wgsl.generated.ts'),
|
|
11
|
+
glsl: () => import('./connectorMark.glsl.generated.ts'),
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from connectorMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
|
|
4
|
+
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\n\n\n\nlayout(std140) uniform Uniforms\n{\n float canvasHeight_0;\n float canvasWidth_0;\n float devicePixelRatio_0;\n float rowOffsetPx_0;\n float rowPitchPx_0;\n float maxHandlePx_0;\n float dashPx_0;\n float gapPx_0;\n float arrowPx_0;\n uint regionCount_0;\n float zero_0;\n vec4 ownEntry_0;\n vec4 regionTable_0[256];\n}u_0;\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpViewportOffsetBp_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n\n\n return max(bpRange_0.x - splitPos_0.x, floorBp_0) + max(bpRange_0.y - splitPos_0.y, floorBp_0);\n}\n\n\nfloat viewRegionPx_0(uint bp_0, vec4 r_0, float hpZero_1)\n{\n\n return r_0.x - hpViewportOffsetBp_0(hpSplitUint_0(bp_0), vec3(r_0.y, r_0.z, 0.0), hpZero_1) * r_0.w;\n}\n\n\nfloat connectorBudgetPx_0(float dx_0, float dy_0)\n{\n\n float _S1 = min(abs(dy_0), 150.0);\n return sqrt(dx_0 * dx_0 + _S1 * _S1) * 0.30000001192092896;\n}\n\nfloat connectorHandlePx_0(float budget_0, float maxHandlePx_1)\n{\n\n return min(maxHandlePx_1, budget_0);\n}\n\n\n\n\nfloat connectorLiftPx_0(float budget_1, float dy_1, float bend_0)\n{\n\n float _S2;\n\n if(bend_0 < -1.00000001504746622e+29)\n {\n\n _S2 = min(budget_1, max(0.0, 30.0 - abs(dy_1)));\n\n }\n else\n {\n\n _S2 = - min(bend_0, 110.0) / 0.75;\n\n }\n\n return _S2;\n}\n\n\nfloat bitSet_0(uint bits_0, uint bit_0)\n{\n\n float _S3;\n if((bits_0 & bit_0) != 0U)\n {\n\n _S3 = 1.0;\n\n }\n else\n {\n\n _S3 = 0.0;\n\n }\n\n return _S3;\n}\n\n\nfloat connectorTangent_0(float strand_0, float leading_0, float reversed_0)\n{\n\n float _S4;\n if(leading_0 != 0.0)\n {\n\n _S4 = -1.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n float _S5 = strand_0 * _S4;\n\n if(reversed_0 != 0.0)\n {\n\n _S4 = -1.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return _S5 * _S4;\n}\n\n\nstruct Cubic_0\n{\n vec2 p0_0;\n vec2 p1_0;\n vec2 p2_0;\n vec2 p3_0;\n};\n\n\nstruct ConnectorInstance_0\n{\n uint x_0;\n uint x2_0;\n uint x2Region_0;\n uint row_0;\n uint row2_0;\n float bend_1;\n float width_0;\n uint color_0;\n uint bits_1;\n};\n\n\nCubic_0 placeCubic_0(ConnectorInstance_0 inst_0, vec4 entry2_0)\n{\n\n Cubic_0 c_0;\n c_0.p0_0 = vec2(viewRegionPx_0(inst_0.x_0, u_0.ownEntry_0, u_0.zero_0), u_0.rowOffsetPx_0 + float(inst_0.row_0) * u_0.rowPitchPx_0);\n\n c_0.p3_0 = vec2(viewRegionPx_0(inst_0.x2_0, entry2_0, u_0.zero_0), u_0.rowOffsetPx_0 + float(inst_0.row2_0) * u_0.rowPitchPx_0);\n\n if(((inst_0.bits_1) & 8U) != 0U)\n {\n\n c_0.p1_0 = c_0.p0_0;\n c_0.p2_0 = c_0.p3_0;\n return c_0;\n }\n vec2 d_0 = c_0.p3_0 - c_0.p0_0;\n float _S6 = d_0.y;\n\n float budget_2 = connectorBudgetPx_0(d_0.x, _S6);\n float handle_0 = connectorHandlePx_0(budget_2, u_0.maxHandlePx_0);\n float lift_0 = connectorLiftPx_0(budget_2, _S6, inst_0.bend_1);\n float _S7 = 1.0 - 2.0 * bitSet_0(inst_0.bits_1, 1U);\n\n float _S8;\n if((u_0.ownEntry_0.w) < 0.0)\n {\n\n _S8 = 1.0;\n\n }\n else\n {\n\n _S8 = 0.0;\n\n }\n\n float t1_0 = connectorTangent_0(_S7, 0.0, _S8);\n\n float _S9 = 1.0 - 2.0 * bitSet_0(inst_0.bits_1, 2U);\n float _S10 = bitSet_0(inst_0.bits_1, 4U);\n if((entry2_0.w) < 0.0)\n {\n\n _S8 = 1.0;\n\n }\n else\n {\n\n _S8 = 0.0;\n\n }\n\n float t2_0 = connectorTangent_0(_S9, _S10, _S8);\n\n\n c_0.p1_0 = vec2(c_0.p0_0.x + handle_0 * t1_0, c_0.p0_0.y - lift_0);\n c_0.p2_0 = vec2(c_0.p3_0.x + handle_0 * t2_0, c_0.p3_0.y - lift_0);\n return c_0;\n}\n\n\nfloat connectorStrokePx_0(float width_1, float dpr_0)\n{\n\n return max(width_1, 1.5 / dpr_0);\n}\n\n\nfloat aaPx_0(float dpr_1)\n{\n\n return 1.0 / max(dpr_1, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_2)\n{\n\n return 0.5 * aaPx_0(dpr_2);\n}\n\n\nvec2 cubicDirection_0(Cubic_0 c_1, float t_0)\n{\n\n float s_0 = 1.0 - t_0;\n\n vec2 d_1 = 3.0 * s_0 * s_0 * (c_1.p1_0 - c_1.p0_0) + 6.0 * s_0 * t_0 * (c_1.p2_0 - c_1.p1_0) + 3.0 * t_0 * t_0 * (c_1.p3_0 - c_1.p2_0);\n float len_0 = length(d_1);\n if(len_0 > 9.99999997475242708e-07)\n {\n\n return d_1 / len_0;\n }\n\n vec2 chord_0 = c_1.p3_0 - c_1.p0_0;\n float chordLen_0 = length(chord_0);\n\n vec2 _S11;\n if(chordLen_0 > 9.99999997475242708e-07)\n {\n\n _S11 = chord_0 / chordLen_0;\n\n }\n else\n {\n\n _S11 = vec2(1.0, 0.0);\n\n }\n\n return _S11;\n}\n\n\nvec2 cubicAt_0(Cubic_0 c_2, float t_1)\n{\n\n float s_1 = 1.0 - t_1;\n float _S12 = 3.0 * s_1;\n\n return s_1 * s_1 * s_1 * c_2.p0_0 + _S12 * s_1 * t_1 * c_2.p1_0 + _S12 * t_1 * t_1 * c_2.p2_0 + t_1 * t_1 * t_1 * c_2.p3_0;\n}\n\n\nfloat lengthTo_0(Cubic_0 c_3, uint seg_0)\n{\n\n vec2 prev_0 = c_3.p0_0;\n\n uint k_0 = 1U;\n\n float total_0 = 0.0;\n\n\n for(;;)\n {\n\n if(k_0 <= seg_0)\n {\n }\n else\n {\n\n break;\n }\n\n vec2 next_0 = cubicAt_0(c_3, float(k_0) / 48.0);\n float total_1 = total_0 + length(next_0 - prev_0);\n\n uint _S13 = k_0 + 1U;\n\n prev_0 = next_0;\n\n k_0 = _S13;\n\n total_0 = total_1;\n\n }\n\n return total_0;\n}\n\nstruct StripVertex_0\n{\n vec2 screen_0;\n float across_0;\n float along_0;\n};\n\n\nStripVertex_0 curveVertex_0(Cubic_0 c_4, uint seg_1, float side_0, float hw_0, bool dashed_0)\n{\n\n float t_2 = float(seg_1) / 48.0;\n vec2 dir_0 = cubicDirection_0(c_4, t_2);\n StripVertex_0 v_0;\n float _S14 = side_0 * hw_0;\n\n v_0.across_0 = _S14;\n v_0.screen_0 = cubicAt_0(c_4, t_2) + vec2(- dir_0.y, dir_0.x) * _S14;\n\n float _S15;\n if(dashed_0)\n {\n\n _S15 = lengthTo_0(c_4, seg_1);\n\n }\n else\n {\n\n _S15 = 0.0;\n\n }\n\n v_0.along_0 = _S15;\n return v_0;\n}\n\n\n\nvec2 armEnd_0(Cubic_0 c_5, uint a_0, float strand2_0, bool reversed2_0)\n{\n\n float _S16;\n if(reversed2_0)\n {\n\n _S16 = - strand2_0;\n\n }\n else\n {\n\n _S16 = strand2_0;\n\n }\n\n float back_0 = _S16 * - u_0.arrowPx_0;\n if(a_0 == 0U)\n {\n\n _S16 = - u_0.arrowPx_0;\n\n }\n else\n {\n\n _S16 = u_0.arrowPx_0;\n\n }\n\n return c_5.p3_0 + vec2(back_0, _S16);\n}\n\nStripVertex_0 armCorner_0(Cubic_0 c_6, uint a_1, uint corner_0, float hw_1, float strand2_1, bool reversed2_1)\n{\n vec2 axis_0 = armEnd_0(c_6, a_1, strand2_1, reversed2_1) - c_6.p3_0;\n float _S17 = max(length(axis_0), 9.99999997475242708e-07);\n vec2 dir_1 = axis_0 / _S17;\n StripVertex_0 v_1;\n\n float at_0;\n if((corner_0 % 2U) == 0U)\n {\n\n at_0 = - hw_1;\n\n }\n else\n {\n\n at_0 = hw_1;\n\n }\n\n v_1.across_0 = at_0;\n v_1.along_0 = 0.0;\n if(corner_0 >= 2U)\n {\n\n at_0 = _S17;\n\n }\n else\n {\n\n at_0 = 0.0;\n\n }\n v_1.screen_0 = c_6.p3_0 + dir_1 * at_0 + vec2(- dir_1.y, dir_1.x) * v_1.across_0;\n return v_1;\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\nvec4 unpackRGBA_0(uint c_7)\n{\n\n return vec4(float((c_7 >> 0U) & 255U), float((c_7 >> 8U) & 255U), float((c_7 >> 16U) & 255U), float((c_7 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout float v_across;\n\n\nout float v_along;\n\n\nflat out float v_halfWidthPx;\n\n\nflat out float v_dashed;\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_x2Region;\n\n\nlayout(location = 3)\nin uint a_row;\n\n\nlayout(location = 4)\nin uint a_row2;\n\n\nlayout(location = 5)\nin float a_bend;\n\n\nlayout(location = 6)\nin float a_width;\n\n\nlayout(location = 7)\nin uint a_color;\n\n\nlayout(location = 8)\nin uint a_bits;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n float across_1;\n float along_1;\n float halfWidthPx_0;\n float dashed_1;\n};\n\n\nvoid main()\n{\n\n bool placed_0 = a_x2Region < (u_0.regionCount_0);\n\n ConnectorInstance_0 _S18 = ConnectorInstance_0(a_x, a_x2, a_x2Region, a_row, a_row2, a_bend, a_width, a_color, a_bits);\n\n Cubic_0 c_8 = placeCubic_0(_S18, u_0.regionTable_0[min(a_x2Region, 255U)]);\n float halfWidth_0 = 0.5 * connectorStrokePx_0(a_width, u_0.devicePixelRatio_0);\n float hw_2 = halfWidth_0 + aaHalfPx_0(u_0.devicePixelRatio_0);\n bool dashed_2 = (a_bits & 16U) != 0U;\n bool arrow_0 = (a_bits & 32U) != 0U;\n float strand2_2 = 1.0 - 2.0 * bitSet_0(a_bits, 2U);\n bool reversed2_2 = (u_0.regionTable_0[min(a_x2Region, 255U)].w) < 0.0;\n\n StripVertex_0 v_2;\n\n bool onArm_0;\n\n float _S19;\n\n\n\n if(uint(gl_VertexID) < 98U)\n {\n\n uint _S20 = uint(gl_VertexID) / 2U;\n\n if((uint(gl_VertexID) % 2U) == 0U)\n {\n\n _S19 = -1.0;\n\n }\n else\n {\n\n _S19 = 1.0;\n\n }\n\n v_2 = curveVertex_0(c_8, _S20, _S19, hw_2, dashed_2);\n\n onArm_0 = false;\n\n }\n else\n {\n uint j_0 = uint(gl_VertexID) - 98U;\n uint a_2 = j_0 / 6U;\n uint k_1 = j_0 % 6U;\n\n StripVertex_0 start_0;\n\n\n\n if(a_2 == 0U)\n {\n\n start_0 = curveVertex_0(c_8, 48U, 1.0, hw_2, dashed_2);\n\n }\n else\n {\n\n if(arrow_0)\n {\n\n start_0 = armCorner_0(c_8, 0U, 3U, hw_2, strand2_2, reversed2_2);\n\n }\n else\n {\n\n start_0 = curveVertex_0(c_8, 48U, 1.0, hw_2, dashed_2);\n\n }\n\n }\n\n\n if(k_1 == 0U)\n {\n\n onArm_0 = true;\n\n }\n else\n {\n\n onArm_0 = !arrow_0;\n\n }\n\n if(onArm_0)\n {\n\n v_2 = start_0;\n\n onArm_0 = false;\n\n }\n else\n {\n\n uint _S21;\n\n\n if(k_1 <= 2U)\n {\n\n _S21 = 0U;\n\n }\n else\n {\n\n _S21 = k_1 - 2U;\n\n }\n\n v_2 = armCorner_0(c_8, a_2, _S21, hw_2, strand2_2, reversed2_2);\n\n onArm_0 = true;\n\n }\n\n }\n\n VsOut_0 o_0;\n\n vec4 _S22;\n\n if(placed_0)\n {\n\n _S22 = vec4(v_2.screen_0.x / u_0.canvasWidth_0 * 2.0 - 1.0, yPxToClipY_0(v_2.screen_0.y, u_0.canvasHeight_0), 0.0, 1.0);\n\n }\n else\n {\n\n _S22 = vec4(-2.0, -2.0, 0.0, 1.0);\n\n }\n\n o_0.position_0 = _S22;\n\n\n\n o_0.color_1 = unpackRGBA_0(a_color);\n o_0.across_1 = v_2.across_0;\n o_0.along_1 = v_2.along_0;\n o_0.halfWidthPx_0 = halfWidth_0;\n if(dashed_2)\n {\n\n onArm_0 = !onArm_0;\n\n }\n else\n {\n\n onArm_0 = false;\n\n }\n\n if(onArm_0)\n {\n\n _S19 = 1.0;\n\n }\n else\n {\n\n _S19 = 0.0;\n\n }\n\n o_0.dashed_1 = _S19;\n VsOut_0 _S23 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S23.color_1;\n\n v_across = _S23.across_1;\n\n v_along = _S23.along_1;\n\n v_halfWidthPx = _S23.halfWidthPx_0;\n\n v_dashed = _S23.dashed_1;\n\n return;\n}\n\n"
|
|
5
|
+
|
|
6
|
+
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\n\n\n\nlayout(std140) uniform Uniforms\n{\n float canvasHeight_0;\n float canvasWidth_0;\n float devicePixelRatio_0;\n float rowOffsetPx_0;\n float rowPitchPx_0;\n float maxHandlePx_0;\n float dashPx_0;\n float gapPx_0;\n float arrowPx_0;\n uint regionCount_0;\n float zero_0;\n vec4 ownEntry_0;\n vec4 regionTable_0[256];\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat 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 dashCoverageAt_0(float coord_0, float dashPx_1, float gapPx_1, float aaPx_1)\n{\n float period_0 = dashPx_1 + gapPx_1;\n float shifted_0 = coord_0 + gapPx_1 * 0.5;\n\n return aaRamp_0(dashPx_1 * 0.5 - abs(shifted_0 - period_0 * floor(shifted_0 / period_0) - period_0 * 0.5), aaPx_1);\n}\n\nfloat dashCoverage_0(float coord_1, float dashPx_2, float gapPx_2, float dpr_1)\n{\n\n return dashCoverageAt_0(coord_1, dashPx_2, gapPx_2, aaPx_0(dpr_1));\n}\n\n\nfloat edgeCoverage_0(float signedInkCssPx_0, float dpr_2)\n{\n\n return aaRamp_0(signedInkCssPx_0, aaPx_0(dpr_2));\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin float v_across;\n\n\nin float v_along;\n\n\nflat in float v_halfWidthPx;\n\n\nflat in float v_dashed;\n\n\nvoid main()\n{\n\n bool _S1;\n if(v_dashed > 0.5)\n {\n\n _S1 = (u_0.dashPx_0) > 0.0;\n\n }\n else\n {\n\n _S1 = false;\n\n }\n\n float dash_0;\n if(_S1)\n {\n\n dash_0 = dashCoverage_0(v_along, u_0.dashPx_0, u_0.gapPx_0, u_0.devicePixelRatio_0);\n\n }\n else\n {\n\n dash_0 = 1.0;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * (edgeCoverage_0(v_halfWidthPx - abs(v_across), u_0.devicePixelRatio_0) * dash_0));\n\n return;\n}\n\n"
|