@jbrowse/render-core 5.0.0-beta.7 → 5.0.0-beta.9
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 +7 -6
- package/esm/RenderLifecycleMixin.js +7 -6
- package/esm/canvas2dUtils.d.ts +58 -17
- package/esm/canvas2dUtils.js +82 -30
- package/esm/computePipeline.d.ts +4 -3
- package/esm/computePipeline.js +21 -14
- package/esm/coverageBand.d.ts +3 -3
- package/esm/coverageBand.js +2 -2
- package/esm/coverageBandBuffers.d.ts +2 -3
- package/esm/createRenderingBackend.d.ts +1 -1
- package/esm/displayPhase.d.ts +79 -109
- package/esm/displayPhase.js +42 -83
- package/esm/gpuDevice.d.ts +11 -10
- package/esm/gpuDevice.js +10 -11
- package/esm/graphicsCapabilities.d.ts +6 -7
- package/esm/graphicsCapabilities.js +3 -4
- package/esm/hal/createHal.js +1 -1
- package/esm/hal/deviceGpuCache.d.ts +25 -30
- package/esm/hal/deviceGpuCache.js +85 -97
- package/esm/hal/index.d.ts +2 -2
- package/esm/hal/index.js +1 -1
- package/esm/hal/mockHal.d.ts +8 -6
- package/esm/hal/mockHal.js +7 -2
- package/esm/hal/passIds.d.ts +8 -7
- package/esm/hal/passIds.js +11 -10
- package/esm/hal/types.d.ts +28 -12
- package/esm/hal/webgl2Hal.d.ts +11 -3
- package/esm/hal/webgl2Hal.js +116 -145
- package/esm/hal/webgpuHal.d.ts +8 -8
- package/esm/hal/webgpuHal.js +97 -124
- package/esm/instancePass.d.ts +2 -1
- package/esm/mapUploadSync.d.ts +2 -2
- package/esm/mapUploadSync.js +2 -2
- package/esm/marks/barMark.d.ts +6 -3
- package/esm/marks/barMark.js +19 -13
- package/esm/marks/drawAgainstHit.d.ts +58 -39
- package/esm/marks/drawAgainstHit.js +136 -96
- package/esm/marks/glyphPaint.d.ts +14 -2
- package/esm/marks/glyphPaint.js +16 -2
- package/esm/marks/index.d.ts +4 -2
- package/esm/marks/index.js +3 -2
- package/esm/marks/markBackend.d.ts +2 -2
- package/esm/marks/markBackend.js +2 -2
- package/esm/marks/markHit.d.ts +2 -2
- package/esm/marks/markHit.js +2 -2
- package/esm/marks/markPlan.d.ts +2 -2
- package/esm/marks/markPlan.js +2 -2
- package/esm/marks/markRamp.d.ts +1 -3
- package/esm/marks/markRamp.js +1 -5
- package/esm/marks/nearestMarkHit.d.ts +49 -0
- package/esm/marks/nearestMarkHit.js +126 -0
- package/esm/marks/pointMark.d.ts +9 -2
- package/esm/marks/pointMark.js +36 -31
- package/esm/marks/rowLane.d.ts +17 -0
- package/esm/marks/rowLane.js +11 -0
- package/esm/marks/spanMark.d.ts +6 -26
- package/esm/marks/spanMark.js +34 -31
- package/esm/marks/types.d.ts +51 -181
- package/esm/marks/types.js +91 -131
- package/esm/namedReactions.d.ts +3 -4
- package/esm/namedReactions.js +3 -4
- package/esm/scoreScale.d.ts +20 -0
- package/esm/scoreScale.js +77 -0
- package/esm/shaders/barMark.generated.d.ts +2 -3
- package/esm/shaders/barMark.generated.js +4 -3
- 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 +12 -6
- package/esm/shaders/barMark.iface.generated.js +27 -15
- package/esm/shaders/barMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/barMark.wgsl.generated.js +3 -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/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/pointMark.generated.d.ts +2 -3
- package/esm/shaders/pointMark.generated.js +4 -3
- 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 +11 -3
- package/esm/shaders/pointMark.iface.generated.js +23 -9
- package/esm/shaders/pointMark.js.generated.d.ts +1 -1
- package/esm/shaders/pointMark.js.generated.js +51 -29
- package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/pointMark.wgsl.generated.js +3 -0
- package/esm/shaders/scoreScale.js.generated.js +46 -22
- package/esm/shaders/spanMark.generated.d.ts +2 -3
- package/esm/shaders/spanMark.generated.js +4 -3
- 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.js +1 -1
- package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -0
- package/esm/shaders/spanMark.wgsl.generated.js +3 -0
- package/esm/slangPass.d.ts +9 -10
- package/esm/slangPass.js +9 -3
- package/esm/useGraphicsCapabilities.d.ts +1 -1
- package/esm/useGraphicsCapabilities.js +1 -1
- package/esm/webgpuUtils.d.ts +3 -11
- package/esm/webgpuUtils.js +12 -33
- package/package.json +3 -2
- package/src/shaders/barMark.generated.ts +6 -5
- package/src/shaders/barMark.glsl.generated.ts +6 -0
- package/src/shaders/barMark.iface.generated.ts +31 -15
- package/src/shaders/barMark.slang +11 -3
- package/src/shaders/barMark.wgsl.generated.ts +4 -0
- package/src/shaders/colorPack.slang +3 -2
- package/src/shaders/coverageBand.slang +5 -11
- 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 +1 -1
- package/src/shaders/coverageBar.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/hpmath.slang +18 -6
- package/src/shaders/pointMark.generated.ts +6 -6
- package/src/shaders/pointMark.glsl.generated.ts +6 -0
- package/src/shaders/pointMark.iface.generated.ts +28 -9
- package/src/shaders/pointMark.js.generated.ts +48 -29
- package/src/shaders/pointMark.slang +18 -5
- package/src/shaders/pointMark.wgsl.generated.ts +4 -0
- package/src/shaders/scoreScale.js.generated.ts +43 -22
- package/src/shaders/scoreScale.slang +37 -53
- package/src/shaders/spanMark.generated.ts +6 -5
- package/src/shaders/spanMark.glsl.generated.ts +6 -0
- package/src/shaders/spanMark.iface.generated.ts +1 -1
- package/src/shaders/spanMark.wgsl.generated.ts +4 -0
- package/src/shaders/valueScale.slang +8 -45
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SCALE_TYPE_LOG as GENERATED_SCALE_TYPE_LOG, SCALE_TYPE_SYMLOG as GENERATED_SCALE_TYPE_SYMLOG } from './shaders/scoreScale.generated.ts';
|
|
2
|
+
/** `scoreScale.slang`'s scale-type vocabulary, where 0 is linear. */
|
|
3
|
+
export type ScaleTypeCode = 0 | typeof GENERATED_SCALE_TYPE_LOG | typeof GENERATED_SCALE_TYPE_SYMLOG;
|
|
4
|
+
export declare const SCALE_TYPE_LINEAR: ScaleTypeCode;
|
|
5
|
+
export declare const SCALE_TYPE_LOG: ScaleTypeCode;
|
|
6
|
+
export declare const SCALE_TYPE_SYMLOG: ScaleTypeCode;
|
|
7
|
+
/** The code the `scaleType` uniform compares for a `'log'`/`'symlog'` name. */
|
|
8
|
+
export declare function scaleTypeCode(scaleType: string | undefined): ScaleTypeCode;
|
|
9
|
+
/**
|
|
10
|
+
* `normalizeScore` with the per-domain arithmetic hoisted out of a per-feature
|
|
11
|
+
* loop: the clamped `[0, 1]` fraction a score sits at, and on a domain with no
|
|
12
|
+
* range 1 above its min and 0 elsewhere. `symlogConstant` is the resolved one
|
|
13
|
+
* the shader gets as a uniform.
|
|
14
|
+
*/
|
|
15
|
+
export declare function makeScoreNormalizer(min: number, max: number, scaleType: ScaleTypeCode, symlogConstant: number): (score: number) => number;
|
|
16
|
+
/**
|
|
17
|
+
* `normalizeScore`'s unclamped inverse, the score at fraction `t`. A domain
|
|
18
|
+
* with no range answers its min, floored for log, where the forward step sits.
|
|
19
|
+
*/
|
|
20
|
+
export declare function denormalizeScore(t: number, min: number, max: number, scaleType: ScaleTypeCode, symlogConstant: number): number;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SCALE_TYPE_LOG as GENERATED_SCALE_TYPE_LOG, SCALE_TYPE_SYMLOG as GENERATED_SCALE_TYPE_SYMLOG, } from './shaders/scoreScale.generated.js';
|
|
2
|
+
export const SCALE_TYPE_LINEAR = 0;
|
|
3
|
+
export const SCALE_TYPE_LOG = GENERATED_SCALE_TYPE_LOG;
|
|
4
|
+
export const SCALE_TYPE_SYMLOG = GENERATED_SCALE_TYPE_SYMLOG;
|
|
5
|
+
/** The code the `scaleType` uniform compares for a `'log'`/`'symlog'` name. */
|
|
6
|
+
export function scaleTypeCode(scaleType) {
|
|
7
|
+
return scaleType === 'log'
|
|
8
|
+
? SCALE_TYPE_LOG
|
|
9
|
+
: scaleType === 'symlog'
|
|
10
|
+
? SCALE_TYPE_SYMLOG
|
|
11
|
+
: 0;
|
|
12
|
+
}
|
|
13
|
+
// `Math.log1p` rather than a bare `log(1 + x)`, which loses precision
|
|
14
|
+
// near zero; `scoreScale.slang` spells the same correction by hand.
|
|
15
|
+
function symlog(x, c) {
|
|
16
|
+
return Math.sign(x) * Math.log1p(Math.abs(x / c));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `normalizeScore` with the per-domain arithmetic hoisted out of a per-feature
|
|
20
|
+
* loop: the clamped `[0, 1]` fraction a score sits at, and on a domain with no
|
|
21
|
+
* range 1 above its min and 0 elsewhere. `symlogConstant` is the resolved one
|
|
22
|
+
* the shader gets as a uniform.
|
|
23
|
+
*/
|
|
24
|
+
export function makeScoreNormalizer(min, max, scaleType, symlogConstant) {
|
|
25
|
+
if (scaleType === SCALE_TYPE_SYMLOG) {
|
|
26
|
+
const c = symlogConstant;
|
|
27
|
+
const tMin = symlog(min, c);
|
|
28
|
+
const tMax = symlog(max, c);
|
|
29
|
+
const tRange = tMax - tMin;
|
|
30
|
+
if (tRange <= 0) {
|
|
31
|
+
return (score) => (symlog(score, c) > tMin ? 1 : 0);
|
|
32
|
+
}
|
|
33
|
+
const invRange = 1 / tRange;
|
|
34
|
+
return (score) => Math.max(0, Math.min(1, (symlog(score, c) - tMin) * invRange));
|
|
35
|
+
}
|
|
36
|
+
if (scaleType === SCALE_TYPE_LOG) {
|
|
37
|
+
const floor = min > 0 ? min : 1;
|
|
38
|
+
const logMin = Math.log2(floor);
|
|
39
|
+
const logMax = Math.log2(Math.max(max, floor));
|
|
40
|
+
const logRange = logMax - logMin;
|
|
41
|
+
if (logRange <= 0) {
|
|
42
|
+
return (score) => Math.log2(Math.max(score, floor)) > logMin ? 1 : 0;
|
|
43
|
+
}
|
|
44
|
+
const invLogRange = 1 / logRange;
|
|
45
|
+
return (score) => {
|
|
46
|
+
const logScore = Math.log2(Math.max(score, floor));
|
|
47
|
+
return Math.max(0, Math.min(1, (logScore - logMin) * invLogRange));
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const range = max - min;
|
|
51
|
+
if (range <= 0) {
|
|
52
|
+
return (score) => (score > min ? 1 : 0);
|
|
53
|
+
}
|
|
54
|
+
const invRange = 1 / range;
|
|
55
|
+
return (score) => Math.max(0, Math.min(1, (score - min) * invRange));
|
|
56
|
+
}
|
|
57
|
+
function symlogInverse(y, c) {
|
|
58
|
+
return Math.sign(y) * c * Math.expm1(Math.abs(y));
|
|
59
|
+
}
|
|
60
|
+
function atFraction(t, tMin, tMax) {
|
|
61
|
+
return tMax > tMin ? tMin + t * (tMax - tMin) : tMin;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* `normalizeScore`'s unclamped inverse, the score at fraction `t`. A domain
|
|
65
|
+
* with no range answers its min, floored for log, where the forward step sits.
|
|
66
|
+
*/
|
|
67
|
+
export function denormalizeScore(t, min, max, scaleType, symlogConstant) {
|
|
68
|
+
if (scaleType === SCALE_TYPE_SYMLOG) {
|
|
69
|
+
const c = symlogConstant;
|
|
70
|
+
return symlogInverse(atFraction(t, symlog(min, c), symlog(max, c)), c);
|
|
71
|
+
}
|
|
72
|
+
if (scaleType === SCALE_TYPE_LOG) {
|
|
73
|
+
const floor = min > 0 ? min : 1;
|
|
74
|
+
return 2 ** atFraction(t, Math.log2(floor), Math.log2(Math.max(max, floor)));
|
|
75
|
+
}
|
|
76
|
+
return atFraction(t, min, max);
|
|
77
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S1 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_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 _S2;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S2 = - minWidth_0;\n\n }\n else\n {\n\n _S2 = minWidth_0;\n\n }\n\n _S2 = x1_0 + _S2;\n\n }\n else\n {\n\n _S2 = x2_0;\n\n }\n\n return _S2;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S3 = v_0 == 0U;\n\n bool _S4;\n\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 2U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 3U;\n\n }\n\n float _S5;\n\n if(_S4)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 1U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 4U;\n\n }\n\n float _S6;\n\n if(_S4)\n {\n\n _S6 = 0.0;\n\n }\n else\n {\n\n _S6 = 1.0;\n\n }\n\n return vec2(_S5, _S6);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_1 > 0.0)\n {\n\n floorV_0 = domainMin_1;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_1) / range_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_2, float domainMax_2, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07), 0.0, 1.0)) * h_0;\n}\n\n\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_1, int scaleType_1)\n{\n\n if(scaleType_1 == 1)\n {\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, 1, 1.0)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S7)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S7, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S8, int _S9, float _S10, float _S11)\n{\n\n if(_S9 == 0)\n {\n\n return unpackRGBA_0(_S8);\n }\n\n int scaleType_2;\n\n if(_S9 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S8), _S10, _S11, scaleType_2, 1.0));\n}\n\n\nvoid main()\n{\n\n Uniforms_0 _S12 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.origin_0, u_0.zero_0, u_0.minCellDenomPx_0, u_0.minWidthPx_0, u_0.devicePixelRatio_0);\n float sx1_0 = bpToClipX_0(a_x, _S12);\n\n\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float valueY_0 = valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float originY_0 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float _S13 = min(valueY_0, originY_0);\n float _S14 = max(valueY_0, originY_0);\n float padPx_0 = barAaPx_0();\n float vy_0 = mix(_S14 + padPx_0, _S13 - padPx_0, q_0.y);\n\n VsOut_0 o_0;\n o_0.position_0 = vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, bpToClipX_0(a_x2, _S12), u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2(vy_0 - _S13, vy_0 - _S14);\n VsOut_0 _S15 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S15.color_0;\n\n v_barInkPx = _S15.barInkPx_0;\n\n return;\n}\n\n";
|
|
3
|
-
export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
|
|
1
|
+
import type { ShaderSource } from '@jbrowse/render-core/hal';
|
|
4
2
|
export * from './barMark.iface.generated.ts';
|
|
3
|
+
export declare const SOURCE: ShaderSource;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
-
export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) origin_0 : f32,\n @align(4) zero_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minWidthPx_0 : f32,\n @align(8) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - 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 step_0 : f32 = 2.0f / bpRange_0.z;\n var _S1 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_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 _S2 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S2 = - minWidth_0;\n }\n else\n {\n _S2 = minWidth_0;\n }\n _S2 = x1_0 + _S2;\n }\n else\n {\n _S2 = x2_0;\n }\n return _S2;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0f / canvasWidth_0);\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S3 : bool = v_0 == u32(0);\n var _S4 : bool;\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(2);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(3);\n }\n var _S5 : f32;\n if(_S4)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(1);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(4);\n }\n var _S6 : f32;\n if(_S4)\n {\n _S6 = 0.0f;\n }\n else\n {\n _S6 = 1.0f;\n }\n return vec2<f32>(_S5, _S6);\n}\n\nfn symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_1 > 0.0f)\n {\n floorV_0 = domainMin_1;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_1) / range_0, 0.0f, 1.0f);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_0;\n}\n\nfn valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_1 : i32) -> f32\n{\n if(scaleType_1 == i32(1))\n {\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, i32(1), 1.0f)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_0 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_0, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_1 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n};\n\n@vertex\nfn vs_main( _S7 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var _S8 : Uniforms_std140_0 = u_0;\n var _S9 : f32 = bpToClipX_0(_S7.x_1, &(_S8));\n var _S10 : f32 = bpToClipX_0(_S7.x2_2, &(_S8));\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var valueY_0 : f32 = valueToYPxScaled_0(_S7.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var originY_0 : f32 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var _S11 : f32 = min(valueY_0, originY_0);\n var _S12 : f32 = max(valueY_0, originY_0);\n var padPx_0 : f32 = barAaPx_0();\n var vy_0 : f32 = mix(_S12 + padPx_0, _S11 - padPx_0, q_0.y);\n var o_0 : VsOut_0;\n o_0.position_0 = vec4<f32>(mix(_S9, extendToMinWidthX_0(_S9, _S10, u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S7.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S11, vy_0 - _S12);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S13 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S13.barInkPx_1.x, aaPx_1) - aaRamp_0(_S13.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S14 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S13.color_2.xyz, _S13.color_2.w * alpha_0) );\n return _S14;\n}\n\n";
|
|
4
|
-
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S1 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_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 _S2;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S2 = - minWidth_0;\n\n }\n else\n {\n\n _S2 = minWidth_0;\n\n }\n\n _S2 = x1_0 + _S2;\n\n }\n else\n {\n\n _S2 = x2_0;\n\n }\n\n return _S2;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S3 = v_0 == 0U;\n\n bool _S4;\n\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 2U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 3U;\n\n }\n\n float _S5;\n\n if(_S4)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 1U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 4U;\n\n }\n\n float _S6;\n\n if(_S4)\n {\n\n _S6 = 0.0;\n\n }\n else\n {\n\n _S6 = 1.0;\n\n }\n\n return vec2(_S5, _S6);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_1 > 0.0)\n {\n\n floorV_0 = domainMin_1;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_1) / range_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_2, float domainMax_2, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07), 0.0, 1.0)) * h_0;\n}\n\n\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_1, int scaleType_1)\n{\n\n if(scaleType_1 == 1)\n {\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, 1, 1.0)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S7)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S7, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S8, int _S9, float _S10, float _S11)\n{\n\n if(_S9 == 0)\n {\n\n return unpackRGBA_0(_S8);\n }\n\n int scaleType_2;\n\n if(_S9 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S8), _S10, _S11, scaleType_2, 1.0));\n}\n\n\nvoid main()\n{\n\n Uniforms_0 _S12 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.origin_0, u_0.zero_0, u_0.minCellDenomPx_0, u_0.minWidthPx_0, u_0.devicePixelRatio_0);\n float sx1_0 = bpToClipX_0(a_x, _S12);\n\n\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float valueY_0 = valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float originY_0 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float _S13 = min(valueY_0, originY_0);\n float _S14 = max(valueY_0, originY_0);\n float padPx_0 = barAaPx_0();\n float vy_0 = mix(_S14 + padPx_0, _S13 - padPx_0, q_0.y);\n\n VsOut_0 o_0;\n o_0.position_0 = vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, bpToClipX_0(a_x2, _S12), u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2(vy_0 - _S13, vy_0 - _S14);\n VsOut_0 _S15 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S15.color_0;\n\n v_barInkPx = _S15.barInkPx_0;\n\n return;\n}\n\n";
|
|
5
|
-
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
|
|
6
3
|
export * from './barMark.iface.generated.js';
|
|
4
|
+
export const SOURCE = {
|
|
5
|
+
wgsl: () => import('./barMark.wgsl.generated.js'),
|
|
6
|
+
glsl: () => import('./barMark.glsl.generated.js'),
|
|
7
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float rowHeight_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float rowHeight_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S1 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_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 _S2;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S2 = - minWidth_0;\n\n }\n else\n {\n\n _S2 = minWidth_0;\n\n }\n\n _S2 = x1_0 + _S2;\n\n }\n else\n {\n\n _S2 = x2_0;\n\n }\n\n return _S2;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S3 = v_0 == 0U;\n\n bool _S4;\n\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 2U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 3U;\n\n }\n\n float _S5;\n\n if(_S4)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 1U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 4U;\n\n }\n\n float _S6;\n\n if(_S4)\n {\n\n _S6 = 0.0;\n\n }\n else\n {\n\n _S6 = 1.0;\n\n }\n\n return vec2(_S5, _S6);\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_2 = 1.0 + x_0;\n\n float _S7;\n if(u_2 == 1.0)\n {\n\n _S7 = x_0;\n\n }\n else\n {\n\n _S7 = log(u_2) * (x_0 / (u_2 - 1.0));\n\n }\n\n return _S7;\n}\n\nfloat symlogTransform_0(float x_1, float c_0)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_0;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S8 = symlogTransform_0(score_0, symlogConstant_0);\n float _S9 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S9;\n\n t_0 = _S8;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S10 = log2(max(score_0, tMax_0));\n float _S11 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S11;\n\n t_0 = _S10;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_0 = 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_0 > 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 clamp((t_0 - tMin_0) / tRange_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPxScaled_0(float value_1, float domainMin_2, float domainMax_2, float h_0, int scaleType_1)\n{\n\n return (1.0 - normalizeScore_0(value_1, domainMin_2, domainMax_2, scaleType_1, 1.0)) * h_0;\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S12)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S12, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S13, int _S14, float _S15, float _S16)\n{\n\n if(_S14 == 0)\n {\n\n return unpackRGBA_0(_S13);\n }\n\n int scaleType_2;\n\n if(_S14 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S13), _S15, _S16, scaleType_2, 1.0));\n}\n\n\nvoid main()\n{\n\n Uniforms_0 _S17 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.origin_0, u_0.rowHeight_0, u_0.zero_0, u_0.minCellDenomPx_0, u_0.minWidthPx_0, u_0.devicePixelRatio_0);\n float sx1_0 = bpToClipX_0(a_x, _S17);\n\n\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = u_0.rowHeight_0 * float(a_row);\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n float originY_0 = bandTop_0 + valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n float _S18 = min(valueY_0, originY_0);\n float _S19 = max(valueY_0, originY_0);\n float padPx_0 = barAaPx_0();\n float vy_0 = mix(_S19 + padPx_0, _S18 - padPx_0, q_0.y);\n\n VsOut_0 o_0;\n o_0.position_0 = vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, bpToClipX_0(a_x2, _S17), u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2(vy_0 - _S18, vy_0 - _S19);\n VsOut_0 _S20 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S20.color_0;\n\n v_barInkPx = _S20.barInkPx_0;\n\n return;\n}\n\n";
|
|
2
|
+
export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float rowHeight_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float rowHeight_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float rowHeight_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S1 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_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 _S2;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S2 = - minWidth_0;\n\n }\n else\n {\n\n _S2 = minWidth_0;\n\n }\n\n _S2 = x1_0 + _S2;\n\n }\n else\n {\n\n _S2 = x2_0;\n\n }\n\n return _S2;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S3 = v_0 == 0U;\n\n bool _S4;\n\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 2U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 3U;\n\n }\n\n float _S5;\n\n if(_S4)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 1U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 4U;\n\n }\n\n float _S6;\n\n if(_S4)\n {\n\n _S6 = 0.0;\n\n }\n else\n {\n\n _S6 = 1.0;\n\n }\n\n return vec2(_S5, _S6);\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_2 = 1.0 + x_0;\n\n float _S7;\n if(u_2 == 1.0)\n {\n\n _S7 = x_0;\n\n }\n else\n {\n\n _S7 = log(u_2) * (x_0 / (u_2 - 1.0));\n\n }\n\n return _S7;\n}\n\nfloat symlogTransform_0(float x_1, float c_0)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_0;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S8 = symlogTransform_0(score_0, symlogConstant_0);\n float _S9 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S9;\n\n t_0 = _S8;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S10 = log2(max(score_0, tMax_0));\n float _S11 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S11;\n\n t_0 = _S10;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_0 = 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_0 > 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 clamp((t_0 - tMin_0) / tRange_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPxScaled_0(float value_1, float domainMin_2, float domainMax_2, float h_0, int scaleType_1)\n{\n\n return (1.0 - normalizeScore_0(value_1, domainMin_2, domainMax_2, scaleType_1, 1.0)) * h_0;\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S12)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S12, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S13, int _S14, float _S15, float _S16)\n{\n\n if(_S14 == 0)\n {\n\n return unpackRGBA_0(_S13);\n }\n\n int scaleType_2;\n\n if(_S14 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S13), _S15, _S16, scaleType_2, 1.0));\n}\n\n\nvoid main()\n{\n\n Uniforms_0 _S17 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.origin_0, u_0.rowHeight_0, u_0.zero_0, u_0.minCellDenomPx_0, u_0.minWidthPx_0, u_0.devicePixelRatio_0);\n float sx1_0 = bpToClipX_0(a_x, _S17);\n\n\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = u_0.rowHeight_0 * float(a_row);\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n float originY_0 = bandTop_0 + valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n float _S18 = min(valueY_0, originY_0);\n float _S19 = max(valueY_0, originY_0);\n float padPx_0 = barAaPx_0();\n float vy_0 = mix(_S19 + padPx_0, _S18 - padPx_0, q_0.y);\n\n VsOut_0 o_0;\n o_0.position_0 = vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, bpToClipX_0(a_x2, _S17), u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2(vy_0 - _S18, vy_0 - _S19);\n VsOut_0 _S20 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S20.color_0;\n\n v_barInkPx = _S20.barInkPx_0;\n\n return;\n}\n\n";
|
|
4
|
+
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float rowHeight_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
|
|
@@ -10,10 +10,11 @@ export declare const UNIFORM_OFFSET_F32: {
|
|
|
10
10
|
readonly rampMin: 8;
|
|
11
11
|
readonly rampMax: 9;
|
|
12
12
|
readonly origin: 10;
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
13
|
+
readonly rowHeight: 11;
|
|
14
|
+
readonly zero: 12;
|
|
15
|
+
readonly minCellDenomPx: 13;
|
|
16
|
+
readonly minWidthPx: 14;
|
|
17
|
+
readonly devicePixelRatio: 15;
|
|
17
18
|
};
|
|
18
19
|
export declare const UNIFORM_OFFSET_I32: {
|
|
19
20
|
readonly valueScaleType: 6;
|
|
@@ -29,14 +30,15 @@ export interface Uniforms {
|
|
|
29
30
|
rampMin: number;
|
|
30
31
|
rampMax: number;
|
|
31
32
|
origin: number;
|
|
33
|
+
rowHeight: number;
|
|
32
34
|
zero: number;
|
|
33
35
|
minCellDenomPx: number;
|
|
34
36
|
minWidthPx: number;
|
|
35
37
|
devicePixelRatio: number;
|
|
36
38
|
}
|
|
37
39
|
export declare function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms): void;
|
|
38
|
-
export declare const INSTANCE_STRIDE_BYTES =
|
|
39
|
-
export declare const INSTANCE_STRIDE_WORDS =
|
|
40
|
+
export declare const INSTANCE_STRIDE_BYTES = 20;
|
|
41
|
+
export declare const INSTANCE_STRIDE_WORDS = 5;
|
|
40
42
|
export declare const INSTANCE_OFFSET_F32: {
|
|
41
43
|
readonly y: 2;
|
|
42
44
|
};
|
|
@@ -44,6 +46,7 @@ export declare const INSTANCE_OFFSET_U32: {
|
|
|
44
46
|
readonly x: 0;
|
|
45
47
|
readonly x2: 1;
|
|
46
48
|
readonly color: 3;
|
|
49
|
+
readonly row: 4;
|
|
47
50
|
};
|
|
48
51
|
export declare const VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
|
|
49
52
|
export interface InstanceArrays {
|
|
@@ -51,6 +54,7 @@ export interface InstanceArrays {
|
|
|
51
54
|
x2: ArrayLike<number>;
|
|
52
55
|
y: ArrayLike<number>;
|
|
53
56
|
color: ArrayLike<number>;
|
|
57
|
+
row: ArrayLike<number>;
|
|
54
58
|
}
|
|
55
59
|
export declare function packInstances(arrays: InstanceArrays, numInstances: number, buf?: ArrayBuffer): ArrayBuffer;
|
|
56
60
|
export declare function getInstanceX(u32: Uint32Array, i: number): number;
|
|
@@ -61,4 +65,6 @@ export declare function getInstanceY(f32: Float32Array, i: number): number;
|
|
|
61
65
|
export declare function setInstanceY(f32: Float32Array, i: number, v: number): void;
|
|
62
66
|
export declare function getInstanceColor(u32: Uint32Array, i: number): number;
|
|
63
67
|
export declare function setInstanceColor(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;
|
|
64
70
|
export declare const TEXTURES: readonly [TextureBinding, ...TextureBinding[]];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
3
|
export const BINDINGS = [
|
|
4
|
-
{ index: 1, kind: 'uniform', name: 'u' },
|
|
5
|
-
{ index: 2, kind: 'texture', name: 'colorRamp' },
|
|
6
|
-
{ index: 3, kind: 'sampler', name: 'colorRamp' },
|
|
4
|
+
{ index: 1, kind: 'uniform', name: 'u', stages: ['vertex', 'fragment'] },
|
|
5
|
+
{ index: 2, kind: 'texture', name: 'colorRamp', stages: ['vertex'] },
|
|
6
|
+
{ index: 3, kind: 'sampler', name: 'colorRamp', stages: ['vertex'] },
|
|
7
7
|
];
|
|
8
8
|
export const VERTS_PER_INSTANCE = 6;
|
|
9
9
|
export const UNIFORMS_SIZE_BYTES = 64;
|
|
@@ -16,10 +16,11 @@ export const UNIFORM_OFFSET_F32 = {
|
|
|
16
16
|
rampMin: 8,
|
|
17
17
|
rampMax: 9,
|
|
18
18
|
origin: 10,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
rowHeight: 11,
|
|
20
|
+
zero: 12,
|
|
21
|
+
minCellDenomPx: 13,
|
|
22
|
+
minWidthPx: 14,
|
|
23
|
+
devicePixelRatio: 15,
|
|
23
24
|
};
|
|
24
25
|
// Word indices into a Int32Array view over the uniform buffer.
|
|
25
26
|
export const UNIFORM_OFFSET_I32 = {
|
|
@@ -40,13 +41,14 @@ export function writeUniforms(buf, uniforms) {
|
|
|
40
41
|
f32[8] = uniforms.rampMin;
|
|
41
42
|
f32[9] = uniforms.rampMax;
|
|
42
43
|
f32[10] = uniforms.origin;
|
|
43
|
-
f32[11] = uniforms.
|
|
44
|
-
f32[12] = uniforms.
|
|
45
|
-
f32[13] = uniforms.
|
|
46
|
-
f32[14] = uniforms.
|
|
44
|
+
f32[11] = uniforms.rowHeight;
|
|
45
|
+
f32[12] = uniforms.zero;
|
|
46
|
+
f32[13] = uniforms.minCellDenomPx;
|
|
47
|
+
f32[14] = uniforms.minWidthPx;
|
|
48
|
+
f32[15] = uniforms.devicePixelRatio;
|
|
47
49
|
}
|
|
48
|
-
export const INSTANCE_STRIDE_BYTES =
|
|
49
|
-
export const INSTANCE_STRIDE_WORDS =
|
|
50
|
+
export const INSTANCE_STRIDE_BYTES = 20;
|
|
51
|
+
export const INSTANCE_STRIDE_WORDS = 5;
|
|
50
52
|
// Word indices into a Float32Array view over the instance buffer.
|
|
51
53
|
export const INSTANCE_OFFSET_F32 = {
|
|
52
54
|
y: 2,
|
|
@@ -56,23 +58,26 @@ export const INSTANCE_OFFSET_U32 = {
|
|
|
56
58
|
x: 0,
|
|
57
59
|
x2: 1,
|
|
58
60
|
color: 3,
|
|
61
|
+
row: 4,
|
|
59
62
|
};
|
|
60
63
|
export const VERTEX_ATTRIBUTES = [
|
|
61
64
|
{ name: 'a_x', components: 1, type: 'uint', offsetBytes: 0, integer: true },
|
|
62
65
|
{ name: 'a_x2', components: 1, type: 'uint', offsetBytes: 4, integer: true },
|
|
63
66
|
{ name: 'a_y', components: 1, type: 'float', offsetBytes: 8, integer: false },
|
|
64
67
|
{ name: 'a_color', components: 1, type: 'uint', offsetBytes: 12, integer: true },
|
|
68
|
+
{ name: 'a_row', components: 1, type: 'uint', offsetBytes: 16, integer: true },
|
|
65
69
|
];
|
|
66
70
|
export function packInstances(arrays, numInstances, buf = new ArrayBuffer(numInstances * INSTANCE_STRIDE_BYTES)) {
|
|
67
71
|
const f32 = new Float32Array(buf);
|
|
68
72
|
const u32 = new Uint32Array(buf);
|
|
69
|
-
const { x, x2, y, color } = arrays;
|
|
73
|
+
const { x, x2, y, color, row } = arrays;
|
|
70
74
|
for (let i = 0; i < numInstances; i++) {
|
|
71
75
|
const o = i * INSTANCE_STRIDE_WORDS;
|
|
72
76
|
u32[o + 0] = x[i];
|
|
73
77
|
u32[o + 1] = x2[i];
|
|
74
78
|
f32[o + 2] = y[i];
|
|
75
79
|
u32[o + 3] = color[i];
|
|
80
|
+
u32[o + 4] = row[i];
|
|
76
81
|
}
|
|
77
82
|
return buf;
|
|
78
83
|
}
|
|
@@ -104,7 +109,14 @@ export function getInstanceColor(u32, i) {
|
|
|
104
109
|
export function setInstanceColor(u32, i, v) {
|
|
105
110
|
u32[i * INSTANCE_STRIDE_WORDS + 3] = v;
|
|
106
111
|
}
|
|
112
|
+
// Instance `i`'s `row`.
|
|
113
|
+
export function getInstanceRow(u32, i) {
|
|
114
|
+
return u32[i * INSTANCE_STRIDE_WORDS + 4];
|
|
115
|
+
}
|
|
116
|
+
export function setInstanceRow(u32, i, v) {
|
|
117
|
+
u32[i * INSTANCE_STRIDE_WORDS + 4] = v;
|
|
118
|
+
}
|
|
107
119
|
// Combined `Sampler2D` bindings. Texture unit indices start at 0.
|
|
108
120
|
export const TEXTURES = [
|
|
109
|
-
{
|
|
121
|
+
{ glTextureUnit: 0, glUniformName: 'u_colorRamp', filter: 'linear' },
|
|
110
122
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) origin_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) zero_0 : f32,\n @align(4) minCellDenomPx_0 : f32,\n @align(8) minWidthPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - 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 step_0 : f32 = 2.0f / bpRange_0.z;\n var _S1 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_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 _S2 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S2 = - minWidth_0;\n }\n else\n {\n _S2 = minWidth_0;\n }\n _S2 = x1_0 + _S2;\n }\n else\n {\n _S2 = x2_0;\n }\n return _S2;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0f / canvasWidth_0);\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S3 : bool = v_0 == u32(0);\n var _S4 : bool;\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(2);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(3);\n }\n var _S5 : f32;\n if(_S4)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(1);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(4);\n }\n var _S6 : f32;\n if(_S4)\n {\n _S6 = 0.0f;\n }\n else\n {\n _S6 = 1.0f;\n }\n return vec2<f32>(_S5, _S6);\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_2 : f32 = 1.0f + x_0;\n var _S7 : f32;\n if(u_2 == 1.0f)\n {\n _S7 = x_0;\n }\n else\n {\n _S7 = log(u_2) * (x_0 / (u_2 - 1.0f));\n }\n return _S7;\n}\n\nfn symlogTransform_0( x_1 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_0 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S8 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S9 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S9;\n t_0 = _S8;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S10 : f32 = log2(max(score_0, tMax_0));\n var _S11 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S11;\n t_0 = _S10;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_0 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_0 > 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 clamp((t_0 - tMin_0) / tRange_0, 0.0f, 1.0f);\n}\n\nfn valueToYPxScaled_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32, scaleType_1 : i32) -> f32\n{\n return (1.0f - normalizeScore_0(value_1, domainMin_2, domainMax_2, scaleType_1, 1.0f)) * h_0;\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.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 markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n @location(4) row_0 : u32,\n};\n\n@vertex\nfn vs_main( _S12 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var _S13 : Uniforms_std140_0 = u_0;\n var _S14 : f32 = bpToClipX_0(_S12.x_2, &(_S13));\n var _S15 : f32 = bpToClipX_0(_S12.x2_2, &(_S13));\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var bandTop_0 : f32 = u_0.rowHeight_0 * f32(_S12.row_0);\n var valueY_0 : f32 = bandTop_0 + valueToYPxScaled_0(_S12.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n var originY_0 : f32 = bandTop_0 + valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n var _S16 : f32 = min(valueY_0, originY_0);\n var _S17 : f32 = max(valueY_0, originY_0);\n var padPx_0 : f32 = barAaPx_0();\n var vy_0 : f32 = mix(_S17 + padPx_0, _S16 - padPx_0, q_0.y);\n var o_0 : VsOut_0;\n o_0.position_0 = vec4<f32>(mix(_S14, extendToMinWidthX_0(_S14, _S15, u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S12.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S16, vy_0 - _S17);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S18 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S18.barInkPx_1.x, aaPx_1) - aaRamp_0(_S18.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S19 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S18.color_2.xyz, _S18.color_2.w * alpha_0) );\n return _S19;\n}\n\n";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) origin_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) zero_0 : f32,\n @align(4) minCellDenomPx_0 : f32,\n @align(8) minWidthPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - 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 step_0 : f32 = 2.0f / bpRange_0.z;\n var _S1 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_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 _S2 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S2 = - minWidth_0;\n }\n else\n {\n _S2 = minWidth_0;\n }\n _S2 = x1_0 + _S2;\n }\n else\n {\n _S2 = x2_0;\n }\n return _S2;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0f / canvasWidth_0);\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S3 : bool = v_0 == u32(0);\n var _S4 : bool;\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(2);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(3);\n }\n var _S5 : f32;\n if(_S4)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(1);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(4);\n }\n var _S6 : f32;\n if(_S4)\n {\n _S6 = 0.0f;\n }\n else\n {\n _S6 = 1.0f;\n }\n return vec2<f32>(_S5, _S6);\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_2 : f32 = 1.0f + x_0;\n var _S7 : f32;\n if(u_2 == 1.0f)\n {\n _S7 = x_0;\n }\n else\n {\n _S7 = log(u_2) * (x_0 / (u_2 - 1.0f));\n }\n return _S7;\n}\n\nfn symlogTransform_0( x_1 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_0 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S8 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S9 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S9;\n t_0 = _S8;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S10 : f32 = log2(max(score_0, tMax_0));\n var _S11 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S11;\n t_0 = _S10;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_0 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_0 > 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 clamp((t_0 - tMin_0) / tRange_0, 0.0f, 1.0f);\n}\n\nfn valueToYPxScaled_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32, scaleType_1 : i32) -> f32\n{\n return (1.0f - normalizeScore_0(value_1, domainMin_2, domainMax_2, scaleType_1, 1.0f)) * h_0;\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.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 markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n @location(4) row_0 : u32,\n};\n\n@vertex\nfn vs_main( _S12 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var _S13 : Uniforms_std140_0 = u_0;\n var _S14 : f32 = bpToClipX_0(_S12.x_2, &(_S13));\n var _S15 : f32 = bpToClipX_0(_S12.x2_2, &(_S13));\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var bandTop_0 : f32 = u_0.rowHeight_0 * f32(_S12.row_0);\n var valueY_0 : f32 = bandTop_0 + valueToYPxScaled_0(_S12.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n var originY_0 : f32 = bandTop_0 + valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.rowHeight_0, u_0.valueScaleType_0);\n var _S16 : f32 = min(valueY_0, originY_0);\n var _S17 : f32 = max(valueY_0, originY_0);\n var padPx_0 : f32 = barAaPx_0();\n var vy_0 : f32 = mix(_S17 + padPx_0, _S16 - padPx_0, q_0.y);\n var o_0 : VsOut_0;\n o_0.position_0 = vec4<f32>(mix(_S14, extendToMinWidthX_0(_S14, _S15, u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S12.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S16, vy_0 - _S17);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S18 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S18.barInkPx_1.x, aaPx_1) - aaRamp_0(_S18.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S19 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S18.color_2.xyz, _S18.color_2.w * alpha_0) );\n return _S19;\n}\n\n";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct CoverageBandUniforms_0\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_1)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_1);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat covBpToClipX_0(uint bp_0, CoverageBandUniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3(u_1.bpHi_0, u_1.bpLo_0, u_1.bpLen_0), u_1.hpZero_0);\n}\n\n\nvec2 expandToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n if((x2_0 - x1_0) < minWidth_0)\n {\n\n float mid_0 = (x1_0 + x2_0) * 0.5;\n float _S6 = minWidth_0 * 0.5;\n\n return vec2(mid_0 - _S6, mid_0 + _S6);\n }\n return vec2(x1_0, x2_0);\n}\n\nvec2 expandToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 covExpandMinWidthX_0(float x1_2, float x2_2, float canvasWidth_1)\n{\n\n return expandToMinWidthX_0(x1_2, x2_2, 1.0, canvasWidth_1);\n}\n\n\nfloat covBottomOffsetPx_0(float covHeight_1, float covYOffset_1)\n{\n\n return covHeight_1 - covYOffset_1;\n}\n\n\nfloat covBaselinePx_0(CoverageBandUniforms_0 u_2)\n{\n\n return u_2.covTop_0 + covBottomOffsetPx_0(u_2.covHeight_0, u_2.covYOffset_0);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_0 > 0.0)\n {\n\n floorV_0 = domainMin_0;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_0) / range_0, 0.0, 1.0);\n}\n\n\nfloat normalizeDepthScalar_0(float rawDepth_0, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\n\nfloat covNormalizeDepth_0(float relDepth_0, CoverageBandUniforms_0 u_3)\n{\n return normalizeDepthScalar_0(relDepth_0 * u_3.regionMaxDepth_0, u_3.depthDomainMin_0, u_3.depthDomainMax_0, u_3.coverageScaleType_0, u_3.coverageSymlogConstant_0);\n}\n\n\nfloat covEffectiveHeightPx_0(float covHeight_2, float covYOffset_2)\n{\n\n return max(covHeight_2 - 2.0 * covYOffset_2, 0.0);\n}\n\n\nfloat covEffHeight_0(CoverageBandUniforms_0 u_4)\n{\n\n return covEffectiveHeightPx_0(u_4.covHeight_0, u_4.covYOffset_0);\n}\n\n\nfloat covBarHeightPx_0(float depthFraction_0, float effectiveHeightPx_0)\n{\n\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\n\nfloat covSegBottomPx_0(float baselinePx_0, float yOffset_0, float barHeightPx_0)\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_0)\n{\n\n return 1.0 - yPx_0 / canvasHeight_0 * 2.0;\n}\n\n\nfloat covSegTopPx_0(float baselinePx_1, float yOffset_1, float segHeight_0, float barHeightPx_1)\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\n\nfloat covFlipX_0(float x_1, CoverageBandUniforms_0 u_5)\n{\n\n return mix(x_1, - x_1, u_5.reversed_0);\n}\n\n\nvec4 covFlippedQuad_0(float x0_0, float x1_3, float yBot_0, float yTop_0, vec2 local_0, CoverageBandUniforms_0 u_6)\n{\n return vec4(covFlipX_0(mix(x0_0, x1_3, local_0.x), u_6), mix(yBot_0, yTop_0, local_0.y), 0.0, 1.0);\n}\n\n\nvec4 covSegQuad_0(uint position_0, uint widthBp_0, float yOffset_2, float segHeight_1, float relDepth_1, vec2 local_1, CoverageBandUniforms_0 u_7)\n{\n\n vec2 xx_0 = covExpandMinWidthX_0(covBpToClipX_0(position_0, u_7), covBpToClipX_0(position_0 + widthBp_0, u_7), u_7.canvasW_0);\n\n float basePx_0 = covBaselinePx_0(u_7);\n float barPx_0 = covBarHeightPx_0(covNormalizeDepth_0(relDepth_1, u_7), covEffHeight_0(u_7));\n return covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(basePx_0, yOffset_2, barPx_0), u_7.canvasH_0), yPxToClipY_0(covSegTopPx_0(basePx_0, yOffset_2, segHeight_1, barPx_0), u_7.canvasH_0), local_1, u_7);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_position;\n\n\nlayout(location = 1)\nin float a_relDepth;\n\n\nstruct CoverageVsOut_0\n{\n vec4 position_1;\n vec4 color_0;\n};\n\n\nvoid main()\n{\n\n CoverageVsOut_0 o_0;\n\n CoverageBandUniforms_0 _S7 = CoverageBandUniforms_0(u_0.bpHi_0, u_0.bpLo_0, u_0.bpLen_0, u_0.hpZero_0, u_0.canvasW_0, u_0.canvasH_0, u_0.covHeight_0, u_0.covYOffset_0, u_0.covTop_0, u_0.regionMaxDepth_0, u_0.depthDomainMax_0, u_0.depthDomainMin_0, u_0.coverageSymlogConstant_0, u_0.binSize_0, u_0.interbaseHeight_0, u_0.snpMinFreq_0, u_0.reversed_0, u_0.coverageScaleType_0, u_0.colorCoverage_0, u_0.colorBaseA_0, u_0.colorBaseC_0, u_0.colorBaseG_0, u_0.colorBaseT_0, u_0.colorBaseN_0, u_0.colorInsertionIndicator_0, u_0.colorSoftclipIndicator_0, u_0.colorHardclipIndicator_0);\n\n o_0.position_1 = covSegQuad_0(a_position, uint(u_0.binSize_0), 0.0, 1.0, a_relDepth, quadLocal_0(uint(gl_VertexID)), _S7);\n\n o_0.color_0 = vec4(unpackRGBA_0(u_0.colorCoverage_0).xyz, 1.0);\n CoverageVsOut_0 _S8 = o_0;\n\n gl_Position = o_0.position_1;\n\n v_color = _S8.color_0;\n\n return;\n}\n\n";
|
|
3
|
-
export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
|
|
1
|
+
import type { ShaderSource } from '@jbrowse/render-core/hal';
|
|
4
2
|
export * from './coverageBar.iface.generated.ts';
|
|
3
|
+
export declare const SOURCE: ShaderSource;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from coverageBar.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
-
export const WGSL_SOURCE = "struct CoverageBandUniforms_std140_0\n{\n @align(16) bpHi_0 : f32,\n @align(4) bpLo_0 : f32,\n @align(8) bpLen_0 : f32,\n @align(4) hpZero_0 : f32,\n @align(16) canvasW_0 : f32,\n @align(4) canvasH_0 : f32,\n @align(8) covHeight_0 : f32,\n @align(4) covYOffset_0 : f32,\n @align(16) covTop_0 : f32,\n @align(4) regionMaxDepth_0 : f32,\n @align(8) depthDomainMax_0 : f32,\n @align(4) depthDomainMin_0 : f32,\n @align(16) coverageSymlogConstant_0 : f32,\n @align(4) binSize_0 : f32,\n @align(8) interbaseHeight_0 : f32,\n @align(4) snpMinFreq_0 : f32,\n @align(16) reversed_0 : f32,\n @align(4) coverageScaleType_0 : i32,\n @align(8) colorCoverage_0 : u32,\n @align(4) colorBaseA_0 : u32,\n @align(16) colorBaseC_0 : u32,\n @align(4) colorBaseG_0 : u32,\n @align(8) colorBaseT_0 : u32,\n @align(4) colorBaseN_0 : u32,\n @align(16) colorInsertionIndicator_0 : u32,\n @align(4) colorSoftclipIndicator_0 : u32,\n @align(8) colorHardclipIndicator_0 : u32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : CoverageBandUniforms_std140_0;\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_1 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S5 : f32 = - (1.0f / hpZero_1);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn covBpToClipX_0( bp_0 : u32, u_1 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3<f32>((*u_1).bpHi_0, (*u_1).bpLo_0, (*u_1).bpLen_0), (*u_1).hpZero_0);\n}\n\nfn expandToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> vec2<f32>\n{\n if((x2_0 - x1_0) < minWidth_0)\n {\n var mid_0 : f32 = (x1_0 + x2_0) * 0.5f;\n var _S6 : f32 = minWidth_0 * 0.5f;\n return vec2<f32>(mid_0 - _S6, mid_0 + _S6);\n }\n return vec2<f32>(x1_0, x2_0);\n}\n\nfn expandToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> vec2<f32>\n{\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0f / canvasWidth_0);\n}\n\nfn covExpandMinWidthX_0( x1_2 : f32, x2_2 : f32, canvasWidth_1 : f32) -> vec2<f32>\n{\n return expandToMinWidthX_0(x1_2, x2_2, 1.0f, canvasWidth_1);\n}\n\nfn covBottomOffsetPx_0( covHeight_1 : f32, covYOffset_1 : f32) -> f32\n{\n return covHeight_1 - covYOffset_1;\n}\n\nfn covBaselinePx_0( u_2 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return (*u_2).covTop_0 + covBottomOffsetPx_0((*u_2).covHeight_0, (*u_2).covYOffset_0);\n}\n\nfn symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_0 > 0.0f)\n {\n floorV_0 = domainMin_0;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_0) / range_0, 0.0f, 1.0f);\n}\n\nfn normalizeDepthScalar_0( rawDepth_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\nfn covNormalizeDepth_0( relDepth_0 : f32, u_3 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return normalizeDepthScalar_0(relDepth_0 * (*u_3).regionMaxDepth_0, (*u_3).depthDomainMin_0, (*u_3).depthDomainMax_0, (*u_3).coverageScaleType_0, (*u_3).coverageSymlogConstant_0);\n}\n\nfn covEffectiveHeightPx_0( covHeight_2 : f32, covYOffset_2 : f32) -> f32\n{\n return max(covHeight_2 - 2.0f * covYOffset_2, 0.0f);\n}\n\nfn covEffHeight_0( u_4 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return covEffectiveHeightPx_0((*u_4).covHeight_0, (*u_4).covYOffset_0);\n}\n\nfn covBarHeightPx_0( depthFraction_0 : f32, effectiveHeightPx_0 : f32) -> f32\n{\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\nfn covSegBottomPx_0( baselinePx_0 : f32, yOffset_0 : f32, barHeightPx_0 : f32) -> f32\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_0 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_0 * 2.0f;\n}\n\nfn covSegTopPx_0( baselinePx_1 : f32, yOffset_1 : f32, segHeight_0 : f32, barHeightPx_1 : f32) -> f32\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\nfn covFlipX_0( x_1 : f32, u_5 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return mix(x_1, - x_1, (*u_5).reversed_0);\n}\n\nfn covFlippedQuad_0( x0_0 : f32, x1_3 : f32, yBot_0 : f32, yTop_0 : f32, local_0 : vec2<f32>, u_6 : ptr<function, CoverageBandUniforms_std140_0>) -> vec4<f32>\n{\n var _S7 : f32 = covFlipX_0(mix(x0_0, x1_3, local_0.x), &((*u_6)));\n return vec4<f32>(_S7, mix(yBot_0, yTop_0, local_0.y), 0.0f, 1.0f);\n}\n\nfn covSegQuad_0( position_0 : u32, widthBp_0 : u32, yOffset_2 : f32, segHeight_1 : f32, relDepth_1 : f32, local_1 : vec2<f32>, u_7 : ptr<function, CoverageBandUniforms_std140_0>) -> vec4<f32>\n{\n var _S8 : f32 = covBpToClipX_0(position_0, &((*u_7)));\n var _S9 : f32 = covBpToClipX_0(position_0 + widthBp_0, &((*u_7)));\n var xx_0 : vec2<f32> = covExpandMinWidthX_0(_S8, _S9, (*u_7).canvasW_0);\n var _S10 : f32 = covBaselinePx_0(&((*u_7)));\n var _S11 : f32 = covNormalizeDepth_0(relDepth_1, &((*u_7)));\n var _S12 : f32 = covEffHeight_0(&((*u_7)));\n var barPx_0 : f32 = covBarHeightPx_0(_S11, _S12);\n var _S13 : vec4<f32> = covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(_S10, yOffset_2, barPx_0), (*u_7).canvasH_0), yPxToClipY_0(covSegTopPx_0(_S10, yOffset_2, segHeight_1, barPx_0), (*u_7).canvasH_0), local_1, &((*u_7)));\n return _S13;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nstruct CoverageVsOut_0\n{\n @builtin(position) position_1 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) position_2 : u32,\n @location(1) relDepth_2 : f32,\n};\n\n@vertex\nfn vs_main( _S14 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> CoverageVsOut_0\n{\n var o_0 : CoverageVsOut_0;\n var _S15 : u32 = u32(u_0.binSize_0);\n var _S16 : vec2<f32> = quadLocal_0(vid_1);\n var _S17 : CoverageBandUniforms_std140_0 = u_0;\n var _S18 : vec4<f32> = covSegQuad_0(_S14.position_2, _S15, 0.0f, 1.0f, _S14.relDepth_2, _S16, &(_S17));\n o_0.position_1 = _S18;\n o_0.color_0 = vec4<f32>(unpackRGBA_0(u_0.colorCoverage_0).xyz, 1.0f);\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_1 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S19 : pixelInput_0, @builtin(position) position_3 : vec4<f32>) -> pixelOutput_0\n{\n var _S20 : pixelOutput_0 = pixelOutput_0( _S19.color_1 );\n return _S20;\n}\n\n";
|
|
4
|
-
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct CoverageBandUniforms_0\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_1)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_1);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat covBpToClipX_0(uint bp_0, CoverageBandUniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3(u_1.bpHi_0, u_1.bpLo_0, u_1.bpLen_0), u_1.hpZero_0);\n}\n\n\nvec2 expandToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n if((x2_0 - x1_0) < minWidth_0)\n {\n\n float mid_0 = (x1_0 + x2_0) * 0.5;\n float _S6 = minWidth_0 * 0.5;\n\n return vec2(mid_0 - _S6, mid_0 + _S6);\n }\n return vec2(x1_0, x2_0);\n}\n\nvec2 expandToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 covExpandMinWidthX_0(float x1_2, float x2_2, float canvasWidth_1)\n{\n\n return expandToMinWidthX_0(x1_2, x2_2, 1.0, canvasWidth_1);\n}\n\n\nfloat covBottomOffsetPx_0(float covHeight_1, float covYOffset_1)\n{\n\n return covHeight_1 - covYOffset_1;\n}\n\n\nfloat covBaselinePx_0(CoverageBandUniforms_0 u_2)\n{\n\n return u_2.covTop_0 + covBottomOffsetPx_0(u_2.covHeight_0, u_2.covYOffset_0);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_0 > 0.0)\n {\n\n floorV_0 = domainMin_0;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_0) / range_0, 0.0, 1.0);\n}\n\n\nfloat normalizeDepthScalar_0(float rawDepth_0, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\n\nfloat covNormalizeDepth_0(float relDepth_0, CoverageBandUniforms_0 u_3)\n{\n return normalizeDepthScalar_0(relDepth_0 * u_3.regionMaxDepth_0, u_3.depthDomainMin_0, u_3.depthDomainMax_0, u_3.coverageScaleType_0, u_3.coverageSymlogConstant_0);\n}\n\n\nfloat covEffectiveHeightPx_0(float covHeight_2, float covYOffset_2)\n{\n\n return max(covHeight_2 - 2.0 * covYOffset_2, 0.0);\n}\n\n\nfloat covEffHeight_0(CoverageBandUniforms_0 u_4)\n{\n\n return covEffectiveHeightPx_0(u_4.covHeight_0, u_4.covYOffset_0);\n}\n\n\nfloat covBarHeightPx_0(float depthFraction_0, float effectiveHeightPx_0)\n{\n\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\n\nfloat covSegBottomPx_0(float baselinePx_0, float yOffset_0, float barHeightPx_0)\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_0)\n{\n\n return 1.0 - yPx_0 / canvasHeight_0 * 2.0;\n}\n\n\nfloat covSegTopPx_0(float baselinePx_1, float yOffset_1, float segHeight_0, float barHeightPx_1)\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\n\nfloat covFlipX_0(float x_1, CoverageBandUniforms_0 u_5)\n{\n\n return mix(x_1, - x_1, u_5.reversed_0);\n}\n\n\nvec4 covFlippedQuad_0(float x0_0, float x1_3, float yBot_0, float yTop_0, vec2 local_0, CoverageBandUniforms_0 u_6)\n{\n return vec4(covFlipX_0(mix(x0_0, x1_3, local_0.x), u_6), mix(yBot_0, yTop_0, local_0.y), 0.0, 1.0);\n}\n\n\nvec4 covSegQuad_0(uint position_0, uint widthBp_0, float yOffset_2, float segHeight_1, float relDepth_1, vec2 local_1, CoverageBandUniforms_0 u_7)\n{\n\n vec2 xx_0 = covExpandMinWidthX_0(covBpToClipX_0(position_0, u_7), covBpToClipX_0(position_0 + widthBp_0, u_7), u_7.canvasW_0);\n\n float basePx_0 = covBaselinePx_0(u_7);\n float barPx_0 = covBarHeightPx_0(covNormalizeDepth_0(relDepth_1, u_7), covEffHeight_0(u_7));\n return covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(basePx_0, yOffset_2, barPx_0), u_7.canvasH_0), yPxToClipY_0(covSegTopPx_0(basePx_0, yOffset_2, segHeight_1, barPx_0), u_7.canvasH_0), local_1, u_7);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_position;\n\n\nlayout(location = 1)\nin float a_relDepth;\n\n\nstruct CoverageVsOut_0\n{\n vec4 position_1;\n vec4 color_0;\n};\n\n\nvoid main()\n{\n\n CoverageVsOut_0 o_0;\n\n CoverageBandUniforms_0 _S7 = CoverageBandUniforms_0(u_0.bpHi_0, u_0.bpLo_0, u_0.bpLen_0, u_0.hpZero_0, u_0.canvasW_0, u_0.canvasH_0, u_0.covHeight_0, u_0.covYOffset_0, u_0.covTop_0, u_0.regionMaxDepth_0, u_0.depthDomainMax_0, u_0.depthDomainMin_0, u_0.coverageSymlogConstant_0, u_0.binSize_0, u_0.interbaseHeight_0, u_0.snpMinFreq_0, u_0.reversed_0, u_0.coverageScaleType_0, u_0.colorCoverage_0, u_0.colorBaseA_0, u_0.colorBaseC_0, u_0.colorBaseG_0, u_0.colorBaseT_0, u_0.colorBaseN_0, u_0.colorInsertionIndicator_0, u_0.colorSoftclipIndicator_0, u_0.colorHardclipIndicator_0);\n\n o_0.position_1 = covSegQuad_0(a_position, uint(u_0.binSize_0), 0.0, 1.0, a_relDepth, quadLocal_0(uint(gl_VertexID)), _S7);\n\n o_0.color_0 = vec4(unpackRGBA_0(u_0.colorCoverage_0).xyz, 1.0);\n CoverageVsOut_0 _S8 = o_0;\n\n gl_Position = o_0.position_1;\n\n v_color = _S8.color_0;\n\n return;\n}\n\n";
|
|
5
|
-
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\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";
|
|
6
3
|
export * from './coverageBar.iface.generated.js';
|
|
4
|
+
export const SOURCE = {
|
|
5
|
+
wgsl: () => import('./coverageBar.wgsl.generated.js'),
|
|
6
|
+
glsl: () => import('./coverageBar.glsl.generated.js'),
|
|
7
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct CoverageBandUniforms_0\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_1)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_1);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat covBpToClipX_0(uint bp_0, CoverageBandUniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3(u_1.bpHi_0, u_1.bpLo_0, u_1.bpLen_0), u_1.hpZero_0);\n}\n\n\nfloat expandToMinWidthLeftPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float _S6;\n if((x2_0 - x1_0) < minWidth_0)\n {\n\n _S6 = (x1_0 + x2_0) * 0.5 - minWidth_0 * 0.5;\n\n }\n else\n {\n\n _S6 = x1_0;\n\n }\n\n return _S6;\n}\n\nfloat expandToMinWidthRightPx_0(float x1_1, float x2_1, float minWidth_1)\n{\n\n float _S7;\n if((x2_1 - x1_1) < minWidth_1)\n {\n\n _S7 = (x1_1 + x2_1) * 0.5 + minWidth_1 * 0.5;\n\n }\n else\n {\n\n _S7 = x2_1;\n\n }\n\n return _S7;\n}\n\nvec2 expandToMinWidthPx_0(float x1_2, float x2_2, float minWidth_2)\n{\n\n return vec2(expandToMinWidthLeftPx_0(x1_2, x2_2, minWidth_2), expandToMinWidthRightPx_0(x1_2, x2_2, minWidth_2));\n}\n\n\n\n\nvec2 expandToMinWidthX_0(float x1_3, float x2_3, float minWidthPx_0, float canvasWidth_0)\n{\n\n return expandToMinWidthPx_0(x1_3, x2_3, minWidthPx_0 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 covExpandMinWidthX_0(float x1_4, float x2_4, float canvasWidth_1)\n{\n\n return expandToMinWidthX_0(x1_4, x2_4, 1.0, canvasWidth_1);\n}\n\n\nfloat covBottomOffsetPx_0(float covHeight_1, float covYOffset_1)\n{\n\n return covHeight_1 - covYOffset_1;\n}\n\n\nfloat covBaselinePx_0(CoverageBandUniforms_0 u_2)\n{\n\n return u_2.covTop_0 + covBottomOffsetPx_0(u_2.covHeight_0, u_2.covYOffset_0);\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_3 = 1.0 + x_0;\n\n float _S8;\n if(u_3 == 1.0)\n {\n\n _S8 = x_0;\n\n }\n else\n {\n\n _S8 = log(u_3) * (x_0 / (u_3 - 1.0));\n\n }\n\n return _S8;\n}\n\nfloat symlogTransform_0(float x_1, float c_0)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_0));\n}\n\nfloat normalizeScore_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_0;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S9 = symlogTransform_0(score_0, symlogConstant_0);\n float _S10 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S10;\n\n t_0 = _S9;\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 _S11 = log2(max(score_0, tMax_0));\n float _S12 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S12;\n\n t_0 = _S11;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_0 = 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_0 > 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 clamp((t_0 - tMin_0) / tRange_0, 0.0, 1.0);\n}\n\n\nfloat normalizeDepthScalar_0(float rawDepth_0, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\n\nfloat covNormalizeDepth_0(float relDepth_0, CoverageBandUniforms_0 u_4)\n{\n return normalizeDepthScalar_0(relDepth_0 * u_4.regionMaxDepth_0, u_4.depthDomainMin_0, u_4.depthDomainMax_0, u_4.coverageScaleType_0, u_4.coverageSymlogConstant_0);\n}\n\n\nfloat covEffectiveHeightPx_0(float covHeight_2, float covYOffset_2)\n{\n\n return max(covHeight_2 - 2.0 * covYOffset_2, 0.0);\n}\n\n\nfloat covEffHeight_0(CoverageBandUniforms_0 u_5)\n{\n\n return covEffectiveHeightPx_0(u_5.covHeight_0, u_5.covYOffset_0);\n}\n\n\nfloat covBarHeightPx_0(float depthFraction_0, float effectiveHeightPx_0)\n{\n\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\n\nfloat covSegBottomPx_0(float baselinePx_0, float yOffset_0, float barHeightPx_0)\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_0)\n{\n\n return 1.0 - yPx_0 / canvasHeight_0 * 2.0;\n}\n\n\nfloat covSegTopPx_0(float baselinePx_1, float yOffset_1, float segHeight_0, float barHeightPx_1)\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\n\nfloat covFlipX_0(float x_2, CoverageBandUniforms_0 u_6)\n{\n\n return mix(x_2, - x_2, u_6.reversed_0);\n}\n\n\nvec4 covFlippedQuad_0(float x0_0, float x1_5, float yBot_0, float yTop_0, vec2 local_0, CoverageBandUniforms_0 u_7)\n{\n return vec4(covFlipX_0(mix(x0_0, x1_5, local_0.x), u_7), mix(yBot_0, yTop_0, local_0.y), 0.0, 1.0);\n}\n\n\nvec4 covSegQuad_0(uint position_0, uint widthBp_0, float yOffset_2, float segHeight_1, float relDepth_1, vec2 local_1, CoverageBandUniforms_0 u_8)\n{\n\n vec2 xx_0 = covExpandMinWidthX_0(covBpToClipX_0(position_0, u_8), covBpToClipX_0(position_0 + widthBp_0, u_8), u_8.canvasW_0);\n\n float basePx_0 = covBaselinePx_0(u_8);\n float barPx_0 = covBarHeightPx_0(covNormalizeDepth_0(relDepth_1, u_8), covEffHeight_0(u_8));\n return covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(basePx_0, yOffset_2, barPx_0), u_8.canvasH_0), yPxToClipY_0(covSegTopPx_0(basePx_0, yOffset_2, segHeight_1, barPx_0), u_8.canvasH_0), local_1, u_8);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_position;\n\n\nlayout(location = 1)\nin float a_relDepth;\n\n\nstruct CoverageVsOut_0\n{\n vec4 position_1;\n vec4 color_0;\n};\n\n\nvoid main()\n{\n\n CoverageVsOut_0 o_0;\n\n CoverageBandUniforms_0 _S13 = CoverageBandUniforms_0(u_0.bpHi_0, u_0.bpLo_0, u_0.bpLen_0, u_0.hpZero_0, u_0.canvasW_0, u_0.canvasH_0, u_0.covHeight_0, u_0.covYOffset_0, u_0.covTop_0, u_0.regionMaxDepth_0, u_0.depthDomainMax_0, u_0.depthDomainMin_0, u_0.coverageSymlogConstant_0, u_0.binSize_0, u_0.interbaseHeight_0, u_0.snpMinFreq_0, u_0.reversed_0, u_0.coverageScaleType_0, u_0.colorCoverage_0, u_0.colorBaseA_0, u_0.colorBaseC_0, u_0.colorBaseG_0, u_0.colorBaseT_0, u_0.colorBaseN_0, u_0.colorInsertionIndicator_0, u_0.colorSoftclipIndicator_0, u_0.colorHardclipIndicator_0);\n\n o_0.position_1 = covSegQuad_0(a_position, uint(u_0.binSize_0), 0.0, 1.0, a_relDepth, quadLocal_0(uint(gl_VertexID)), _S13);\n\n o_0.color_0 = vec4(unpackRGBA_0(u_0.colorCoverage_0).xyz, 1.0);\n CoverageVsOut_0 _S14 = o_0;\n\n gl_Position = o_0.position_1;\n\n v_color = _S14.color_0;\n\n return;\n}\n\n";
|
|
2
|
+
export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\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,4 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from coverageBar.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;\nstruct CoverageBandUniforms_0\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_1)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_1);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat covBpToClipX_0(uint bp_0, CoverageBandUniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3(u_1.bpHi_0, u_1.bpLo_0, u_1.bpLen_0), u_1.hpZero_0);\n}\n\n\nfloat expandToMinWidthLeftPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float _S6;\n if((x2_0 - x1_0) < minWidth_0)\n {\n\n _S6 = (x1_0 + x2_0) * 0.5 - minWidth_0 * 0.5;\n\n }\n else\n {\n\n _S6 = x1_0;\n\n }\n\n return _S6;\n}\n\nfloat expandToMinWidthRightPx_0(float x1_1, float x2_1, float minWidth_1)\n{\n\n float _S7;\n if((x2_1 - x1_1) < minWidth_1)\n {\n\n _S7 = (x1_1 + x2_1) * 0.5 + minWidth_1 * 0.5;\n\n }\n else\n {\n\n _S7 = x2_1;\n\n }\n\n return _S7;\n}\n\nvec2 expandToMinWidthPx_0(float x1_2, float x2_2, float minWidth_2)\n{\n\n return vec2(expandToMinWidthLeftPx_0(x1_2, x2_2, minWidth_2), expandToMinWidthRightPx_0(x1_2, x2_2, minWidth_2));\n}\n\n\n\n\nvec2 expandToMinWidthX_0(float x1_3, float x2_3, float minWidthPx_0, float canvasWidth_0)\n{\n\n return expandToMinWidthPx_0(x1_3, x2_3, minWidthPx_0 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 covExpandMinWidthX_0(float x1_4, float x2_4, float canvasWidth_1)\n{\n\n return expandToMinWidthX_0(x1_4, x2_4, 1.0, canvasWidth_1);\n}\n\n\nfloat covBottomOffsetPx_0(float covHeight_1, float covYOffset_1)\n{\n\n return covHeight_1 - covYOffset_1;\n}\n\n\nfloat covBaselinePx_0(CoverageBandUniforms_0 u_2)\n{\n\n return u_2.covTop_0 + covBottomOffsetPx_0(u_2.covHeight_0, u_2.covYOffset_0);\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_3 = 1.0 + x_0;\n\n float _S8;\n if(u_3 == 1.0)\n {\n\n _S8 = x_0;\n\n }\n else\n {\n\n _S8 = log(u_3) * (x_0 / (u_3 - 1.0));\n\n }\n\n return _S8;\n}\n\nfloat symlogTransform_0(float x_1, float c_0)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_0));\n}\n\nfloat normalizeScore_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_0;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S9 = symlogTransform_0(score_0, symlogConstant_0);\n float _S10 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S10;\n\n t_0 = _S9;\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 _S11 = log2(max(score_0, tMax_0));\n float _S12 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S12;\n\n t_0 = _S11;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_0 = 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_0 > 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 clamp((t_0 - tMin_0) / tRange_0, 0.0, 1.0);\n}\n\n\nfloat normalizeDepthScalar_0(float rawDepth_0, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\n\nfloat covNormalizeDepth_0(float relDepth_0, CoverageBandUniforms_0 u_4)\n{\n return normalizeDepthScalar_0(relDepth_0 * u_4.regionMaxDepth_0, u_4.depthDomainMin_0, u_4.depthDomainMax_0, u_4.coverageScaleType_0, u_4.coverageSymlogConstant_0);\n}\n\n\nfloat covEffectiveHeightPx_0(float covHeight_2, float covYOffset_2)\n{\n\n return max(covHeight_2 - 2.0 * covYOffset_2, 0.0);\n}\n\n\nfloat covEffHeight_0(CoverageBandUniforms_0 u_5)\n{\n\n return covEffectiveHeightPx_0(u_5.covHeight_0, u_5.covYOffset_0);\n}\n\n\nfloat covBarHeightPx_0(float depthFraction_0, float effectiveHeightPx_0)\n{\n\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\n\nfloat covSegBottomPx_0(float baselinePx_0, float yOffset_0, float barHeightPx_0)\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_0)\n{\n\n return 1.0 - yPx_0 / canvasHeight_0 * 2.0;\n}\n\n\nfloat covSegTopPx_0(float baselinePx_1, float yOffset_1, float segHeight_0, float barHeightPx_1)\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\n\nfloat covFlipX_0(float x_2, CoverageBandUniforms_0 u_6)\n{\n\n return mix(x_2, - x_2, u_6.reversed_0);\n}\n\n\nvec4 covFlippedQuad_0(float x0_0, float x1_5, float yBot_0, float yTop_0, vec2 local_0, CoverageBandUniforms_0 u_7)\n{\n return vec4(covFlipX_0(mix(x0_0, x1_5, local_0.x), u_7), mix(yBot_0, yTop_0, local_0.y), 0.0, 1.0);\n}\n\n\nvec4 covSegQuad_0(uint position_0, uint widthBp_0, float yOffset_2, float segHeight_1, float relDepth_1, vec2 local_1, CoverageBandUniforms_0 u_8)\n{\n\n vec2 xx_0 = covExpandMinWidthX_0(covBpToClipX_0(position_0, u_8), covBpToClipX_0(position_0 + widthBp_0, u_8), u_8.canvasW_0);\n\n float basePx_0 = covBaselinePx_0(u_8);\n float barPx_0 = covBarHeightPx_0(covNormalizeDepth_0(relDepth_1, u_8), covEffHeight_0(u_8));\n return covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(basePx_0, yOffset_2, barPx_0), u_8.canvasH_0), yPxToClipY_0(covSegTopPx_0(basePx_0, yOffset_2, segHeight_1, barPx_0), u_8.canvasH_0), local_1, u_8);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_position;\n\n\nlayout(location = 1)\nin float a_relDepth;\n\n\nstruct CoverageVsOut_0\n{\n vec4 position_1;\n vec4 color_0;\n};\n\n\nvoid main()\n{\n\n CoverageVsOut_0 o_0;\n\n CoverageBandUniforms_0 _S13 = CoverageBandUniforms_0(u_0.bpHi_0, u_0.bpLo_0, u_0.bpLen_0, u_0.hpZero_0, u_0.canvasW_0, u_0.canvasH_0, u_0.covHeight_0, u_0.covYOffset_0, u_0.covTop_0, u_0.regionMaxDepth_0, u_0.depthDomainMax_0, u_0.depthDomainMin_0, u_0.coverageSymlogConstant_0, u_0.binSize_0, u_0.interbaseHeight_0, u_0.snpMinFreq_0, u_0.reversed_0, u_0.coverageScaleType_0, u_0.colorCoverage_0, u_0.colorBaseA_0, u_0.colorBaseC_0, u_0.colorBaseG_0, u_0.colorBaseT_0, u_0.colorBaseN_0, u_0.colorInsertionIndicator_0, u_0.colorSoftclipIndicator_0, u_0.colorHardclipIndicator_0);\n\n o_0.position_1 = covSegQuad_0(a_position, uint(u_0.binSize_0), 0.0, 1.0, a_relDepth, quadLocal_0(uint(gl_VertexID)), _S13);\n\n o_0.color_0 = vec4(unpackRGBA_0(u_0.colorCoverage_0).xyz, 1.0);\n CoverageVsOut_0 _S14 = o_0;\n\n gl_Position = o_0.position_1;\n\n v_color = _S14.color_0;\n\n return;\n}\n\n";
|
|
4
|
+
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from coverageBar.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
3
|
export const BINDINGS = [
|
|
4
|
-
{ index: 1, kind: 'uniform', name: 'u' },
|
|
4
|
+
{ index: 1, kind: 'uniform', name: 'u', stages: ['vertex'] },
|
|
5
5
|
];
|
|
6
6
|
export const VERTS_PER_INSTANCE = 6;
|
|
7
7
|
export const UNIFORMS_SIZE_BYTES = 112;
|