@jbrowse/render-core 5.0.0-beta.1 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.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 minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S30;\n if((c_2.w) > 0.0)\n {\n\n _S30 = c_2;\n\n }\n else\n {\n\n _S30 = _S28;\n\n }\n\n p_0.color_0 = _S30;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S31 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n RowRectVsOut_0 o_0;\n if(_S31.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S32 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S32.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S31.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S31.color_0;\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n}\n\n";
|
|
4
|
+
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
|
|
@@ -0,0 +1,81 @@
|
|
|
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 = 6;
|
|
4
|
+
export declare const UNIFORMS_SIZE_BYTES = 240;
|
|
5
|
+
export declare const UNIFORM_OFFSET_F32: {
|
|
6
|
+
readonly bpRangeX: 0;
|
|
7
|
+
readonly canvasHeight: 3;
|
|
8
|
+
readonly minCellDenomPx: 4;
|
|
9
|
+
readonly minCellPx: 5;
|
|
10
|
+
readonly zero: 6;
|
|
11
|
+
readonly rowHeight: 7;
|
|
12
|
+
readonly rowProportion: 8;
|
|
13
|
+
readonly scrollTop: 9;
|
|
14
|
+
readonly rampMin: 12;
|
|
15
|
+
readonly rampMax: 13;
|
|
16
|
+
readonly rampMidNorm: 14;
|
|
17
|
+
};
|
|
18
|
+
export declare const UNIFORM_OFFSET_I32: {
|
|
19
|
+
readonly rowTableKeys: 10;
|
|
20
|
+
readonly rampMode: 11;
|
|
21
|
+
readonly colorCutCount: 15;
|
|
22
|
+
};
|
|
23
|
+
export declare const UNIFORM_SLOT_ARRAYS: {
|
|
24
|
+
readonly colorCuts: readonly [16, 20];
|
|
25
|
+
readonly colorBands: readonly [24, 28, 32, 36, 40, 44, 48, 52, 56];
|
|
26
|
+
};
|
|
27
|
+
export declare function setUniformColorCuts(f32: Float32Array, i: number, v0: number, v1: number, v2: number, v3: number): void;
|
|
28
|
+
export declare function setUniformColorBands(f32: Float32Array, i: number, v0: number, v1: number, v2: number, v3: number): void;
|
|
29
|
+
export interface Uniforms {
|
|
30
|
+
bpRangeX: [number, number, number];
|
|
31
|
+
canvasHeight: number;
|
|
32
|
+
minCellDenomPx: number;
|
|
33
|
+
minCellPx: number;
|
|
34
|
+
zero: number;
|
|
35
|
+
rowHeight: number;
|
|
36
|
+
rowProportion: number;
|
|
37
|
+
scrollTop: number;
|
|
38
|
+
rowTableKeys: number;
|
|
39
|
+
rampMode: number;
|
|
40
|
+
rampMin: number;
|
|
41
|
+
rampMax: number;
|
|
42
|
+
rampMidNorm: number;
|
|
43
|
+
colorCutCount: number;
|
|
44
|
+
colorCuts: [[number, number, number, number], [number, number, number, number]];
|
|
45
|
+
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]];
|
|
46
|
+
}
|
|
47
|
+
export declare function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms): void;
|
|
48
|
+
export declare const INSTANCE_STRIDE_BYTES = 16;
|
|
49
|
+
export declare const INSTANCE_STRIDE_WORDS = 4;
|
|
50
|
+
export declare const INSTANCE_OFFSET_U32: {
|
|
51
|
+
readonly x: 0;
|
|
52
|
+
readonly x2: 1;
|
|
53
|
+
readonly row: 2;
|
|
54
|
+
readonly color: 3;
|
|
55
|
+
};
|
|
56
|
+
export declare const VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
|
|
57
|
+
export interface InstanceArrays {
|
|
58
|
+
x: ArrayLike<number>;
|
|
59
|
+
x2: ArrayLike<number>;
|
|
60
|
+
row: ArrayLike<number>;
|
|
61
|
+
color: ArrayLike<number>;
|
|
62
|
+
}
|
|
63
|
+
export declare function packInstances(arrays: InstanceArrays, numInstances: number, buf?: ArrayBuffer): ArrayBuffer;
|
|
64
|
+
export declare function getInstanceX(u32: Uint32Array, i: number): number;
|
|
65
|
+
export declare function setInstanceX(u32: Uint32Array, i: number, v: number): void;
|
|
66
|
+
export declare function getInstanceX2(u32: Uint32Array, i: number): number;
|
|
67
|
+
export declare function setInstanceX2(u32: Uint32Array, i: number, v: number): void;
|
|
68
|
+
export declare function getInstanceRow(u32: Uint32Array, i: number): number;
|
|
69
|
+
export declare function setInstanceRow(u32: Uint32Array, i: number, v: number): void;
|
|
70
|
+
export declare function getInstanceColor(u32: Uint32Array, i: number): number;
|
|
71
|
+
export declare function setInstanceColor(u32: Uint32Array, i: number, v: number): void;
|
|
72
|
+
export declare class InstanceWriter {
|
|
73
|
+
private buf;
|
|
74
|
+
private u32;
|
|
75
|
+
private capacity;
|
|
76
|
+
count: number;
|
|
77
|
+
constructor(capacity: number);
|
|
78
|
+
push(x: number, x2: number, row: number, color: number): void;
|
|
79
|
+
finish(): ArrayBuffer;
|
|
80
|
+
}
|
|
81
|
+
export declare const TEXTURES: readonly [TextureBinding, ...TextureBinding[]];
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
export const BINDINGS = [
|
|
4
|
+
{ index: 1, kind: 'uniform', name: 'u', stages: ['vertex'] },
|
|
5
|
+
{ index: 2, kind: 'texture', name: 'colorRamp', stages: ['vertex'] },
|
|
6
|
+
{ index: 3, kind: 'sampler', name: 'colorRamp', stages: ['vertex'] },
|
|
7
|
+
{ index: 4, kind: 'texture', name: 'rowTable', stages: ['vertex'] },
|
|
8
|
+
{ index: 5, kind: 'sampler', name: 'rowTable', stages: ['vertex'] },
|
|
9
|
+
];
|
|
10
|
+
export const VERTS_PER_INSTANCE = 6;
|
|
11
|
+
export const UNIFORMS_SIZE_BYTES = 240;
|
|
12
|
+
// Word indices into a Float32Array view over the uniform buffer.
|
|
13
|
+
export const UNIFORM_OFFSET_F32 = {
|
|
14
|
+
bpRangeX: 0,
|
|
15
|
+
canvasHeight: 3,
|
|
16
|
+
minCellDenomPx: 4,
|
|
17
|
+
minCellPx: 5,
|
|
18
|
+
zero: 6,
|
|
19
|
+
rowHeight: 7,
|
|
20
|
+
rowProportion: 8,
|
|
21
|
+
scrollTop: 9,
|
|
22
|
+
rampMin: 12,
|
|
23
|
+
rampMax: 13,
|
|
24
|
+
rampMidNorm: 14,
|
|
25
|
+
};
|
|
26
|
+
// Word indices into a Int32Array view over the uniform buffer.
|
|
27
|
+
export const UNIFORM_OFFSET_I32 = {
|
|
28
|
+
rowTableKeys: 10,
|
|
29
|
+
rampMode: 11,
|
|
30
|
+
colorCutCount: 15,
|
|
31
|
+
};
|
|
32
|
+
// Word indices of each array field’s elements, into a 4-byte-word
|
|
33
|
+
// view over the uniform buffer (Uint32Array or Float32Array — the
|
|
34
|
+
// field’s scalar type picks, same as UNIFORM_OFFSET_*). NOT
|
|
35
|
+
// consecutive: std140 pads every array element to 16 bytes.
|
|
36
|
+
export const UNIFORM_SLOT_ARRAYS = {
|
|
37
|
+
colorCuts: [16, 20],
|
|
38
|
+
colorBands: [24, 28, 32, 36, 40, 44, 48, 52, 56],
|
|
39
|
+
};
|
|
40
|
+
// Element `i` of the `colorCuts` uniform array (4 components).
|
|
41
|
+
export function setUniformColorCuts(f32, i, v0, v1, v2, v3) {
|
|
42
|
+
const o = UNIFORM_SLOT_ARRAYS.colorCuts[i];
|
|
43
|
+
f32[o] = v0;
|
|
44
|
+
f32[o + 1] = v1;
|
|
45
|
+
f32[o + 2] = v2;
|
|
46
|
+
f32[o + 3] = v3;
|
|
47
|
+
}
|
|
48
|
+
// Element `i` of the `colorBands` uniform array (4 components).
|
|
49
|
+
export function setUniformColorBands(f32, i, v0, v1, v2, v3) {
|
|
50
|
+
const o = UNIFORM_SLOT_ARRAYS.colorBands[i];
|
|
51
|
+
f32[o] = v0;
|
|
52
|
+
f32[o + 1] = v1;
|
|
53
|
+
f32[o + 2] = v2;
|
|
54
|
+
f32[o + 3] = v3;
|
|
55
|
+
}
|
|
56
|
+
export function writeUniforms(buf, uniforms) {
|
|
57
|
+
const f32 = new Float32Array(buf);
|
|
58
|
+
const i32 = new Int32Array(buf);
|
|
59
|
+
f32[0] = uniforms.bpRangeX[0];
|
|
60
|
+
f32[1] = uniforms.bpRangeX[1];
|
|
61
|
+
f32[2] = uniforms.bpRangeX[2];
|
|
62
|
+
f32[3] = uniforms.canvasHeight;
|
|
63
|
+
f32[4] = uniforms.minCellDenomPx;
|
|
64
|
+
f32[5] = uniforms.minCellPx;
|
|
65
|
+
f32[6] = uniforms.zero;
|
|
66
|
+
f32[7] = uniforms.rowHeight;
|
|
67
|
+
f32[8] = uniforms.rowProportion;
|
|
68
|
+
f32[9] = uniforms.scrollTop;
|
|
69
|
+
i32[10] = uniforms.rowTableKeys;
|
|
70
|
+
i32[11] = uniforms.rampMode;
|
|
71
|
+
f32[12] = uniforms.rampMin;
|
|
72
|
+
f32[13] = uniforms.rampMax;
|
|
73
|
+
f32[14] = uniforms.rampMidNorm;
|
|
74
|
+
i32[15] = uniforms.colorCutCount;
|
|
75
|
+
f32[16] = uniforms.colorCuts[0][0];
|
|
76
|
+
f32[17] = uniforms.colorCuts[0][1];
|
|
77
|
+
f32[18] = uniforms.colorCuts[0][2];
|
|
78
|
+
f32[19] = uniforms.colorCuts[0][3];
|
|
79
|
+
f32[20] = uniforms.colorCuts[1][0];
|
|
80
|
+
f32[21] = uniforms.colorCuts[1][1];
|
|
81
|
+
f32[22] = uniforms.colorCuts[1][2];
|
|
82
|
+
f32[23] = uniforms.colorCuts[1][3];
|
|
83
|
+
f32[24] = uniforms.colorBands[0][0];
|
|
84
|
+
f32[25] = uniforms.colorBands[0][1];
|
|
85
|
+
f32[26] = uniforms.colorBands[0][2];
|
|
86
|
+
f32[27] = uniforms.colorBands[0][3];
|
|
87
|
+
f32[28] = uniforms.colorBands[1][0];
|
|
88
|
+
f32[29] = uniforms.colorBands[1][1];
|
|
89
|
+
f32[30] = uniforms.colorBands[1][2];
|
|
90
|
+
f32[31] = uniforms.colorBands[1][3];
|
|
91
|
+
f32[32] = uniforms.colorBands[2][0];
|
|
92
|
+
f32[33] = uniforms.colorBands[2][1];
|
|
93
|
+
f32[34] = uniforms.colorBands[2][2];
|
|
94
|
+
f32[35] = uniforms.colorBands[2][3];
|
|
95
|
+
f32[36] = uniforms.colorBands[3][0];
|
|
96
|
+
f32[37] = uniforms.colorBands[3][1];
|
|
97
|
+
f32[38] = uniforms.colorBands[3][2];
|
|
98
|
+
f32[39] = uniforms.colorBands[3][3];
|
|
99
|
+
f32[40] = uniforms.colorBands[4][0];
|
|
100
|
+
f32[41] = uniforms.colorBands[4][1];
|
|
101
|
+
f32[42] = uniforms.colorBands[4][2];
|
|
102
|
+
f32[43] = uniforms.colorBands[4][3];
|
|
103
|
+
f32[44] = uniforms.colorBands[5][0];
|
|
104
|
+
f32[45] = uniforms.colorBands[5][1];
|
|
105
|
+
f32[46] = uniforms.colorBands[5][2];
|
|
106
|
+
f32[47] = uniforms.colorBands[5][3];
|
|
107
|
+
f32[48] = uniforms.colorBands[6][0];
|
|
108
|
+
f32[49] = uniforms.colorBands[6][1];
|
|
109
|
+
f32[50] = uniforms.colorBands[6][2];
|
|
110
|
+
f32[51] = uniforms.colorBands[6][3];
|
|
111
|
+
f32[52] = uniforms.colorBands[7][0];
|
|
112
|
+
f32[53] = uniforms.colorBands[7][1];
|
|
113
|
+
f32[54] = uniforms.colorBands[7][2];
|
|
114
|
+
f32[55] = uniforms.colorBands[7][3];
|
|
115
|
+
f32[56] = uniforms.colorBands[8][0];
|
|
116
|
+
f32[57] = uniforms.colorBands[8][1];
|
|
117
|
+
f32[58] = uniforms.colorBands[8][2];
|
|
118
|
+
f32[59] = uniforms.colorBands[8][3];
|
|
119
|
+
}
|
|
120
|
+
export const INSTANCE_STRIDE_BYTES = 16;
|
|
121
|
+
export const INSTANCE_STRIDE_WORDS = 4;
|
|
122
|
+
// Word indices into a Uint32Array view over the instance buffer.
|
|
123
|
+
export const INSTANCE_OFFSET_U32 = {
|
|
124
|
+
x: 0,
|
|
125
|
+
x2: 1,
|
|
126
|
+
row: 2,
|
|
127
|
+
color: 3,
|
|
128
|
+
};
|
|
129
|
+
export const VERTEX_ATTRIBUTES = [
|
|
130
|
+
{ name: 'a_x', components: 1, type: 'uint', offsetBytes: 0, integer: true },
|
|
131
|
+
{ name: 'a_x2', components: 1, type: 'uint', offsetBytes: 4, integer: true },
|
|
132
|
+
{ name: 'a_row', components: 1, type: 'uint', offsetBytes: 8, integer: true },
|
|
133
|
+
{ name: 'a_color', components: 1, type: 'uint', offsetBytes: 12, integer: true },
|
|
134
|
+
];
|
|
135
|
+
export function packInstances(arrays, numInstances, buf = new ArrayBuffer(numInstances * INSTANCE_STRIDE_BYTES)) {
|
|
136
|
+
const u32 = new Uint32Array(buf);
|
|
137
|
+
const { x, x2, row, color } = arrays;
|
|
138
|
+
for (let i = 0; i < numInstances; i++) {
|
|
139
|
+
const o = i * INSTANCE_STRIDE_WORDS;
|
|
140
|
+
u32[o + 0] = x[i];
|
|
141
|
+
u32[o + 1] = x2[i];
|
|
142
|
+
u32[o + 2] = row[i];
|
|
143
|
+
u32[o + 3] = color[i];
|
|
144
|
+
}
|
|
145
|
+
return buf;
|
|
146
|
+
}
|
|
147
|
+
// Instance `i`'s `x`.
|
|
148
|
+
export function getInstanceX(u32, i) {
|
|
149
|
+
return u32[i * INSTANCE_STRIDE_WORDS];
|
|
150
|
+
}
|
|
151
|
+
export function setInstanceX(u32, i, v) {
|
|
152
|
+
u32[i * INSTANCE_STRIDE_WORDS] = v;
|
|
153
|
+
}
|
|
154
|
+
// Instance `i`'s `x2`.
|
|
155
|
+
export function getInstanceX2(u32, i) {
|
|
156
|
+
return u32[i * INSTANCE_STRIDE_WORDS + 1];
|
|
157
|
+
}
|
|
158
|
+
export function setInstanceX2(u32, i, v) {
|
|
159
|
+
u32[i * INSTANCE_STRIDE_WORDS + 1] = v;
|
|
160
|
+
}
|
|
161
|
+
// Instance `i`'s `row`.
|
|
162
|
+
export function getInstanceRow(u32, i) {
|
|
163
|
+
return u32[i * INSTANCE_STRIDE_WORDS + 2];
|
|
164
|
+
}
|
|
165
|
+
export function setInstanceRow(u32, i, v) {
|
|
166
|
+
u32[i * INSTANCE_STRIDE_WORDS + 2] = v;
|
|
167
|
+
}
|
|
168
|
+
// Instance `i`'s `color`.
|
|
169
|
+
export function getInstanceColor(u32, i) {
|
|
170
|
+
return u32[i * INSTANCE_STRIDE_WORDS + 3];
|
|
171
|
+
}
|
|
172
|
+
export function setInstanceColor(u32, i, v) {
|
|
173
|
+
u32[i * INSTANCE_STRIDE_WORDS + 3] = v;
|
|
174
|
+
}
|
|
175
|
+
// Appends instances one at a time, for an encoder that cannot say up front
|
|
176
|
+
// how many it will emit. Seed the constructor with an upper bound and the
|
|
177
|
+
// common path allocates exactly once; the doubling is a correctness
|
|
178
|
+
// backstop, not the expected route.
|
|
179
|
+
export class InstanceWriter {
|
|
180
|
+
buf;
|
|
181
|
+
u32;
|
|
182
|
+
capacity;
|
|
183
|
+
count = 0;
|
|
184
|
+
constructor(capacity) {
|
|
185
|
+
this.capacity = Math.max(1, capacity);
|
|
186
|
+
this.buf = new ArrayBuffer(this.capacity * INSTANCE_STRIDE_BYTES);
|
|
187
|
+
this.u32 = new Uint32Array(this.buf);
|
|
188
|
+
}
|
|
189
|
+
push(x, x2, row, color) {
|
|
190
|
+
if (this.count === this.capacity) {
|
|
191
|
+
this.capacity *= 2;
|
|
192
|
+
const grown = new ArrayBuffer(this.capacity * INSTANCE_STRIDE_BYTES);
|
|
193
|
+
new Uint8Array(grown).set(new Uint8Array(this.buf));
|
|
194
|
+
this.buf = grown;
|
|
195
|
+
this.u32 = new Uint32Array(grown);
|
|
196
|
+
}
|
|
197
|
+
const o = this.count * INSTANCE_STRIDE_WORDS;
|
|
198
|
+
this.u32[o] = x;
|
|
199
|
+
this.u32[o + 1] = x2;
|
|
200
|
+
this.u32[o + 2] = row;
|
|
201
|
+
this.u32[o + 3] = color;
|
|
202
|
+
this.count++;
|
|
203
|
+
}
|
|
204
|
+
// A right-sized COPY, not a subarray view — see the class comment. Skipped
|
|
205
|
+
// entirely when the seed turned out to be exact, which is the common path.
|
|
206
|
+
finish() {
|
|
207
|
+
const used = this.count * INSTANCE_STRIDE_BYTES;
|
|
208
|
+
return used === this.buf.byteLength ? this.buf : this.buf.slice(0, used);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Combined `Sampler2D` bindings. Texture unit indices start at 0.
|
|
212
|
+
export const TEXTURES = [
|
|
213
|
+
{ name: 'colorRamp', glTextureUnit: 0, glUniformName: 'u_colorRamp', filter: 'linear' },
|
|
214
|
+
{ name: 'rowTable', glTextureUnit: 1, glUniformName: 'u_rowTable', filter: 'nearest' },
|
|
215
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S15 : bool = v_0 == u32(0);\n var _S16 : bool;\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(2);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(3);\n }\n var _S17 : f32;\n if(_S16)\n {\n _S17 = 0.0f;\n }\n else\n {\n _S17 = 1.0f;\n }\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(1);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(4);\n }\n var _S18 : f32;\n if(_S16)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n return vec2<f32>(_S17, _S18);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S19 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S19 = - minWidth_0;\n }\n else\n {\n _S19 = minWidth_0;\n }\n _S19 = x1_0 + _S19;\n }\n else\n {\n _S19 = x2_0;\n }\n return _S19;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S20 : texture_2d<f32>, _S21 : sampler, _S22 : u32, _S23 : i32, _S24 : f32, _S25 : f32, _S26 : f32, _S27 : i32, _S28 : vec4<f32>, _S29 : vec4<f32>) -> vec4<f32>\n{\n if(_S23 == i32(0))\n {\n return unpackRGBA_0(_S22);\n }\n if(_S22 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S22 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S22 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S22 & (u32(2147483648)))) != u32(0);\n if(_S23 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S27;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S30 : f32;\n if(negative_0)\n {\n _S30 = 0.0f;\n }\n else\n {\n _S30 = 1.0f;\n }\n return rampColor_0(_S20, _S21, rampMidT_0(_S30, _S26));\n }\n var value_2 : f32 = (bitcast<f32>((_S22)));\n if(_S23 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S27, _S28, _S29)];\n }\n if(_S23 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S20, _S21, rampMidT_0(normalizeScore_0(value_2, _S24, _S25, scaleType_2, 1.0f), _S26));\n}\n\n@vertex\nfn vs_main( _S31 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S32 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S31.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S31.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var o_0 : RowRectVsOut_0;\n if(_S32.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S31.x_2, _S31.x2_2, f32(_S32.slot_0), vid_2, r_0);\n o_0.color_1 = _S32.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S33 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S34 : pixelOutput_0 = pixelOutput_0( _S33.color_3 );\n return _S34;\n}\n\n";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
export const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S15 : bool = v_0 == u32(0);\n var _S16 : bool;\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(2);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(3);\n }\n var _S17 : f32;\n if(_S16)\n {\n _S17 = 0.0f;\n }\n else\n {\n _S17 = 1.0f;\n }\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(1);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(4);\n }\n var _S18 : f32;\n if(_S16)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n return vec2<f32>(_S17, _S18);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S19 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S19 = - minWidth_0;\n }\n else\n {\n _S19 = minWidth_0;\n }\n _S19 = x1_0 + _S19;\n }\n else\n {\n _S19 = x2_0;\n }\n return _S19;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S20 : texture_2d<f32>, _S21 : sampler, _S22 : u32, _S23 : i32, _S24 : f32, _S25 : f32, _S26 : f32, _S27 : i32, _S28 : vec4<f32>, _S29 : vec4<f32>) -> vec4<f32>\n{\n if(_S23 == i32(0))\n {\n return unpackRGBA_0(_S22);\n }\n if(_S22 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S22 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S22 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S22 & (u32(2147483648)))) != u32(0);\n if(_S23 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S27;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S30 : f32;\n if(negative_0)\n {\n _S30 = 0.0f;\n }\n else\n {\n _S30 = 1.0f;\n }\n return rampColor_0(_S20, _S21, rampMidT_0(_S30, _S26));\n }\n var value_2 : f32 = (bitcast<f32>((_S22)));\n if(_S23 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S27, _S28, _S29)];\n }\n if(_S23 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S20, _S21, rampMidT_0(normalizeScore_0(value_2, _S24, _S25, scaleType_2, 1.0f), _S26));\n}\n\n@vertex\nfn vs_main( _S31 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S32 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S31.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S31.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var o_0 : RowRectVsOut_0;\n if(_S32.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S31.x_2, _S31.x2_2, f32(_S32.slot_0), vid_2, r_0);\n o_0.color_1 = _S32.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S33 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S34 : pixelOutput_0 = pixelOutput_0( _S33.color_3 );\n return _S34;\n}\n\n";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable 32-bit slot for a display on a backend it shares with siblings, hashed
|
|
3
|
+
* from its MST node id (djb2). Collisions are vanishingly rare at display
|
|
4
|
+
* cardinalities, and the alternative — coordinating integer slots between
|
|
5
|
+
* displays that don't know about each other — is worse.
|
|
6
|
+
*
|
|
7
|
+
* Key by this, never by the display's index in its parent's list. An index
|
|
8
|
+
* renumbers when a sibling is hidden or reordered, which hands the survivor a
|
|
9
|
+
* slot holding another display's bytes: the keyed diff sees a changed
|
|
10
|
+
* reference and re-uploads every later display's whole buffer, and any frame
|
|
11
|
+
* drawn between the two mistakes one display's geometry for another's.
|
|
12
|
+
*
|
|
13
|
+
* It is also how a display whose own cells are named rather than numbered
|
|
14
|
+
* reaches the per-region backend, whose keys are `displayedRegionIndex`: the
|
|
15
|
+
* multi-way stack's gutters and lanes are one map keyed by this off each
|
|
16
|
+
* layer's name.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sharedBackendKey(id: string): number;
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* slot holding another display's bytes: the keyed diff sees a changed
|
|
10
10
|
* reference and re-uploads every later display's whole buffer, and any frame
|
|
11
11
|
* drawn between the two mistakes one display's geometry for another's.
|
|
12
|
+
*
|
|
13
|
+
* It is also how a display whose own cells are named rather than numbered
|
|
14
|
+
* reaches the per-region backend, whose keys are `displayedRegionIndex`: the
|
|
15
|
+
* multi-way stack's gutters and lanes are one map keyed by this off each
|
|
16
|
+
* layer's name.
|
|
12
17
|
*/
|
|
13
18
|
export function sharedBackendKey(id) {
|
|
14
19
|
let h = 5381;
|
package/esm/slangPass.d.ts
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import type { BlendState, VertexAttributeLayout, PipelineDescriptor, ShaderBinding, TextureBinding } from './hal';
|
|
1
|
+
import type { BlendState, VertexAttributeLayout, PipelineDescriptor, ShaderBinding, ShaderSource, TextureBinding } from './hal';
|
|
2
2
|
export interface ShaderModule {
|
|
3
|
-
|
|
4
|
-
GLSL_VERTEX: string;
|
|
5
|
-
GLSL_FRAGMENT: string;
|
|
3
|
+
SOURCE: ShaderSource;
|
|
6
4
|
INSTANCE_STRIDE_BYTES: number;
|
|
5
|
+
UNIFORMS_SIZE_BYTES: number;
|
|
7
6
|
VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
|
|
8
7
|
VERTS_PER_INSTANCE?: number;
|
|
9
8
|
TOPOLOGY?: PipelineDescriptor['topology'];
|
|
10
9
|
BLEND_STATE?: BlendState;
|
|
10
|
+
COVERAGE?: PipelineDescriptor['coverage'];
|
|
11
11
|
TEXTURES?: readonly [TextureBinding, ...TextureBinding[]];
|
|
12
|
-
BINDINGS
|
|
12
|
+
BINDINGS: readonly ShaderBinding[];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* What a pass is, over and above its shader: an identity, and the handful of
|
|
16
16
|
* choices that are genuinely the *consumer's* rather than the shader's.
|
|
17
17
|
*
|
|
18
18
|
* Every remaining field is an override of something the module already carries,
|
|
19
|
-
*
|
|
20
|
-
* by two passes that disagree:
|
|
19
|
+
* for a shader drawn by two passes that disagree:
|
|
21
20
|
*
|
|
22
21
|
* - `verticesPerInstance` — the canvas chevron pass, whose count is the
|
|
23
22
|
* shader's `CHEVRON_VERTS` times a cap the *renderer* chooses.
|
|
24
|
-
* - `blendState` / `topology` —
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* - `blendState` / `topology` — the synteny fill is the one module drawn under
|
|
24
|
+
* two blends: its strongest-ribbon passes take min or max where the stacking
|
|
25
|
+
* pass inherits src-over, since one uniform switches the fragment between
|
|
26
|
+
* the two outputs. Wiggle's step line and center line each have their own
|
|
27
|
+
* module instead, and the center line states `//! blend: max` itself. A
|
|
28
|
+
* shader whose passes disagree declares neither and says which at each pass.
|
|
27
29
|
* - `blend: false` — nothing disables blending today, which is why there is no
|
|
28
30
|
* `//! blend: none` to inherit it from.
|
|
29
31
|
*
|
|
32
|
+
* There is deliberately no `textures` override either. It existed for one
|
|
33
|
+
* caller, which rebuilt the generated `TEXTURES` with `filter: 'nearest'`
|
|
34
|
+
* because the codegen emitted `linear` for every sampler; the filter a module's
|
|
35
|
+
* math needs is now `//! texture-filter:` in the module, so the pass has
|
|
36
|
+
* nothing left to correct.
|
|
37
|
+
*
|
|
30
38
|
* There is deliberately no `bufferStride` / `bufferAttributes` pair. Two passes
|
|
31
39
|
* sharing one instance buffer (`drawPass(id, region, bufferPassId)`) must
|
|
32
40
|
* declare the same instance struct — canvas's chevron and line both take
|
|
@@ -44,6 +52,5 @@ export interface SlangPassOpts {
|
|
|
44
52
|
topology?: PipelineDescriptor['topology'];
|
|
45
53
|
blend?: boolean;
|
|
46
54
|
blendState?: BlendState;
|
|
47
|
-
textures?: [TextureBinding, ...TextureBinding[]];
|
|
48
55
|
}
|
|
49
56
|
export declare function slangPass(opts: SlangPassOpts): PipelineDescriptor;
|
package/esm/slangPass.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
function generatedBeforeLazyText(mod) {
|
|
2
|
+
return !mod.SOURCE || !mod.BINDINGS?.every(binding => 'stages' in binding);
|
|
3
|
+
}
|
|
1
4
|
export function slangPass(opts) {
|
|
5
|
+
if (generatedBeforeLazyText(opts.mod)) {
|
|
6
|
+
throw new Error(`slangPass(${opts.id}): the shader module has no SOURCE loaders or no ` +
|
|
7
|
+
`binding stages, so an older jbrowse-build-shaders generated it; ` +
|
|
8
|
+
`regenerate it`);
|
|
9
|
+
}
|
|
2
10
|
const verticesPerInstance = opts.verticesPerInstance ?? opts.mod.VERTS_PER_INSTANCE;
|
|
3
11
|
if (verticesPerInstance === undefined) {
|
|
4
12
|
throw new Error(`slangPass(${opts.id}): no verticesPerInstance — declare ` +
|
|
@@ -7,16 +15,16 @@ export function slangPass(opts) {
|
|
|
7
15
|
}
|
|
8
16
|
return {
|
|
9
17
|
id: opts.id,
|
|
10
|
-
|
|
11
|
-
glslVertex: opts.mod.GLSL_VERTEX,
|
|
12
|
-
glslFragment: opts.mod.GLSL_FRAGMENT,
|
|
18
|
+
source: opts.mod.SOURCE,
|
|
13
19
|
instanceStride: opts.mod.INSTANCE_STRIDE_BYTES,
|
|
20
|
+
uniformByteSize: opts.mod.UNIFORMS_SIZE_BYTES,
|
|
14
21
|
verticesPerInstance,
|
|
15
22
|
blend: opts.blend ?? true,
|
|
16
23
|
blendState: opts.blendState ?? opts.mod.BLEND_STATE,
|
|
17
24
|
vertexAttributes: opts.mod.VERTEX_ATTRIBUTES,
|
|
18
25
|
topology: opts.topology ?? opts.mod.TOPOLOGY,
|
|
19
|
-
|
|
26
|
+
coverage: opts.mod.COVERAGE,
|
|
27
|
+
textures: opts.mod.TEXTURES,
|
|
20
28
|
bindings: opts.mod.BINDINGS,
|
|
21
29
|
};
|
|
22
30
|
}
|
|
@@ -9,7 +9,7 @@ import type { GraphicsCapabilities } from './graphicsCapabilities.ts';
|
|
|
9
9
|
* a leaf so a third-party display can bundle it), so every hook here is its own
|
|
10
10
|
* — `useRenderingBackend` and `useTabVisibilityRerender` are the same shape.
|
|
11
11
|
*
|
|
12
|
-
* It is also all this needs. `useFetch` carries keys,
|
|
12
|
+
* It is also all this needs. `useFetch` carries keys, signals, error state
|
|
13
13
|
* and `mutate` for sources that change; capabilities are fixed for the life of
|
|
14
14
|
* the page and already memoized in the module, so there is one value, fetched
|
|
15
15
|
* once, that never invalidates. The effect exists only to deliver it.
|
|
@@ -10,7 +10,7 @@ import { getGraphicsCapabilities } from './graphicsCapabilities.js';
|
|
|
10
10
|
* a leaf so a third-party display can bundle it), so every hook here is its own
|
|
11
11
|
* — `useRenderingBackend` and `useTabVisibilityRerender` are the same shape.
|
|
12
12
|
*
|
|
13
|
-
* It is also all this needs. `useFetch` carries keys,
|
|
13
|
+
* It is also all this needs. `useFetch` carries keys, signals, error state
|
|
14
14
|
* and `mutate` for sources that change; capabilities are fixed for the life of
|
|
15
15
|
* the page and already memoized in the module, so there is one value, fetched
|
|
16
16
|
* once, that never invalidates. The effect exists only to deliver it.
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
export declare const CONTEXT_LOST_REPORT_GRACE_MS = 400;
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* offering it for render errors whose remedy differs (an over-allocation says to
|
|
6
|
-
* zoom in).
|
|
3
|
+
* How far past its scroll port a canvas keeps its GPU targets, as a fraction of
|
|
4
|
+
* the port on each edge.
|
|
7
5
|
*
|
|
8
|
-
* A
|
|
9
|
-
*
|
|
6
|
+
* A band, where `useViewVisibility`'s hard window deliberately has none, and the
|
|
7
|
+
* reason that file gives does not reach here. There the band roughly doubles
|
|
8
|
+
* live WebGL2 contexts against a hard ceiling of 16, so it costs a resource the
|
|
9
|
+
* page runs out of; here it costs bytes, and bytes have no cliff. What the band
|
|
10
|
+
* buys is the frame: intersection callbacks are delivered after the frame that
|
|
11
|
+
* moved the canvas has painted, so a hard edge shows one blank frame on the way
|
|
12
|
+
* back in. Repainting a quarter of a port early puts the redraw several frames
|
|
13
|
+
* ahead of the pixels at any ordinary scroll speed.
|
|
10
14
|
*/
|
|
11
|
-
export declare
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export declare function createGpuDeviceLostError(): Error & {
|
|
15
|
-
gpuContextLost: true;
|
|
16
|
-
};
|
|
17
|
-
export declare function isGpuContextLostError(error: unknown): error is object & Record<"gpuContextLost", unknown>;
|
|
15
|
+
export declare const OFFSCREEN_RELEASE_BAND = "25%";
|
|
16
|
+
export { createGpuContextLostError, createGpuDeviceLostError, createGpuSurfaceLostError, isGpuContextLostError, } from './gpuContextLostError.ts';
|
|
18
17
|
/**
|
|
19
18
|
* Duck-typed shape of an MST display model that owns a GPU backend
|
|
20
19
|
* lifecycle via `RenderLifecycleMixin`. Plugins pass their own
|
|
@@ -26,6 +25,7 @@ export interface RenderLifecycleModel<RenderingBackendType> {
|
|
|
26
25
|
renderNow: () => void;
|
|
27
26
|
renderError: unknown;
|
|
28
27
|
setRenderError: (error: unknown) => void;
|
|
28
|
+
setOffScreen: (offScreen: boolean) => void;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Drives the GPU/Canvas2D backend lifecycle for a display: canvas
|