@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
|
@@ -7,31 +7,27 @@ import type { GpuHal, PipelineDescriptor, SampleCount } from './hal/types.ts';
|
|
|
7
7
|
*/
|
|
8
8
|
export interface RenderingBackendOptions<TRenderingBackend> {
|
|
9
9
|
passes: PipelineDescriptor[];
|
|
10
|
-
uniformByteSize: number;
|
|
11
10
|
/**
|
|
12
|
-
* Samples per pixel this display's WebGPU target is allocated at
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Samples per pixel this display's WebGPU target is allocated at. Omitted, it
|
|
12
|
+
* is derived from `passes`: 1 when every registered pass declares
|
|
13
|
+
* `//! coverage: analytic`, else 4. Registered, not drawn — an inactive pass
|
|
14
|
+
* that leans on MSAA holds its display at 4. Passing it overrides the
|
|
15
|
+
* derivation in either direction.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* conflation at the shared edges of tiled cells, which is Hi-C and LD.
|
|
24
|
-
*
|
|
25
|
-
* Setting it to 1 allocates **no** target rather than a smaller one. Which
|
|
26
|
-
* displays should is a look-at-the-pixels decision taken one display at a
|
|
27
|
-
* time; `ideas/arc-antialiasing-without-msaa.md` is the survey and the
|
|
28
|
-
* captures.
|
|
17
|
+
* The cost is one colour attachment the size of the canvas — an empty 600px
|
|
18
|
+
* track pays what a full one does, and eight ordinary tracks on a retina
|
|
19
|
+
* panel hold 109.7 MiB nothing counts (ARCHITECTURAL_LIMITS.md §"The MSAA
|
|
20
|
+
* target is the largest per-display allocation"); 1 allocates none. Whether a
|
|
21
|
+
* display's pixels survive the flip is a look-at-the-pixels decision taken
|
|
22
|
+
* one display at a time; `ideas/waiting-on-a-number/arc-antialiasing-without-msaa.md` is the
|
|
23
|
+
* survey and the captures.
|
|
29
24
|
*/
|
|
30
25
|
sampleCount?: SampleCount;
|
|
31
26
|
createGpuBackend: (hal: GpuHal) => TRenderingBackend;
|
|
32
27
|
createCanvas2DBackend: (canvas: HTMLCanvasElement) => TRenderingBackend;
|
|
33
28
|
}
|
|
34
|
-
export declare function
|
|
29
|
+
export declare function deriveSampleCount(passes: readonly PipelineDescriptor[]): SampleCount;
|
|
30
|
+
export declare function createRenderingBackend<TRenderingBackend>(canvas: HTMLCanvasElement, { passes, sampleCount, createGpuBackend, createCanvas2DBackend, }: RenderingBackendOptions<TRenderingBackend>): Promise<TRenderingBackend>;
|
|
35
31
|
/**
|
|
36
32
|
* Factory for a **Canvas2D-only** display — one that ships no GPU shader path.
|
|
37
33
|
*
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { assertUniquePassIds, createGpuHal } from './hal/index.js';
|
|
2
|
-
export
|
|
2
|
+
export function deriveSampleCount(passes) {
|
|
3
|
+
return passes.every(p => p.coverage === 'analytic') ? 1 : 4;
|
|
4
|
+
}
|
|
5
|
+
export async function createRenderingBackend(canvas, { passes, sampleCount = deriveSampleCount(passes), createGpuBackend, createCanvas2DBackend, }) {
|
|
3
6
|
// Before the ladder, so a duplicate id is reported on every machine rather
|
|
4
7
|
// than only the ones that reach a GPU rung — the bug it prevents is silent
|
|
5
8
|
// and GPU-only, which is precisely why a developer on the Canvas2D fallback
|
|
@@ -15,7 +18,6 @@ export async function createRenderingBackend(canvas, { passes, uniformByteSize,
|
|
|
15
18
|
const ladderFailures = [];
|
|
16
19
|
const hal = await createGpuHal(canvas, {
|
|
17
20
|
passes,
|
|
18
|
-
uniformByteSize,
|
|
19
21
|
sampleCount,
|
|
20
22
|
failures: ladderFailures,
|
|
21
23
|
});
|
package/esm/displayPhase.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The mutually-exclusive visual state of a GPU display. Computing it in one
|
|
3
|
-
* place means the precedence — renderError > tooLarge > error >
|
|
4
|
-
* — lives in a single function instead of being re-encoded by
|
|
5
|
-
* (`&& !regionTooLarge && !error && !renderError`) in every display
|
|
6
|
-
* mirrored a second time by `DisplayChrome`'s JSX order.
|
|
7
|
-
* switches on it; the loading scrim's visibility is just
|
|
8
|
-
* `displayPhase === 'loading'`, computed once in the chrome.
|
|
3
|
+
* place means the precedence — renderError > tooLarge > error > canceled >
|
|
4
|
+
* loading > ready — lives in a single function instead of being re-encoded by
|
|
5
|
+
* subtraction (`&& !regionTooLarge && !error && !renderError`) in every display
|
|
6
|
+
* model AND mirrored a second time by `DisplayChrome`'s JSX order.
|
|
9
7
|
*
|
|
10
8
|
* `renderError` and `tooLarge` replace the whole display subtree (their own
|
|
11
9
|
* root element, so the transition unmounts the canvas → `canvasRef(null)` →
|
|
12
|
-
* `backend.dispose()`). `error` and `loading` are overlays rendered
|
|
13
|
-
* still-mounted canvas, so they share the `ready` branch's root.
|
|
10
|
+
* `backend.dispose()`). `error`, `canceled` and `loading` are overlays rendered
|
|
11
|
+
* *over* the still-mounted canvas, so they share the `ready` branch's root.
|
|
12
|
+
*
|
|
13
|
+
* `loading` is the one phase that means work is outstanding: every reader
|
|
14
|
+
* asking "is it finished" (`AppReadyMarker`, `jb.waitReady`, the capture waits)
|
|
15
|
+
* treats every other phase as finished. `canceled` is the user's standing stop,
|
|
16
|
+
* durable until Retry (or, on the LGV families, a viewport change); the chrome
|
|
17
|
+
* draws it as the loading overlay in its canceled state, which carries Retry.
|
|
14
18
|
*/
|
|
15
19
|
export type DisplayPhase = 'renderError' | DisplayStatusPhase;
|
|
16
20
|
/**
|
|
@@ -20,10 +24,14 @@ export type DisplayPhase = 'renderError' | DisplayStatusPhase;
|
|
|
20
24
|
* (the backend hook's `retry()`), which is exactly the line between the shared
|
|
21
25
|
* status chrome and the GPU chrome wrapped around it: `DisplayStatusChrome`
|
|
22
26
|
* takes this, `DisplayChrome` takes the wider union and peels off `renderError`
|
|
23
|
-
* before delegating.
|
|
24
|
-
|
|
27
|
+
* before delegating.
|
|
28
|
+
*/
|
|
29
|
+
export type DisplayStatusPhase = 'tooLarge' | 'error' | DisplayActivityPhase;
|
|
30
|
+
/**
|
|
31
|
+
* What is left once no failure terminal holds, as `computeActivityPhase`
|
|
32
|
+
* answers it for every fetching family.
|
|
25
33
|
*/
|
|
26
|
-
export type
|
|
34
|
+
export type DisplayActivityPhase = 'canceled' | 'loading' | 'ready';
|
|
27
35
|
export interface DisplayStatusPhaseInputs {
|
|
28
36
|
regionTooLarge: boolean;
|
|
29
37
|
error: unknown;
|
|
@@ -32,124 +40,95 @@ export interface DisplayPhaseInputs extends DisplayStatusPhaseInputs {
|
|
|
32
40
|
renderError: unknown;
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* layers a zoom gate on top. The terminal precedence above it is identical for
|
|
38
|
-
* every display, so it lives here — pass the display's loading condition and
|
|
39
|
-
* get the resolved phase back.
|
|
43
|
+
* The terminal precedence shared by every display, over the display's own
|
|
44
|
+
* activity phase.
|
|
40
45
|
*
|
|
41
|
-
* `
|
|
42
|
-
* ruled out.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* React-reconciliation hazard documented in DisplayChrome.tsx). Short-circuiting
|
|
49
|
-
* keeps the tracked set to just the terminal flags when one is active, matching
|
|
50
|
-
* the old direct-read early-returns.
|
|
46
|
+
* `activity` is a **thunk**, evaluated only after the three failure terminals
|
|
47
|
+
* are ruled out. Load-bearing for MobX: the activity condition typically reads
|
|
48
|
+
* the containing view (`visibleRegions`, `loadedRegions`, …), and evaluating it
|
|
49
|
+
* eagerly would subscribe every reader of `displayPhase` to that churn even
|
|
50
|
+
* while a banner is up — and `DisplayChrome`'s observer, re-firing during a
|
|
51
|
+
* terminal state, then fails to commit the banner subtree (see
|
|
52
|
+
* DisplayChrome.tsx).
|
|
51
53
|
*/
|
|
52
|
-
export declare function computeDisplayPhase({ renderError, regionTooLarge, error }: DisplayPhaseInputs,
|
|
54
|
+
export declare function computeDisplayPhase({ renderError, regionTooLarge, error }: DisplayPhaseInputs, activity: () => DisplayActivityPhase): DisplayPhase;
|
|
53
55
|
/**
|
|
54
|
-
* The
|
|
55
|
-
*
|
|
56
|
-
*
|
|
56
|
+
* The terms the activity phase is built from, minus the thunks. All cheap flags
|
|
57
|
+
* on the display itself, so they are read eagerly the same way
|
|
58
|
+
* `computeDisplayPhase` reads its terminals.
|
|
57
59
|
*/
|
|
58
|
-
export interface
|
|
60
|
+
export interface DisplayActivityInputs {
|
|
61
|
+
/**
|
|
62
|
+
* The containing track is minimized. Every fetch gate skips a minimized
|
|
63
|
+
* track and its canvas is unmounted, so nothing the terms below wait on can
|
|
64
|
+
* arrive. Suppresses them all, like `fetchInert`, which a subclass overrides
|
|
65
|
+
* outright and so cannot carry it.
|
|
66
|
+
*/
|
|
67
|
+
isMinimized: boolean;
|
|
59
68
|
/**
|
|
60
69
|
* The display is deliberately showing a static message instead of data
|
|
61
|
-
* (sequence past base resolution, LD with the triangle off)
|
|
62
|
-
*
|
|
63
|
-
* not a substitute: that one drops the pre-first-paint term alone
|
|
64
|
-
* fetch terms free to scrim over the placeholder, and `isLoadingOrCanceled`
|
|
65
|
-
* includes a cancel that is deliberately durable.
|
|
70
|
+
* (sequence past base resolution, LD with the triangle off). Suppresses every
|
|
71
|
+
* term below, a standing cancel included — which is why `rendersCanvas: false`
|
|
72
|
+
* is not a substitute: that one drops the pre-first-paint term alone.
|
|
66
73
|
*/
|
|
67
74
|
fetchInert: boolean;
|
|
68
75
|
/**
|
|
69
|
-
* The view holds no content block
|
|
70
|
-
*
|
|
71
|
-
* `
|
|
72
|
-
* `viewportEmpty`). Suppresses every term below for the same reason
|
|
73
|
-
* `fetchInert` does, and it is the pre-first-paint one that makes it
|
|
74
|
-
* necessary: no fetch is issued, so `canvasDrawn` is never set and the scrim
|
|
75
|
-
* would sit there for as long as the viewport stays off content.
|
|
76
|
+
* The view holds no content block (`showAllRegions` over a region set whose
|
|
77
|
+
* every member falls under `minimumBlockWidth`; see `viewportEmpty`), so no
|
|
78
|
+
* fetch is issued and `canvasDrawn` is never set. Suppresses every term below.
|
|
76
79
|
*/
|
|
77
80
|
viewportEmpty: boolean;
|
|
81
|
+
/** a fetch is in flight */
|
|
82
|
+
isLoading: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The user canceled a fetch and has not retried. Outranks every loading term,
|
|
85
|
+
* since what those wait on is the fetch the user stopped. Kept apart from
|
|
86
|
+
* `isLoading` because a cancel is finished, not pending: folded into the
|
|
87
|
+
* loading term, a canceled display read `loading` until Retry and parked every
|
|
88
|
+
* readiness gate on it.
|
|
89
|
+
*/
|
|
90
|
+
fetchCanceled: boolean;
|
|
78
91
|
/**
|
|
79
|
-
* A
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
92
|
+
* A load this display depends on beyond its primary fetch has not landed for
|
|
93
|
+
* the first time (multi-way synteny's lane genes and links). A loading term
|
|
94
|
+
* rather than a `dataSuperseded` fold: that flag holds the export through
|
|
95
|
+
* every later refetch too, and a scrim over lanes already drawn is the thing
|
|
96
|
+
* a display saying this wants to avoid.
|
|
84
97
|
*/
|
|
85
|
-
|
|
98
|
+
awaitingDependentData: boolean;
|
|
86
99
|
/**
|
|
87
100
|
* Whether this display paints a canvas in its current configuration. Gates
|
|
88
|
-
* the pre-first-paint term alone, because a display
|
|
89
|
-
*
|
|
90
|
-
* `canvasDrawn` and would sit under the scrim forever.
|
|
101
|
+
* the pre-first-paint term alone, because a display showing a deliberate
|
|
102
|
+
* non-canvas placeholder (LD with the triangle off) never flips `canvasDrawn`.
|
|
91
103
|
*/
|
|
92
104
|
rendersCanvas: boolean;
|
|
93
105
|
/** first paint has happened */
|
|
94
106
|
canvasDrawn: boolean;
|
|
95
107
|
}
|
|
96
108
|
/**
|
|
97
|
-
* The
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* three ways that were equivalent only by accident: the per-region family spelled
|
|
102
|
-
* the cancel term out by hand (`!isReady || … || fetchCanceled`, over a bare
|
|
103
|
-
* `isLoading`) rather than reading `isLoadingOrCanceled`, and each family carried
|
|
104
|
-
* exactly one of the two suppression hooks — `fetchInert` on per-region,
|
|
105
|
-
* `rendersCanvas` on global — so a display in the other family could express its
|
|
106
|
-
* case only by overriding `displayPhase`, which is the thing both hooks exist to
|
|
107
|
-
* prevent. Single-sourcing the expression is the same argument the precedence
|
|
108
|
-
* above already won, one level down: a term added here reaches every display,
|
|
109
|
-
* instead of reaching whichever family the author happened to be reading.
|
|
110
|
-
*
|
|
111
|
-
* The four inputs all now live on a mixin every foundation composes —
|
|
112
|
-
* `fetchInert` / `isLoadingOrCanceled` on `FetchMixin`, `rendersCanvas` /
|
|
113
|
-
* `canvasDrawn` on `RenderLifecycleMixin` — so `foundationDisplayPhase` passes
|
|
114
|
-
* the model straight through and the only thing a family supplies is
|
|
115
|
-
* `viewportCurrent`: per-region its staleness predicate, global `() => true` (it
|
|
116
|
-
* keeps the last frame up through a refetch rather than scrimming). Two hooks
|
|
117
|
-
* used to be hard-coded per family instead, which is how the second drift
|
|
118
|
-
* happened after the first was fixed — LD needed `fetchInert` and the
|
|
119
|
-
* global family did not have it.
|
|
109
|
+
* The activity phase, expressed once for every fetching display family, so a
|
|
110
|
+
* term added here reaches every display. The two LGV families hand-wrote it
|
|
111
|
+
* until they had drifted on the cancel term and on which suppression hook each
|
|
112
|
+
* carried.
|
|
120
113
|
*
|
|
121
|
-
* `viewportCurrent` is a **thunk** for the
|
|
122
|
-
* `
|
|
123
|
-
*
|
|
124
|
-
*
|
|
114
|
+
* `viewportCurrent` is a **thunk** for the MobX reason `computeDisplayPhase`'s
|
|
115
|
+
* `activity` is: it reads the containing view, while the flags above are on the
|
|
116
|
+
* display. Per-region passes its staleness predicate, global `() => true` (it
|
|
117
|
+
* keeps the last frame up through a refetch rather than scrimming).
|
|
125
118
|
*
|
|
126
119
|
* `hostMounted` is a thunk for the same reason, and gates the **pre-first-paint
|
|
127
|
-
* term only**.
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* It is a required flag on every view and on the duck-typed host contracts, not
|
|
135
|
-
* an optional one defaulted here: a stand-in that forgot it would silently
|
|
136
|
-
* excuse the first paint and let a readiness gate fire over a view that had not
|
|
137
|
-
* started.
|
|
138
|
-
*
|
|
139
|
-
* The fetch terms deliberately stay live while unmounted: an off-screen display
|
|
140
|
-
* still fetches, so reporting it idle would let a readiness gate fire over work
|
|
141
|
-
* genuinely in flight — and during cold load `visible` is false until the
|
|
142
|
-
* IntersectionObserver's first callback, which is exactly when a display must
|
|
143
|
-
* not flash `ready`. Only the paint it will never do is excused.
|
|
120
|
+
* term only**. `ViewContainer` mounts an off-screen view's body lazily, so its
|
|
121
|
+
* display has no canvas and `!canvasDrawn` could never resolve — which parked
|
|
122
|
+
* `[data-app-phase="ready"]` for the whole app. It is required on every view and
|
|
123
|
+
* host contract rather than defaulted there, so a stand-in has to state it and
|
|
124
|
+
* cannot excuse the first paint by omission. The fetch terms stay live while unmounted: an
|
|
125
|
+
* off-screen display still fetches, and during cold load `visible` is false
|
|
126
|
+
* until the IntersectionObserver's first callback.
|
|
144
127
|
*/
|
|
145
|
-
export declare function
|
|
128
|
+
export declare function computeActivityPhase({ isMinimized, fetchInert, viewportEmpty, isLoading, fetchCanceled, awaitingDependentData, rendersCanvas, canvasDrawn, }: DisplayActivityInputs, viewportCurrent: () => boolean, hostMounted?: () => boolean): DisplayActivityPhase;
|
|
146
129
|
/**
|
|
147
130
|
* The same ranking minus `renderError`, for a display with no rendering backend
|
|
148
|
-
* to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here
|
|
149
|
-
*
|
|
150
|
-
* and the narrower return type is what lets `DisplayStatusChrome` accept a
|
|
151
|
-
* backend-less display without either a cast or a dead branch.
|
|
152
|
-
*
|
|
153
|
-
* `loading` is a thunk here for the same reason as above.
|
|
131
|
+
* to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here, so the
|
|
132
|
+
* order lives in one place.
|
|
154
133
|
*/
|
|
155
|
-
export declare function computeDisplayStatusPhase({ regionTooLarge, error }: DisplayStatusPhaseInputs,
|
|
134
|
+
export declare function computeDisplayStatusPhase({ regionTooLarge, error }: DisplayStatusPhaseInputs, activity: () => DisplayActivityPhase): DisplayStatusPhase;
|
package/esm/displayPhase.js
CHANGED
|
@@ -1,97 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* would make every reader of `displayPhase` subscribe to all of it even while a
|
|
13
|
-
* banner is up — and `DisplayChrome`'s observer, re-firing on that churn during
|
|
14
|
-
* a terminal state, then fails to commit the banner subtree to the DOM (the
|
|
15
|
-
* React-reconciliation hazard documented in DisplayChrome.tsx). Short-circuiting
|
|
16
|
-
* keeps the tracked set to just the terminal flags when one is active, matching
|
|
17
|
-
* the old direct-read early-returns.
|
|
2
|
+
* The terminal precedence shared by every display, over the display's own
|
|
3
|
+
* activity phase.
|
|
4
|
+
*
|
|
5
|
+
* `activity` is a **thunk**, evaluated only after the three failure terminals
|
|
6
|
+
* are ruled out. Load-bearing for MobX: the activity condition typically reads
|
|
7
|
+
* the containing view (`visibleRegions`, `loadedRegions`, …), and evaluating it
|
|
8
|
+
* eagerly would subscribe every reader of `displayPhase` to that churn even
|
|
9
|
+
* while a banner is up — and `DisplayChrome`'s observer, re-firing during a
|
|
10
|
+
* terminal state, then fails to commit the banner subtree (see
|
|
11
|
+
* DisplayChrome.tsx).
|
|
18
12
|
*/
|
|
19
|
-
export function computeDisplayPhase({ renderError, regionTooLarge, error },
|
|
13
|
+
export function computeDisplayPhase({ renderError, regionTooLarge, error }, activity) {
|
|
20
14
|
return renderError
|
|
21
15
|
? 'renderError'
|
|
22
|
-
: computeDisplayStatusPhase({ regionTooLarge, error },
|
|
16
|
+
: computeDisplayStatusPhase({ regionTooLarge, error }, activity);
|
|
23
17
|
}
|
|
24
18
|
/**
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* three ways that were equivalent only by accident: the per-region family spelled
|
|
30
|
-
* the cancel term out by hand (`!isReady || … || fetchCanceled`, over a bare
|
|
31
|
-
* `isLoading`) rather than reading `isLoadingOrCanceled`, and each family carried
|
|
32
|
-
* exactly one of the two suppression hooks — `fetchInert` on per-region,
|
|
33
|
-
* `rendersCanvas` on global — so a display in the other family could express its
|
|
34
|
-
* case only by overriding `displayPhase`, which is the thing both hooks exist to
|
|
35
|
-
* prevent. Single-sourcing the expression is the same argument the precedence
|
|
36
|
-
* above already won, one level down: a term added here reaches every display,
|
|
37
|
-
* instead of reaching whichever family the author happened to be reading.
|
|
38
|
-
*
|
|
39
|
-
* The four inputs all now live on a mixin every foundation composes —
|
|
40
|
-
* `fetchInert` / `isLoadingOrCanceled` on `FetchMixin`, `rendersCanvas` /
|
|
41
|
-
* `canvasDrawn` on `RenderLifecycleMixin` — so `foundationDisplayPhase` passes
|
|
42
|
-
* the model straight through and the only thing a family supplies is
|
|
43
|
-
* `viewportCurrent`: per-region its staleness predicate, global `() => true` (it
|
|
44
|
-
* keeps the last frame up through a refetch rather than scrimming). Two hooks
|
|
45
|
-
* used to be hard-coded per family instead, which is how the second drift
|
|
46
|
-
* happened after the first was fixed — LD needed `fetchInert` and the
|
|
47
|
-
* global family did not have it.
|
|
19
|
+
* The activity phase, expressed once for every fetching display family, so a
|
|
20
|
+
* term added here reaches every display. The two LGV families hand-wrote it
|
|
21
|
+
* until they had drifted on the cancel term and on which suppression hook each
|
|
22
|
+
* carried.
|
|
48
23
|
*
|
|
49
|
-
* `viewportCurrent` is a **thunk** for the
|
|
50
|
-
* `
|
|
51
|
-
*
|
|
52
|
-
*
|
|
24
|
+
* `viewportCurrent` is a **thunk** for the MobX reason `computeDisplayPhase`'s
|
|
25
|
+
* `activity` is: it reads the containing view, while the flags above are on the
|
|
26
|
+
* display. Per-region passes its staleness predicate, global `() => true` (it
|
|
27
|
+
* keeps the last frame up through a refetch rather than scrimming).
|
|
53
28
|
*
|
|
54
29
|
* `hostMounted` is a thunk for the same reason, and gates the **pre-first-paint
|
|
55
|
-
* term only**.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* It is a required flag on every view and on the duck-typed host contracts, not
|
|
63
|
-
* an optional one defaulted here: a stand-in that forgot it would silently
|
|
64
|
-
* excuse the first paint and let a readiness gate fire over a view that had not
|
|
65
|
-
* started.
|
|
66
|
-
*
|
|
67
|
-
* The fetch terms deliberately stay live while unmounted: an off-screen display
|
|
68
|
-
* still fetches, so reporting it idle would let a readiness gate fire over work
|
|
69
|
-
* genuinely in flight — and during cold load `visible` is false until the
|
|
70
|
-
* IntersectionObserver's first callback, which is exactly when a display must
|
|
71
|
-
* not flash `ready`. Only the paint it will never do is excused.
|
|
30
|
+
* term only**. `ViewContainer` mounts an off-screen view's body lazily, so its
|
|
31
|
+
* display has no canvas and `!canvasDrawn` could never resolve — which parked
|
|
32
|
+
* `[data-app-phase="ready"]` for the whole app. It is required on every view and
|
|
33
|
+
* host contract rather than defaulted there, so a stand-in has to state it and
|
|
34
|
+
* cannot excuse the first paint by omission. The fetch terms stay live while unmounted: an
|
|
35
|
+
* off-screen display still fetches, and during cold load `visible` is false
|
|
36
|
+
* until the IntersectionObserver's first callback.
|
|
72
37
|
*/
|
|
73
|
-
export function
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
38
|
+
export function computeActivityPhase({ isMinimized, fetchInert, viewportEmpty, isLoading, fetchCanceled, awaitingDependentData, rendersCanvas, canvasDrawn, }, viewportCurrent, hostMounted = () => true) {
|
|
39
|
+
return isMinimized || fetchInert || viewportEmpty
|
|
40
|
+
? 'ready'
|
|
41
|
+
: fetchCanceled
|
|
42
|
+
? 'canceled'
|
|
43
|
+
: isLoading ||
|
|
44
|
+
awaitingDependentData ||
|
|
45
|
+
(rendersCanvas && hostMounted() && !canvasDrawn) ||
|
|
46
|
+
!viewportCurrent()
|
|
47
|
+
? 'loading'
|
|
48
|
+
: 'ready';
|
|
79
49
|
}
|
|
80
50
|
/**
|
|
81
51
|
* The same ranking minus `renderError`, for a display with no rendering backend
|
|
82
|
-
* to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here
|
|
83
|
-
*
|
|
84
|
-
* and the narrower return type is what lets `DisplayStatusChrome` accept a
|
|
85
|
-
* backend-less display without either a cast or a dead branch.
|
|
86
|
-
*
|
|
87
|
-
* `loading` is a thunk here for the same reason as above.
|
|
52
|
+
* to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here, so the
|
|
53
|
+
* order lives in one place.
|
|
88
54
|
*/
|
|
89
|
-
export function computeDisplayStatusPhase({ regionTooLarge, error },
|
|
90
|
-
return regionTooLarge
|
|
91
|
-
? 'tooLarge'
|
|
92
|
-
: error
|
|
93
|
-
? 'error'
|
|
94
|
-
: loading()
|
|
95
|
-
? 'loading'
|
|
96
|
-
: 'ready';
|
|
55
|
+
export function computeDisplayStatusPhase({ regionTooLarge, error }, activity) {
|
|
56
|
+
return regionTooLarge ? 'tooLarge' : error ? 'error' : activity();
|
|
97
57
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A per-key encode memo over a display's cell map: `encode` runs for a key
|
|
3
|
+
* when its data reference moves, every key re-encodes when `inputs` yields a
|
|
4
|
+
* new identity, and a departed key is dropped. `inputs` runs through a
|
|
5
|
+
* `computed`, so a getter that allocates a fresh object per read re-encodes
|
|
6
|
+
* only when what it read changed.
|
|
7
|
+
*
|
|
8
|
+
* The returned map is a new instance whenever an entry moved and the same one
|
|
9
|
+
* otherwise, so an MST view holding it invalidates its observers exactly when
|
|
10
|
+
* a cell did. `installUpload` runs its `encode` path on this; a display that
|
|
11
|
+
* needs the encoded map itself — for a hit test, an SVG export — holds one in
|
|
12
|
+
* a `.views` closure and hands the installer identity cells.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createEncodeMemo<K, Data, Props, Encoded>(cells: () => ReadonlyMap<K, Data>, inputs: (() => Props) | undefined, encode: (data: Data, props: Props, key: K) => Encoded): () => ReadonlyMap<K, Encoded>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { computed } from 'mobx';
|
|
2
|
+
/**
|
|
3
|
+
* A per-key encode memo over a display's cell map: `encode` runs for a key
|
|
4
|
+
* when its data reference moves, every key re-encodes when `inputs` yields a
|
|
5
|
+
* new identity, and a departed key is dropped. `inputs` runs through a
|
|
6
|
+
* `computed`, so a getter that allocates a fresh object per read re-encodes
|
|
7
|
+
* only when what it read changed.
|
|
8
|
+
*
|
|
9
|
+
* The returned map is a new instance whenever an entry moved and the same one
|
|
10
|
+
* otherwise, so an MST view holding it invalidates its observers exactly when
|
|
11
|
+
* a cell did. `installUpload` runs its `encode` path on this; a display that
|
|
12
|
+
* needs the encoded map itself — for a hit test, an SVG export — holds one in
|
|
13
|
+
* a `.views` closure and hands the installer identity cells.
|
|
14
|
+
*/
|
|
15
|
+
export function createEncodeMemo(cells, inputs, encode) {
|
|
16
|
+
const encoded = new Map();
|
|
17
|
+
const encodedFrom = new Map();
|
|
18
|
+
const props = inputs && computed(inputs);
|
|
19
|
+
let lastProps;
|
|
20
|
+
let snapshot = encoded;
|
|
21
|
+
return () => {
|
|
22
|
+
const current = cells();
|
|
23
|
+
const p = props ? props.get() : undefined;
|
|
24
|
+
if (p !== lastProps) {
|
|
25
|
+
lastProps = p;
|
|
26
|
+
encodedFrom.clear();
|
|
27
|
+
}
|
|
28
|
+
let changed = false;
|
|
29
|
+
for (const [key, data] of current) {
|
|
30
|
+
if (encodedFrom.get(key) !== data) {
|
|
31
|
+
encoded.set(key, encode(data, p, key));
|
|
32
|
+
encodedFrom.set(key, data);
|
|
33
|
+
changed = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
for (const key of encoded.keys()) {
|
|
37
|
+
if (!current.has(key)) {
|
|
38
|
+
encoded.delete(key);
|
|
39
|
+
encodedFrom.delete(key);
|
|
40
|
+
changed = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (changed) {
|
|
44
|
+
snapshot = new Map(encoded);
|
|
45
|
+
}
|
|
46
|
+
return snapshot;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flagged rather than matched by message or `instanceof`, so the error UI can
|
|
3
|
+
* offer the remedy specific to a loss (switch the page to Canvas2D) without
|
|
4
|
+
* offering it for render errors whose remedy differs (an over-allocation says to
|
|
5
|
+
* zoom in).
|
|
6
|
+
*
|
|
7
|
+
* A lost WebGPU device carries the same flag deliberately: the two causes
|
|
8
|
+
* differ, but the remedy on offer — take the page off the GPU — is the same one.
|
|
9
|
+
*
|
|
10
|
+
* React-free, and split out of `useRenderingBackend` for that reason: the HAL
|
|
11
|
+
* raises the surface error below and must not import a hook to do it.
|
|
12
|
+
* `useRenderingBackend` re-exports these, so every existing import site keeps
|
|
13
|
+
* working.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createGpuContextLostError(message?: string): Error & {
|
|
16
|
+
gpuContextLost: true;
|
|
17
|
+
};
|
|
18
|
+
export declare function createGpuDeviceLostError(): Error & {
|
|
19
|
+
gpuContextLost: true;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A canvas whose swap-chain image the driver refuses. Distinct from a device
|
|
23
|
+
* loss, because the device is fine and still renders offscreen, and distinct
|
|
24
|
+
* from an over-limit allocation, because zooming in does not fix it. Canvas2D
|
|
25
|
+
* does, which is why this carries the flag that puts that button on the banner.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createGpuSurfaceLostError(detail: string): Error & {
|
|
28
|
+
gpuContextLost: true;
|
|
29
|
+
};
|
|
30
|
+
export declare function isGpuContextLostError(error: unknown): error is object & Record<"gpuContextLost", unknown>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const CONTEXT_LOST_MESSAGE = 'WebGL context lost. The browser reclaimed the GPU context for this display, ' +
|
|
2
|
+
'usually because too many GPU-rendered views are open at once.';
|
|
3
|
+
const DEVICE_LOST_MESSAGE = 'WebGPU device lost. The GPU device backing this display went away and kept ' +
|
|
4
|
+
'going away after several attempts to rebuild on a fresh one.';
|
|
5
|
+
const SURFACE_LOST_MESSAGE = 'WebGPU could not give this display a drawable surface. The GPU driver ' +
|
|
6
|
+
'rejected the canvas image, so every frame this display submits is discarded.';
|
|
7
|
+
/**
|
|
8
|
+
* Flagged rather than matched by message or `instanceof`, so the error UI can
|
|
9
|
+
* offer the remedy specific to a loss (switch the page to Canvas2D) without
|
|
10
|
+
* offering it for render errors whose remedy differs (an over-allocation says to
|
|
11
|
+
* zoom in).
|
|
12
|
+
*
|
|
13
|
+
* A lost WebGPU device carries the same flag deliberately: the two causes
|
|
14
|
+
* differ, but the remedy on offer — take the page off the GPU — is the same one.
|
|
15
|
+
*
|
|
16
|
+
* React-free, and split out of `useRenderingBackend` for that reason: the HAL
|
|
17
|
+
* raises the surface error below and must not import a hook to do it.
|
|
18
|
+
* `useRenderingBackend` re-exports these, so every existing import site keeps
|
|
19
|
+
* working.
|
|
20
|
+
*/
|
|
21
|
+
export function createGpuContextLostError(message = CONTEXT_LOST_MESSAGE) {
|
|
22
|
+
return Object.assign(new Error(message), {
|
|
23
|
+
gpuContextLost: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function createGpuDeviceLostError() {
|
|
27
|
+
return createGpuContextLostError(DEVICE_LOST_MESSAGE);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A canvas whose swap-chain image the driver refuses. Distinct from a device
|
|
31
|
+
* loss, because the device is fine and still renders offscreen, and distinct
|
|
32
|
+
* from an over-limit allocation, because zooming in does not fix it. Canvas2D
|
|
33
|
+
* does, which is why this carries the flag that puts that button on the banner.
|
|
34
|
+
*/
|
|
35
|
+
export function createGpuSurfaceLostError(detail) {
|
|
36
|
+
return createGpuContextLostError(`${SURFACE_LOST_MESSAGE} (${detail})`);
|
|
37
|
+
}
|
|
38
|
+
export function isGpuContextLostError(error) {
|
|
39
|
+
return (typeof error === 'object' && error !== null && 'gpuContextLost' in error);
|
|
40
|
+
}
|