@jbrowse/render-core 4.3.0 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/RenderCanvas.d.ts +2 -2
- package/esm/RenderLifecycleMixin.d.ts +52 -20
- package/esm/RenderLifecycleMixin.js +89 -23
- package/esm/canvas2dUtils.d.ts +90 -23
- package/esm/canvas2dUtils.js +119 -36
- package/esm/colorRampLut.d.ts +5 -5
- package/esm/colorRampLut.js +6 -6
- package/esm/computePipeline.d.ts +14 -0
- package/esm/computePipeline.js +62 -0
- package/esm/contractReports.d.ts +54 -0
- package/esm/contractReports.js +112 -0
- package/esm/coverageBand.d.ts +13 -8
- package/esm/coverageBand.js +15 -5
- package/esm/coverageBandBuffers.d.ts +2 -9
- package/esm/coverageBandBuffers.js +1 -13
- package/esm/createRenderingBackend.d.ts +14 -18
- package/esm/createRenderingBackend.js +4 -2
- package/esm/displayPhase.d.ts +83 -104
- package/esm/displayPhase.js +42 -82
- package/esm/encodeMemo.d.ts +14 -0
- package/esm/encodeMemo.js +48 -0
- package/esm/gpuContextLostError.d.ts +30 -0
- package/esm/gpuContextLostError.js +40 -0
- package/esm/gpuDevice.d.ts +29 -10
- package/esm/gpuDevice.js +35 -16
- package/esm/graphicsCapabilities.d.ts +27 -19
- package/esm/graphicsCapabilities.js +40 -18
- package/esm/hal/createHal.d.ts +4 -5
- package/esm/hal/createHal.js +14 -4
- package/esm/hal/deviceGpuCache.d.ts +25 -30
- package/esm/hal/deviceGpuCache.js +88 -97
- package/esm/hal/gpuHalBase.d.ts +5 -4
- package/esm/hal/gpuHalBase.js +25 -14
- package/esm/hal/index.d.ts +2 -2
- package/esm/hal/index.js +1 -1
- package/esm/hal/mockHal.d.ts +15 -10
- package/esm/hal/mockHal.js +31 -18
- package/esm/hal/oomReporter.d.ts +7 -0
- package/esm/hal/oomReporter.js +10 -0
- package/esm/hal/passIds.d.ts +8 -7
- package/esm/hal/passIds.js +11 -10
- package/esm/hal/regionRegistry.d.ts +0 -1
- package/esm/hal/regionRegistry.js +3 -15
- package/esm/hal/types.d.ts +55 -18
- package/esm/hal/webgl2Hal.d.ts +23 -6
- package/esm/hal/webgl2Hal.js +161 -155
- package/esm/hal/webgpuHal.d.ts +29 -13
- package/esm/hal/webgpuHal.js +221 -153
- package/esm/installUpload.d.ts +16 -3
- package/esm/installUpload.js +13 -41
- package/esm/instanceCache.d.ts +10 -7
- package/esm/instanceCache.js +14 -15
- package/esm/instancePass.d.ts +2 -1
- package/esm/mapUploadSync.d.ts +2 -10
- package/esm/mapUploadSync.js +2 -3
- package/esm/marks/barMark.d.ts +30 -0
- package/esm/marks/barMark.js +149 -0
- package/esm/marks/colorFill.d.ts +17 -0
- package/esm/marks/colorFill.js +26 -0
- package/esm/marks/drawAgainstHit.d.ts +113 -0
- package/esm/marks/drawAgainstHit.js +407 -0
- package/esm/marks/ellipseDistance.d.ts +10 -0
- package/esm/marks/ellipseDistance.js +136 -0
- package/esm/marks/glyphPaint.d.ts +36 -0
- package/esm/marks/glyphPaint.js +77 -0
- package/esm/marks/index.d.ts +33 -0
- package/esm/marks/index.js +20 -0
- package/esm/marks/lineMark.d.ts +37 -0
- package/esm/marks/lineMark.js +416 -0
- package/esm/marks/linkMark.d.ts +76 -0
- package/esm/marks/linkMark.js +585 -0
- package/esm/marks/markBackend.d.ts +118 -0
- package/esm/marks/markBackend.js +196 -0
- package/esm/marks/markHit.d.ts +32 -0
- package/esm/marks/markHit.js +61 -0
- package/esm/marks/markInk.d.ts +18 -0
- package/esm/marks/markInk.js +71 -0
- package/esm/marks/markPaint.d.ts +14 -0
- package/esm/marks/markPaint.js +32 -0
- package/esm/marks/markPlan.d.ts +25 -0
- package/esm/marks/markPlan.js +20 -0
- package/esm/marks/markRamp.d.ts +72 -0
- package/esm/marks/markRamp.js +197 -0
- package/esm/marks/nearestMarkHit.d.ts +55 -0
- package/esm/marks/nearestMarkHit.js +158 -0
- package/esm/marks/pathRecorder.d.ts +14 -0
- package/esm/marks/pathRecorder.js +80 -0
- package/esm/marks/pointMark.d.ts +42 -0
- package/esm/marks/pointMark.js +125 -0
- package/esm/marks/rowLane.d.ts +39 -0
- package/esm/marks/rowLane.js +41 -0
- package/esm/marks/rowSpanIndex.d.ts +29 -0
- package/esm/marks/rowSpanIndex.js +141 -0
- package/esm/marks/rowTable.d.ts +41 -0
- package/esm/marks/rowTable.js +75 -0
- package/esm/marks/ruleMark.d.ts +21 -0
- package/esm/marks/ruleMark.js +91 -0
- package/esm/marks/spanMark.d.ts +42 -0
- package/esm/marks/spanMark.js +81 -0
- package/esm/marks/types.d.ts +261 -0
- package/esm/marks/types.js +175 -0
- package/esm/marks/valueScale.d.ts +23 -0
- package/esm/marks/valueScale.js +11 -0
- package/esm/namedReactions.d.ts +3 -4
- package/esm/namedReactions.js +3 -4
- package/esm/perRegionRenderingBackend.d.ts +21 -3
- package/esm/perRegionRenderingBackend.js +37 -3
- package/esm/regionDataMap.d.ts +2 -2
- package/esm/regionDataMap.js +25 -23
- package/esm/renderBlock.d.ts +14 -0
- package/esm/renderBlock.js +25 -0
- package/esm/renderingBackendBase.d.ts +20 -14
- package/esm/renderingBackendBase.js +12 -7
- package/esm/scoreScale.d.ts +27 -0
- package/esm/scoreScale.js +88 -0
- package/esm/shaders/barMark.generated.d.ts +3 -0
- package/esm/shaders/barMark.generated.js +7 -0
- package/esm/shaders/barMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/barMark.glsl.generated.js +4 -0
- package/esm/shaders/barMark.iface.generated.d.ts +90 -0
- package/esm/shaders/barMark.iface.generated.js +205 -0
- package/esm/shaders/barMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/barMark.wgsl.generated.js +3 -0
- package/esm/shaders/capsule.js.generated.d.ts +1 -0
- package/esm/shaders/capsule.js.generated.js +11 -0
- package/esm/shaders/clipStrip.generated.d.ts +2 -0
- package/esm/shaders/clipStrip.generated.js +4 -0
- package/esm/shaders/clipStrip.js.generated.d.ts +1 -0
- package/esm/shaders/clipStrip.js.generated.js +21 -0
- package/esm/shaders/colorRampLut.js.generated.d.ts +1 -0
- package/esm/shaders/colorRampLut.js.generated.js +17 -0
- package/esm/shaders/coverageBar.generated.d.ts +2 -3
- package/esm/shaders/coverageBar.generated.js +4 -3
- package/esm/shaders/coverageBar.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageBar.glsl.generated.js +4 -0
- package/esm/shaders/coverageBar.iface.generated.js +1 -1
- package/esm/shaders/coverageBar.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageBar.wgsl.generated.js +3 -0
- package/esm/shaders/coverageClip.generated.d.ts +3 -0
- package/esm/shaders/coverageClip.generated.js +7 -0
- package/esm/shaders/coverageClip.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageClip.glsl.generated.js +4 -0
- package/esm/shaders/coverageClip.iface.generated.d.ts +85 -0
- package/esm/shaders/coverageClip.iface.generated.js +114 -0
- package/esm/shaders/coverageClip.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageClip.wgsl.generated.js +3 -0
- package/esm/shaders/coverageIndicator.generated.d.ts +2 -3
- package/esm/shaders/coverageIndicator.generated.js +4 -3
- package/esm/shaders/coverageIndicator.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageIndicator.glsl.generated.js +4 -0
- package/esm/shaders/coverageIndicator.iface.generated.js +1 -1
- package/esm/shaders/coverageIndicator.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageIndicator.wgsl.generated.js +3 -0
- package/esm/shaders/coverageInterbase.generated.d.ts +2 -3
- package/esm/shaders/coverageInterbase.generated.js +4 -3
- package/esm/shaders/coverageInterbase.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageInterbase.glsl.generated.js +4 -0
- package/esm/shaders/coverageInterbase.iface.generated.js +1 -1
- package/esm/shaders/coverageInterbase.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageInterbase.wgsl.generated.js +3 -0
- package/esm/shaders/coverageMod.generated.d.ts +2 -3
- package/esm/shaders/coverageMod.generated.js +4 -3
- package/esm/shaders/coverageMod.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageMod.glsl.generated.js +4 -0
- package/esm/shaders/coverageMod.iface.generated.js +1 -1
- package/esm/shaders/coverageMod.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageMod.wgsl.generated.js +3 -0
- package/esm/shaders/coverageSnp.generated.d.ts +2 -3
- package/esm/shaders/coverageSnp.generated.js +4 -3
- package/esm/shaders/coverageSnp.glsl.generated.d.ts +2 -0
- package/esm/shaders/coverageSnp.glsl.generated.js +4 -0
- package/esm/shaders/coverageSnp.iface.generated.js +1 -1
- package/esm/shaders/coverageSnp.wgsl.generated.d.ts +1 -0
- package/esm/shaders/coverageSnp.wgsl.generated.js +3 -0
- package/esm/shaders/curveDistance.js.generated.d.ts +5 -0
- package/esm/shaders/curveDistance.js.generated.js +87 -0
- package/esm/shaders/hpmath.js.generated.d.ts +2 -1
- package/esm/shaders/hpmath.js.generated.js +5 -2
- package/esm/shaders/lineCenterMark.generated.d.ts +3 -0
- package/esm/shaders/lineCenterMark.generated.js +7 -0
- package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/lineCenterMark.glsl.generated.js +4 -0
- package/esm/shaders/lineCenterMark.iface.generated.d.ts +104 -0
- package/esm/shaders/lineCenterMark.iface.generated.js +237 -0
- package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/lineCenterMark.wgsl.generated.js +3 -0
- package/esm/shaders/lineCommon.generated.d.ts +2 -0
- package/esm/shaders/lineCommon.generated.js +4 -0
- package/esm/shaders/lineStepMark.generated.d.ts +3 -0
- package/esm/shaders/lineStepMark.generated.js +7 -0
- package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/lineStepMark.glsl.generated.js +4 -0
- package/esm/shaders/lineStepMark.iface.generated.d.ts +98 -0
- package/esm/shaders/lineStepMark.iface.generated.js +225 -0
- package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/lineStepMark.wgsl.generated.js +3 -0
- package/esm/shaders/linkMark.consts.generated.d.ts +14 -0
- package/esm/shaders/linkMark.consts.generated.js +16 -0
- package/esm/shaders/linkMark.generated.d.ts +4 -0
- package/esm/shaders/linkMark.generated.js +8 -0
- package/esm/shaders/linkMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/linkMark.glsl.generated.js +4 -0
- package/esm/shaders/linkMark.iface.generated.d.ts +142 -0
- package/esm/shaders/linkMark.iface.generated.js +1829 -0
- package/esm/shaders/linkMark.js.generated.d.ts +7 -0
- package/esm/shaders/linkMark.js.generated.js +159 -0
- package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/linkMark.wgsl.generated.js +3 -0
- package/esm/shaders/markColor.generated.d.ts +9 -0
- package/esm/shaders/markColor.generated.js +11 -0
- package/esm/shaders/pointGlyph.js.generated.d.ts +2 -0
- package/esm/shaders/pointGlyph.js.generated.js +15 -0
- package/esm/shaders/pointMark.consts.generated.d.ts +7 -0
- package/esm/shaders/pointMark.consts.generated.js +9 -0
- package/esm/shaders/pointMark.generated.d.ts +4 -0
- package/esm/shaders/pointMark.generated.js +8 -0
- package/esm/shaders/pointMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/pointMark.glsl.generated.js +4 -0
- package/esm/shaders/pointMark.iface.generated.d.ts +98 -0
- package/esm/shaders/pointMark.iface.generated.js +219 -0
- package/esm/shaders/pointMark.js.generated.d.ts +3 -0
- package/esm/shaders/pointMark.js.generated.js +93 -0
- package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/pointMark.wgsl.generated.js +3 -0
- package/esm/shaders/rowRect.generated.d.ts +0 -1
- package/esm/shaders/rowRect.generated.js +0 -1
- package/esm/shaders/rowTable.generated.d.ts +1 -0
- package/esm/shaders/rowTable.generated.js +3 -0
- package/esm/shaders/rowTable.js.generated.d.ts +5 -0
- package/esm/shaders/rowTable.js.generated.js +29 -0
- package/esm/shaders/scoreScale.generated.d.ts +2 -0
- package/esm/shaders/scoreScale.generated.js +4 -0
- package/esm/shaders/scoreScale.js.generated.d.ts +1 -0
- package/esm/shaders/scoreScale.js.generated.js +50 -23
- package/esm/shaders/spanMark.generated.d.ts +3 -0
- package/esm/shaders/spanMark.generated.js +7 -0
- package/esm/shaders/spanMark.glsl.generated.d.ts +2 -0
- package/esm/shaders/spanMark.glsl.generated.js +4 -0
- package/esm/shaders/spanMark.iface.generated.d.ts +81 -0
- package/esm/shaders/spanMark.iface.generated.js +215 -0
- package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/spanMark.wgsl.generated.js +3 -0
- package/esm/sharedBackendKey.d.ts +18 -0
- package/esm/{keyedRenderingBackend.js → sharedBackendKey.js} +5 -0
- package/esm/slangPass.d.ts +18 -11
- package/esm/slangPass.js +12 -4
- package/esm/useGraphicsCapabilities.d.ts +1 -1
- package/esm/useGraphicsCapabilities.js +1 -1
- package/esm/useRenderingBackend.d.ts +13 -13
- package/esm/useRenderingBackend.js +58 -20
- package/esm/webgpuUtils.d.ts +3 -11
- package/esm/webgpuUtils.js +12 -33
- package/package.json +32 -7
- package/src/shaders/antialias.slang +46 -0
- package/src/shaders/arcHull.test.ts +267 -0
- package/src/shaders/barMark.generated.ts +11 -0
- package/src/shaders/barMark.glsl.generated.ts +6 -0
- package/src/shaders/barMark.iface.generated.ts +285 -0
- package/src/shaders/barMark.slang +167 -0
- package/src/shaders/barMark.wgsl.generated.ts +4 -0
- package/src/shaders/capsule.js.generated.ts +14 -0
- package/src/shaders/capsule.slang +12 -4
- package/src/shaders/clipStrip.generated.ts +6 -0
- package/src/shaders/clipStrip.js.generated.ts +22 -0
- package/src/shaders/clipStrip.slang +34 -0
- package/src/shaders/clipStrip.test.ts +39 -0
- package/src/shaders/colorPack.slang +5 -1
- package/src/shaders/colorRampLut.js.generated.ts +22 -0
- package/src/shaders/colorRampLut.slang +15 -1
- package/src/shaders/coverageBand.slang +64 -32
- package/src/shaders/coverageBar.generated.ts +6 -5
- package/src/shaders/coverageBar.glsl.generated.ts +6 -0
- package/src/shaders/coverageBar.iface.generated.ts +1 -1
- package/src/shaders/coverageBar.slang +10 -10
- package/src/shaders/coverageBar.wgsl.generated.ts +4 -0
- package/src/shaders/coverageClip.generated.ts +11 -0
- package/src/shaders/coverageClip.glsl.generated.ts +6 -0
- package/src/shaders/coverageClip.iface.generated.ts +172 -0
- package/src/shaders/coverageClip.slang +38 -0
- package/src/shaders/coverageClip.wgsl.generated.ts +4 -0
- package/src/shaders/coverageIndicator.generated.ts +6 -5
- package/src/shaders/coverageIndicator.glsl.generated.ts +6 -0
- package/src/shaders/coverageIndicator.iface.generated.ts +1 -1
- package/src/shaders/coverageIndicator.wgsl.generated.ts +4 -0
- package/src/shaders/coverageInterbase.generated.ts +6 -5
- package/src/shaders/coverageInterbase.glsl.generated.ts +6 -0
- package/src/shaders/coverageInterbase.iface.generated.ts +1 -1
- package/src/shaders/coverageInterbase.wgsl.generated.ts +4 -0
- package/src/shaders/coverageMod.generated.ts +6 -5
- package/src/shaders/coverageMod.glsl.generated.ts +6 -0
- package/src/shaders/coverageMod.iface.generated.ts +1 -1
- package/src/shaders/coverageMod.wgsl.generated.ts +4 -0
- package/src/shaders/coverageSnp.generated.ts +6 -5
- package/src/shaders/coverageSnp.glsl.generated.ts +6 -0
- package/src/shaders/coverageSnp.iface.generated.ts +1 -1
- package/src/shaders/coverageSnp.wgsl.generated.ts +4 -0
- package/src/shaders/curveDistance.js.generated.ts +91 -0
- package/src/shaders/curveDistance.slang +265 -0
- package/src/shaders/hpClampFloor.test.ts +87 -0
- package/src/shaders/hpmath.js.generated.ts +6 -2
- package/src/shaders/hpmath.slang +100 -48
- package/src/shaders/insetValueScale.test.ts +67 -0
- package/src/shaders/lineCenterMark.generated.ts +11 -0
- package/src/shaders/lineCenterMark.glsl.generated.ts +6 -0
- package/src/shaders/lineCenterMark.iface.generated.ts +328 -0
- package/src/shaders/lineCenterMark.slang +127 -0
- package/src/shaders/lineCenterMark.wgsl.generated.ts +4 -0
- package/src/shaders/lineCommon.generated.ts +6 -0
- package/src/shaders/lineCommon.slang +102 -0
- package/src/shaders/lineStepMark.generated.ts +11 -0
- package/src/shaders/lineStepMark.glsl.generated.ts +6 -0
- package/src/shaders/lineStepMark.iface.generated.ts +311 -0
- package/src/shaders/lineStepMark.slang +125 -0
- package/src/shaders/lineStepMark.wgsl.generated.ts +4 -0
- package/src/shaders/linkMark.consts.generated.ts +30 -0
- package/src/shaders/linkMark.generated.ts +12 -0
- package/src/shaders/linkMark.glsl.generated.ts +6 -0
- package/src/shaders/linkMark.iface.generated.ts +1954 -0
- package/src/shaders/linkMark.js.generated.ts +167 -0
- package/src/shaders/linkMark.slang +439 -0
- package/src/shaders/linkMark.wgsl.generated.ts +4 -0
- package/src/shaders/markColor.generated.ts +20 -0
- package/src/shaders/markColor.slang +128 -0
- package/src/shaders/pointGlyph.js.generated.ts +20 -0
- package/src/shaders/pointGlyph.slang +23 -7
- package/src/shaders/pointGlyphPad.test.ts +242 -0
- package/src/shaders/pointMark.consts.generated.ts +16 -0
- package/src/shaders/pointMark.generated.ts +12 -0
- package/src/shaders/pointMark.glsl.generated.ts +6 -0
- package/src/shaders/pointMark.iface.generated.ts +304 -0
- package/src/shaders/pointMark.js.generated.ts +99 -0
- package/src/shaders/pointMark.slang +227 -0
- package/src/shaders/pointMark.wgsl.generated.ts +4 -0
- package/src/shaders/rowRect.generated.ts +0 -2
- package/src/shaders/rowRect.slang +39 -58
- package/src/shaders/rowTable.generated.ts +4 -0
- package/src/shaders/rowTable.js.generated.ts +37 -0
- package/src/shaders/rowTable.slang +98 -0
- package/src/shaders/scoreScale.generated.ts +6 -0
- package/src/shaders/scoreScale.js.generated.ts +48 -23
- package/src/shaders/scoreScale.slang +49 -55
- package/src/shaders/sdEllipse.test.ts +211 -0
- package/src/shaders/spanMark.generated.ts +11 -0
- package/src/shaders/spanMark.glsl.generated.ts +6 -0
- package/src/shaders/spanMark.iface.generated.ts +289 -0
- package/src/shaders/spanMark.slang +77 -0
- package/src/shaders/spanMark.wgsl.generated.ts +4 -0
- package/src/shaders/valueScale.slang +26 -0
- package/src/shaders/wideCircleLeg.test.ts +85 -0
- package/esm/globalRenderingBackend.d.ts +0 -90
- package/esm/globalRenderingBackend.js +0 -53
- package/esm/keyedRenderingBackend.d.ts +0 -41
package/esm/regionDataMap.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { observable } from 'mobx';
|
|
2
|
+
import { reportContractViolation } from './contractReports.js';
|
|
2
3
|
// Maps built here check themselves at the `set`, so the upload seam skips them
|
|
3
4
|
// and a bad entry is reported once, with the field named.
|
|
4
5
|
//
|
|
@@ -26,8 +27,8 @@ export function isCheckedAtTheStore(map) {
|
|
|
26
27
|
* observable object graph — the stored value is not the object the worker
|
|
27
28
|
* produced. A multi-wiggle region is one atom per field per source, so a
|
|
28
29
|
* thousand-sample track pays ~18k on every pan; MAF pays the whole set again
|
|
29
|
-
* for every cached region on every row reorder, since
|
|
30
|
-
*
|
|
30
|
+
* for every cached region on every row reorder, since a reorder re-places
|
|
31
|
+
* them all.
|
|
31
32
|
* - **Read.** Each field access goes through `getObservablePropValue_`. Hot
|
|
32
33
|
* loops that hoist their typed arrays are fine, but the ones that don't were
|
|
33
34
|
* paying it per iteration.
|
|
@@ -73,26 +74,27 @@ export function regionDataMap(
|
|
|
73
74
|
// reached by forgetting rather than by deciding.
|
|
74
75
|
name) {
|
|
75
76
|
const map = observable.map(undefined, { deep: false, name });
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
77
|
+
checkedAtTheStore.add(map);
|
|
78
|
+
const set = map.set.bind(map);
|
|
79
|
+
// one `typeof` per stored region, which is why it is not gated on the channel
|
|
80
|
+
// being armed: a violation found in a production build is buffered until
|
|
81
|
+
// something arms it, where a gate here would have thrown the evidence away
|
|
82
|
+
map.set = (key, value) => {
|
|
83
|
+
// as `unknown`, because the claim that this is a `T` is the thing in
|
|
84
|
+
// doubt — checking it against its own declared type narrows to `never`
|
|
85
|
+
// and checks nothing
|
|
86
|
+
const stored = value;
|
|
87
|
+
if (typeof stored !== 'object' || stored === null) {
|
|
88
|
+
// reported and never thrown: the store runs inside the fetch's own result
|
|
89
|
+
// handler, where a throw is caught and reported as a failed region —
|
|
90
|
+
// which would hide the violation being reported.
|
|
91
|
+
reportContractViolation('display', `${name}: region ${key} stored ` +
|
|
92
|
+
`\`${stored === null ? 'null' : typeof stored}\`, not a ` +
|
|
93
|
+
'payload. A fetch RPC answers a payload or a regionTooLarge ' +
|
|
94
|
+
'refusal; storing anything else leaves every reader of this map ' +
|
|
95
|
+
'reading through it.');
|
|
96
|
+
}
|
|
97
|
+
return set(key, value);
|
|
98
|
+
};
|
|
97
99
|
return map;
|
|
98
100
|
}
|
package/esm/renderBlock.d.ts
CHANGED
|
@@ -23,3 +23,17 @@ export interface RenderBlock extends BpRegionBounds {
|
|
|
23
23
|
export declare function buildRenderBlocks(regions: (BpRegionBounds & {
|
|
24
24
|
displayedRegionIndex: number;
|
|
25
25
|
})[]): RenderBlock[];
|
|
26
|
+
/**
|
|
27
|
+
* One display key's whole canvas as a single block.
|
|
28
|
+
*
|
|
29
|
+
* For a display whose x axis is not the block's bp span: a dotplot segment, a
|
|
30
|
+
* synteny ribbon, a Hi-C or LD diamond each read their screen x off the
|
|
31
|
+
* payload's own coordinates through a transform the shader and the painter both
|
|
32
|
+
* apply — a `panPx` fold from the fetch-time base for the first two, the
|
|
33
|
+
* diagonal `viewScale`/`viewOffsetX` for the last two. So the block carries
|
|
34
|
+
* nothing but its key and the identity bp span that keeps `clipBlock`
|
|
35
|
+
* well-formed.
|
|
36
|
+
*/
|
|
37
|
+
export declare function canvasWideBlock(displayedRegionIndex: number, canvasWidth: number): RenderBlock;
|
|
38
|
+
/** {@link canvasWideBlock} per key, in the keys' own order. */
|
|
39
|
+
export declare function canvasWideBlocks(keys: Iterable<number>, canvasWidth: number): RenderBlock[];
|
package/esm/renderBlock.js
CHANGED
|
@@ -8,3 +8,28 @@ export function buildRenderBlocks(regions) {
|
|
|
8
8
|
reversed: r.reversed ?? false,
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* One display key's whole canvas as a single block.
|
|
13
|
+
*
|
|
14
|
+
* For a display whose x axis is not the block's bp span: a dotplot segment, a
|
|
15
|
+
* synteny ribbon, a Hi-C or LD diamond each read their screen x off the
|
|
16
|
+
* payload's own coordinates through a transform the shader and the painter both
|
|
17
|
+
* apply — a `panPx` fold from the fetch-time base for the first two, the
|
|
18
|
+
* diagonal `viewScale`/`viewOffsetX` for the last two. So the block carries
|
|
19
|
+
* nothing but its key and the identity bp span that keeps `clipBlock`
|
|
20
|
+
* well-formed.
|
|
21
|
+
*/
|
|
22
|
+
export function canvasWideBlock(displayedRegionIndex, canvasWidth) {
|
|
23
|
+
return {
|
|
24
|
+
displayedRegionIndex,
|
|
25
|
+
start: 0,
|
|
26
|
+
end: canvasWidth,
|
|
27
|
+
screenStartPx: 0,
|
|
28
|
+
screenEndPx: canvasWidth,
|
|
29
|
+
reversed: false,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** {@link canvasWideBlock} per key, in the keys' own order. */
|
|
33
|
+
export function canvasWideBlocks(keys, canvasWidth) {
|
|
34
|
+
return [...keys].map(key => canvasWideBlock(key, canvasWidth));
|
|
35
|
+
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import type { GpuHal } from './hal/types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Minimum render-state shape a frame scaffold needs: the CSS-pixel canvas
|
|
4
|
-
* dimensions used to size the backing store, and
|
|
5
|
-
* to clip each block.
|
|
4
|
+
* dimensions used to size the backing store, and to clip each block.
|
|
6
5
|
*
|
|
7
6
|
* Here rather than beside either family because both bound their render state
|
|
8
|
-
* by it: `GpuPerRegionRenderingBackend.renderBlocks`
|
|
9
|
-
*
|
|
10
|
-
* two Canvas2D bases with the same `prepareCanvas`.
|
|
7
|
+
* by it: `GpuPerRegionRenderingBackend.renderBlocks` opens with `hal.resize`,
|
|
8
|
+
* and its Canvas2D twin with `prepareCanvas`.
|
|
11
9
|
*/
|
|
12
10
|
export interface FrameDimensions {
|
|
13
11
|
canvasWidth: number;
|
|
14
12
|
canvasHeight: number;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
|
-
* What every rendering backend has, whatever its upload shape —
|
|
18
|
-
*
|
|
19
|
-
* `KeyedRenderingBackend`) all extend this, and `useRenderingBackend` is
|
|
15
|
+
* What every rendering backend has, whatever its upload shape —
|
|
16
|
+
* `PerRegionRenderingBackend` extends this, and `useRenderingBackend` is
|
|
20
17
|
* bounded by it.
|
|
21
18
|
*
|
|
22
19
|
* `setErrorHandler` is here rather than optional at the hook because it was
|
|
@@ -37,11 +34,18 @@ export interface RenderingBackend {
|
|
|
37
34
|
* allocates no GPU resources.
|
|
38
35
|
*/
|
|
39
36
|
setErrorHandler(handler: (error: Error) => void): void;
|
|
37
|
+
/**
|
|
38
|
+
* Give back the canvas-sized GPU targets while the display's canvas is off
|
|
39
|
+
* the page, keeping everything a redraw would otherwise have to rebuild.
|
|
40
|
+
* `RenderLifecycleMixin`'s render autorun calls it on every tick it declines
|
|
41
|
+
* to draw, so it has to be idempotent; the next frame's `resize` reallocates.
|
|
42
|
+
*/
|
|
43
|
+
releaseOffscreenTargets(): void;
|
|
40
44
|
dispose(): void;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
|
-
* Shared GPU-side state for every GPU rendering backend
|
|
44
|
-
* (`GpuPerRegionRenderingBackend
|
|
47
|
+
* Shared GPU-side state for every GPU rendering backend
|
|
48
|
+
* (`GpuPerRegionRenderingBackend`, and the shared-canvas backends over it).
|
|
45
49
|
* Owns the `hal` reference and a pre-allocated uniform scratch `ArrayBuffer`
|
|
46
50
|
* reused across frames to avoid per-frame GC churn. `dispose()` delegates to
|
|
47
51
|
* the HAL. Subclasses add only their upload/render shape.
|
|
@@ -49,14 +53,15 @@ export interface RenderingBackend {
|
|
|
49
53
|
export declare abstract class GpuRenderingBackendBase {
|
|
50
54
|
protected hal: GpuHal;
|
|
51
55
|
protected uniformData: ArrayBuffer;
|
|
52
|
-
constructor(hal: GpuHal
|
|
56
|
+
constructor(hal: GpuHal);
|
|
53
57
|
setErrorHandler(handler: (error: Error) => void): void;
|
|
58
|
+
releaseOffscreenTargets(): void;
|
|
54
59
|
dispose(): void;
|
|
55
60
|
}
|
|
56
61
|
/**
|
|
57
|
-
* Shared Canvas2D-side state for every Canvas2D rendering backend
|
|
58
|
-
*
|
|
59
|
-
*
|
|
62
|
+
* Shared Canvas2D-side state for every Canvas2D rendering backend
|
|
63
|
+
* (`Canvas2DPerRegionRenderingBackend`, and the shared-canvas backends over
|
|
64
|
+
* it). Owns the `canvas` and its 2D context
|
|
60
65
|
* (constructor throws if unavailable). `dispose()` is a no-op since Canvas2D
|
|
61
66
|
* holds no GPU resources. Subclasses add only their render shape and stub the
|
|
62
67
|
* upload/prune hooks their interface requires (everything flows through the
|
|
@@ -67,5 +72,6 @@ export declare abstract class Canvas2DRenderingBackendBase {
|
|
|
67
72
|
protected ctx: CanvasRenderingContext2D;
|
|
68
73
|
constructor(canvas: HTMLCanvasElement);
|
|
69
74
|
setErrorHandler(_handler: (error: Error) => void): void;
|
|
75
|
+
releaseOffscreenTargets(): void;
|
|
70
76
|
dispose(): void;
|
|
71
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { acquireCanvas2D } from './canvasContext.js';
|
|
2
2
|
/**
|
|
3
|
-
* Shared GPU-side state for every GPU rendering backend
|
|
4
|
-
* (`GpuPerRegionRenderingBackend
|
|
3
|
+
* Shared GPU-side state for every GPU rendering backend
|
|
4
|
+
* (`GpuPerRegionRenderingBackend`, and the shared-canvas backends over it).
|
|
5
5
|
* Owns the `hal` reference and a pre-allocated uniform scratch `ArrayBuffer`
|
|
6
6
|
* reused across frames to avoid per-frame GC churn. `dispose()` delegates to
|
|
7
7
|
* the HAL. Subclasses add only their upload/render shape.
|
|
@@ -9,23 +9,26 @@ import { acquireCanvas2D } from './canvasContext.js';
|
|
|
9
9
|
export class GpuRenderingBackendBase {
|
|
10
10
|
hal;
|
|
11
11
|
uniformData;
|
|
12
|
-
constructor(hal
|
|
12
|
+
constructor(hal) {
|
|
13
13
|
this.hal = hal;
|
|
14
|
-
this.uniformData = new ArrayBuffer(uniformByteSize);
|
|
14
|
+
this.uniformData = new ArrayBuffer(hal.uniformByteSize);
|
|
15
15
|
}
|
|
16
16
|
// Forward OOM / over-limit allocation failures from the HAL to the display's
|
|
17
17
|
// renderError. Wired by useRenderingBackend once the backend is live.
|
|
18
18
|
setErrorHandler(handler) {
|
|
19
19
|
this.hal.setErrorHandler(handler);
|
|
20
20
|
}
|
|
21
|
+
releaseOffscreenTargets() {
|
|
22
|
+
this.hal.releaseRenderTargets();
|
|
23
|
+
}
|
|
21
24
|
dispose() {
|
|
22
25
|
this.hal.dispose();
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
|
-
* Shared Canvas2D-side state for every Canvas2D rendering backend
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
+
* Shared Canvas2D-side state for every Canvas2D rendering backend
|
|
30
|
+
* (`Canvas2DPerRegionRenderingBackend`, and the shared-canvas backends over
|
|
31
|
+
* it). Owns the `canvas` and its 2D context
|
|
29
32
|
* (constructor throws if unavailable). `dispose()` is a no-op since Canvas2D
|
|
30
33
|
* holds no GPU resources. Subclasses add only their render shape and stub the
|
|
31
34
|
* upload/prune hooks their interface requires (everything flows through the
|
|
@@ -46,5 +49,7 @@ export class Canvas2DRenderingBackendBase {
|
|
|
46
49
|
// Present for symmetry with the GPU base so useRenderingBackend can wire both
|
|
47
50
|
// uniformly.
|
|
48
51
|
setErrorHandler(_handler) { }
|
|
52
|
+
// Canvas2D's backing store is the only buffer here and the element owns it.
|
|
53
|
+
releaseOffscreenTargets() { }
|
|
49
54
|
dispose() { }
|
|
50
55
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SCALE_TYPE_LOG as GENERATED_SCALE_TYPE_LOG, SCALE_TYPE_SYMLOG as GENERATED_SCALE_TYPE_SYMLOG } from './shaders/scoreScale.generated.ts';
|
|
2
|
+
/** `scoreScale.slang`'s scale-type vocabulary, where 0 is linear. */
|
|
3
|
+
export type ScaleTypeCode = 0 | typeof GENERATED_SCALE_TYPE_LOG | typeof GENERATED_SCALE_TYPE_SYMLOG;
|
|
4
|
+
export declare const SCALE_TYPE_LINEAR: ScaleTypeCode;
|
|
5
|
+
export declare const SCALE_TYPE_LOG: ScaleTypeCode;
|
|
6
|
+
export declare const SCALE_TYPE_SYMLOG: ScaleTypeCode;
|
|
7
|
+
/** The code the `scaleType` uniform compares for a `'log'`/`'symlog'` name. */
|
|
8
|
+
export declare function scaleTypeCode(scaleType: string | undefined): ScaleTypeCode;
|
|
9
|
+
/**
|
|
10
|
+
* `normalizeScore` with the per-domain arithmetic hoisted out of a per-feature
|
|
11
|
+
* loop: the clamped `[0, 1]` fraction a score sits at, and on a domain with no
|
|
12
|
+
* range 1 above its min and 0 elsewhere. `symlogConstant` is the resolved one
|
|
13
|
+
* the shader gets as a uniform.
|
|
14
|
+
*/
|
|
15
|
+
export declare function makeScoreNormalizer(min: number, max: number, scaleType: ScaleTypeCode, symlogConstant: number): (score: number) => number;
|
|
16
|
+
/**
|
|
17
|
+
* `normalizeScore`'s unclamped inverse, the score at fraction `t`. A domain
|
|
18
|
+
* with no range answers its min, floored for log, where the forward step sits.
|
|
19
|
+
*/
|
|
20
|
+
export declare function denormalizeScore(t: number, min: number, max: number, scaleType: ScaleTypeCode, symlogConstant: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Where a ramp's middle stop sits in the normalized domain: `mid`'s fraction,
|
|
23
|
+
* clamped as the normalizer clamps, else 0.5, which runs the ramp straight
|
|
24
|
+
* from end to end. The GPU's `rampMidNorm` uniform and every Canvas2D reader of
|
|
25
|
+
* a straight ramp table pass a value's fraction through `rampMidT` with it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function rampMidNorm(min: number, max: number, scaleType: ScaleTypeCode, mid: number | undefined, symlogConstant?: number): number;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { SCALE_TYPE_LOG as GENERATED_SCALE_TYPE_LOG, SCALE_TYPE_SYMLOG as GENERATED_SCALE_TYPE_SYMLOG, } from './shaders/scoreScale.generated.js';
|
|
2
|
+
export const SCALE_TYPE_LINEAR = 0;
|
|
3
|
+
export const SCALE_TYPE_LOG = GENERATED_SCALE_TYPE_LOG;
|
|
4
|
+
export const SCALE_TYPE_SYMLOG = GENERATED_SCALE_TYPE_SYMLOG;
|
|
5
|
+
/** The code the `scaleType` uniform compares for a `'log'`/`'symlog'` name. */
|
|
6
|
+
export function scaleTypeCode(scaleType) {
|
|
7
|
+
return scaleType === 'log'
|
|
8
|
+
? SCALE_TYPE_LOG
|
|
9
|
+
: scaleType === 'symlog'
|
|
10
|
+
? SCALE_TYPE_SYMLOG
|
|
11
|
+
: 0;
|
|
12
|
+
}
|
|
13
|
+
// `Math.log1p` rather than a bare `log(1 + x)`, which loses precision
|
|
14
|
+
// near zero; `scoreScale.slang` spells the same correction by hand.
|
|
15
|
+
function symlog(x, c) {
|
|
16
|
+
return Math.sign(x) * Math.log1p(Math.abs(x / c));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `normalizeScore` with the per-domain arithmetic hoisted out of a per-feature
|
|
20
|
+
* loop: the clamped `[0, 1]` fraction a score sits at, and on a domain with no
|
|
21
|
+
* range 1 above its min and 0 elsewhere. `symlogConstant` is the resolved one
|
|
22
|
+
* the shader gets as a uniform.
|
|
23
|
+
*/
|
|
24
|
+
export function makeScoreNormalizer(min, max, scaleType, symlogConstant) {
|
|
25
|
+
if (scaleType === SCALE_TYPE_SYMLOG) {
|
|
26
|
+
const c = symlogConstant;
|
|
27
|
+
const tMin = symlog(min, c);
|
|
28
|
+
const tMax = symlog(max, c);
|
|
29
|
+
const tRange = tMax - tMin;
|
|
30
|
+
if (tRange <= 0) {
|
|
31
|
+
return (score) => (symlog(score, c) > tMin ? 1 : 0);
|
|
32
|
+
}
|
|
33
|
+
const invRange = 1 / tRange;
|
|
34
|
+
return (score) => Math.max(0, Math.min(1, (symlog(score, c) - tMin) * invRange));
|
|
35
|
+
}
|
|
36
|
+
if (scaleType === SCALE_TYPE_LOG) {
|
|
37
|
+
const floor = min > 0 ? min : 1;
|
|
38
|
+
const logMin = Math.log2(floor);
|
|
39
|
+
const logMax = Math.log2(Math.max(max, floor));
|
|
40
|
+
const logRange = logMax - logMin;
|
|
41
|
+
if (logRange <= 0) {
|
|
42
|
+
return (score) => Math.log2(Math.max(score, floor)) > logMin ? 1 : 0;
|
|
43
|
+
}
|
|
44
|
+
const invLogRange = 1 / logRange;
|
|
45
|
+
return (score) => {
|
|
46
|
+
const logScore = Math.log2(Math.max(score, floor));
|
|
47
|
+
return Math.max(0, Math.min(1, (logScore - logMin) * invLogRange));
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const range = max - min;
|
|
51
|
+
if (range <= 0) {
|
|
52
|
+
return (score) => (score > min ? 1 : 0);
|
|
53
|
+
}
|
|
54
|
+
const invRange = 1 / range;
|
|
55
|
+
return (score) => Math.max(0, Math.min(1, (score - min) * invRange));
|
|
56
|
+
}
|
|
57
|
+
function symlogInverse(y, c) {
|
|
58
|
+
return Math.sign(y) * c * Math.expm1(Math.abs(y));
|
|
59
|
+
}
|
|
60
|
+
function atFraction(t, tMin, tMax) {
|
|
61
|
+
return tMax > tMin ? tMin + t * (tMax - tMin) : tMin;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* `normalizeScore`'s unclamped inverse, the score at fraction `t`. A domain
|
|
65
|
+
* with no range answers its min, floored for log, where the forward step sits.
|
|
66
|
+
*/
|
|
67
|
+
export function denormalizeScore(t, min, max, scaleType, symlogConstant) {
|
|
68
|
+
if (scaleType === SCALE_TYPE_SYMLOG) {
|
|
69
|
+
const c = symlogConstant;
|
|
70
|
+
return symlogInverse(atFraction(t, symlog(min, c), symlog(max, c)), c);
|
|
71
|
+
}
|
|
72
|
+
if (scaleType === SCALE_TYPE_LOG) {
|
|
73
|
+
const floor = min > 0 ? min : 1;
|
|
74
|
+
return 2 ** atFraction(t, Math.log2(floor), Math.log2(Math.max(max, floor)));
|
|
75
|
+
}
|
|
76
|
+
return atFraction(t, min, max);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Where a ramp's middle stop sits in the normalized domain: `mid`'s fraction,
|
|
80
|
+
* clamped as the normalizer clamps, else 0.5, which runs the ramp straight
|
|
81
|
+
* from end to end. The GPU's `rampMidNorm` uniform and every Canvas2D reader of
|
|
82
|
+
* a straight ramp table pass a value's fraction through `rampMidT` with it.
|
|
83
|
+
*/
|
|
84
|
+
export function rampMidNorm(min, max, scaleType, mid, symlogConstant = 1) {
|
|
85
|
+
return mid === undefined
|
|
86
|
+
? 0.5
|
|
87
|
+
: makeScoreNormalizer(min, max, scaleType, symlogConstant)(mid);
|
|
88
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
export * from './barMark.iface.generated.js';
|
|
4
|
+
export const SOURCE = {
|
|
5
|
+
wgsl: () => import('./barMark.wgsl.generated.js'),
|
|
6
|
+
glsl: () => import('./barMark.glsl.generated.js'),
|
|
7
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_1) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S31;\n if((c_2.w) > 0.0)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S29;\n\n }\n\n p_0.color_1 = _S31;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S32)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S33 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S33.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_0;\n\n v_barInkPx = _S34.barInkPx_0;\n\n return;\n }\n\n float _S35 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S35, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S33.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_barInkPx = _S36.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S38 = min(valueY_0, originY_0);\n float _S39 = max(valueY_0, originY_0);\n float vy_0 = mix(_S39 + padPx_0, _S38 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S33.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S38, vy_0 - _S39);\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_barInkPx = _S40.barInkPx_0;\n\n return;\n}\n\n";
|
|
2
|
+
export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_1) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S31;\n if((c_2.w) > 0.0)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S29;\n\n }\n\n p_0.color_1 = _S31;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S32)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S33 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S33.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_0;\n\n v_barInkPx = _S34.barInkPx_0;\n\n return;\n }\n\n float _S35 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S35, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S33.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_barInkPx = _S36.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S38 = min(valueY_0, originY_0);\n float _S39 = max(valueY_0, originY_0);\n float vy_0 = mix(_S39 + padPx_0, _S38 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S33.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S38, vy_0 - _S39);\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_barInkPx = _S40.barInkPx_0;\n\n return;\n}\n\n";
|
|
4
|
+
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { VertexAttributeLayout, ShaderBinding, TextureBinding } from '@jbrowse/render-core/hal';
|
|
2
|
+
export declare const BINDINGS: readonly ShaderBinding[];
|
|
3
|
+
export declare const VERTS_PER_INSTANCE = 12;
|
|
4
|
+
export declare const UNIFORMS_SIZE_BYTES = 288;
|
|
5
|
+
export declare const UNIFORM_OFFSET_F32: {
|
|
6
|
+
readonly bpRangeX: 0;
|
|
7
|
+
readonly canvasHeight: 3;
|
|
8
|
+
readonly domainMin: 4;
|
|
9
|
+
readonly domainMax: 5;
|
|
10
|
+
readonly valueSymlogConstant: 7;
|
|
11
|
+
readonly rampMin: 9;
|
|
12
|
+
readonly rampMax: 10;
|
|
13
|
+
readonly rampMidNorm: 11;
|
|
14
|
+
readonly originYPx: 60;
|
|
15
|
+
readonly rowHeight: 61;
|
|
16
|
+
readonly rowBandPx: 62;
|
|
17
|
+
readonly rowOffsetPx: 63;
|
|
18
|
+
readonly zero: 64;
|
|
19
|
+
readonly minCellDenomPx: 65;
|
|
20
|
+
readonly minWidthPx: 66;
|
|
21
|
+
readonly devicePixelRatio: 67;
|
|
22
|
+
};
|
|
23
|
+
export declare const UNIFORM_OFFSET_I32: {
|
|
24
|
+
readonly valueScaleType: 6;
|
|
25
|
+
readonly rampMode: 8;
|
|
26
|
+
readonly colorCutCount: 12;
|
|
27
|
+
readonly rowTableKeys: 68;
|
|
28
|
+
};
|
|
29
|
+
export declare const UNIFORM_SLOT_ARRAYS: {
|
|
30
|
+
readonly colorCuts: readonly [16, 20];
|
|
31
|
+
readonly colorBands: readonly [24, 28, 32, 36, 40, 44, 48, 52, 56];
|
|
32
|
+
};
|
|
33
|
+
export declare function setUniformColorCuts(f32: Float32Array, i: number, v0: number, v1: number, v2: number, v3: number): void;
|
|
34
|
+
export declare function setUniformColorBands(f32: Float32Array, i: number, v0: number, v1: number, v2: number, v3: number): void;
|
|
35
|
+
export interface Uniforms {
|
|
36
|
+
bpRangeX: [number, number, number];
|
|
37
|
+
canvasHeight: number;
|
|
38
|
+
domainMin: number;
|
|
39
|
+
domainMax: number;
|
|
40
|
+
valueScaleType: number;
|
|
41
|
+
valueSymlogConstant: number;
|
|
42
|
+
rampMode: number;
|
|
43
|
+
rampMin: number;
|
|
44
|
+
rampMax: number;
|
|
45
|
+
rampMidNorm: number;
|
|
46
|
+
colorCutCount: number;
|
|
47
|
+
colorCuts: [[number, number, number, number], [number, number, number, number]];
|
|
48
|
+
colorBands: [[number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number]];
|
|
49
|
+
originYPx: number;
|
|
50
|
+
rowHeight: number;
|
|
51
|
+
rowBandPx: number;
|
|
52
|
+
rowOffsetPx: number;
|
|
53
|
+
zero: number;
|
|
54
|
+
minCellDenomPx: number;
|
|
55
|
+
minWidthPx: number;
|
|
56
|
+
devicePixelRatio: number;
|
|
57
|
+
rowTableKeys: number;
|
|
58
|
+
}
|
|
59
|
+
export declare function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms): void;
|
|
60
|
+
export declare const INSTANCE_STRIDE_BYTES = 20;
|
|
61
|
+
export declare const INSTANCE_STRIDE_WORDS = 5;
|
|
62
|
+
export declare const INSTANCE_OFFSET_F32: {
|
|
63
|
+
readonly y: 2;
|
|
64
|
+
};
|
|
65
|
+
export declare const INSTANCE_OFFSET_U32: {
|
|
66
|
+
readonly x: 0;
|
|
67
|
+
readonly x2: 1;
|
|
68
|
+
readonly color: 3;
|
|
69
|
+
readonly row: 4;
|
|
70
|
+
};
|
|
71
|
+
export declare const VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
|
|
72
|
+
export interface InstanceArrays {
|
|
73
|
+
x: ArrayLike<number>;
|
|
74
|
+
x2: ArrayLike<number>;
|
|
75
|
+
y: ArrayLike<number>;
|
|
76
|
+
color: ArrayLike<number>;
|
|
77
|
+
row: ArrayLike<number>;
|
|
78
|
+
}
|
|
79
|
+
export declare function packInstances(arrays: InstanceArrays, numInstances: number, buf?: ArrayBuffer): ArrayBuffer;
|
|
80
|
+
export declare function getInstanceX(u32: Uint32Array, i: number): number;
|
|
81
|
+
export declare function setInstanceX(u32: Uint32Array, i: number, v: number): void;
|
|
82
|
+
export declare function getInstanceX2(u32: Uint32Array, i: number): number;
|
|
83
|
+
export declare function setInstanceX2(u32: Uint32Array, i: number, v: number): void;
|
|
84
|
+
export declare function getInstanceY(f32: Float32Array, i: number): number;
|
|
85
|
+
export declare function setInstanceY(f32: Float32Array, i: number, v: number): void;
|
|
86
|
+
export declare function getInstanceColor(u32: Uint32Array, i: number): number;
|
|
87
|
+
export declare function setInstanceColor(u32: Uint32Array, i: number, v: number): void;
|
|
88
|
+
export declare function getInstanceRow(u32: Uint32Array, i: number): number;
|
|
89
|
+
export declare function setInstanceRow(u32: Uint32Array, i: number, v: number): void;
|
|
90
|
+
export declare const TEXTURES: readonly [TextureBinding, ...TextureBinding[]];
|