@jbrowse/render-core 5.0.0-beta.11 → 5.0.0-beta.13
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/hal/webgl2Hal.js +3 -0
- package/esm/marks/barMark.js +4 -2
- package/esm/marks/index.d.ts +3 -3
- package/esm/marks/index.js +2 -2
- package/esm/marks/lineMark.d.ts +6 -0
- package/esm/marks/lineMark.js +34 -21
- package/esm/marks/linkMark.d.ts +21 -1
- package/esm/marks/linkMark.js +25 -6
- package/esm/marks/markPlan.d.ts +4 -3
- package/esm/marks/markPlan.js +5 -4
- package/esm/marks/rowLane.d.ts +2 -0
- package/esm/marks/rowLane.js +7 -3
- package/esm/marks/spanMark.d.ts +4 -3
- package/esm/marks/spanMark.js +3 -3
- package/esm/marks/types.d.ts +4 -1
- package/esm/marks/types.js +3 -1
- package/esm/shaders/barMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/barMark.glsl.generated.js +1 -1
- package/esm/shaders/barMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/barMark.wgsl.generated.js +1 -1
- package/esm/shaders/curveDistance.js.generated.d.ts +1 -0
- package/esm/shaders/curveDistance.js.generated.js +9 -0
- package/esm/shaders/insertionGlyph.generated.d.ts +6 -0
- package/esm/shaders/insertionGlyph.generated.js +8 -0
- package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -2
- package/esm/shaders/lineCenterMark.glsl.generated.js +2 -2
- package/esm/shaders/lineCenterMark.iface.generated.d.ts +11 -9
- package/esm/shaders/lineCenterMark.iface.generated.js +20 -18
- package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/lineCenterMark.wgsl.generated.js +1 -1
- package/esm/shaders/lineCommon.js.generated.d.ts +1 -0
- package/esm/shaders/lineCommon.js.generated.js +20 -0
- package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -2
- package/esm/shaders/lineStepMark.glsl.generated.js +2 -2
- package/esm/shaders/lineStepMark.iface.generated.d.ts +11 -9
- package/esm/shaders/lineStepMark.iface.generated.js +20 -18
- package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/lineStepMark.wgsl.generated.js +1 -1
- package/esm/shaders/linkMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/linkMark.glsl.generated.js +1 -1
- package/esm/shaders/linkMark.js.generated.d.ts +2 -1
- package/esm/shaders/linkMark.js.generated.js +3 -3
- package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/linkMark.wgsl.generated.js +1 -1
- package/esm/shaders/pointMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/pointMark.glsl.generated.js +1 -1
- package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/pointMark.wgsl.generated.js +1 -1
- package/esm/shaders/spanMark.glsl.generated.d.ts +1 -1
- package/esm/shaders/spanMark.glsl.generated.js +1 -1
- package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -1
- package/esm/shaders/spanMark.wgsl.generated.js +1 -1
- package/esm/slangPass.d.ts +5 -3
- package/esm/slangPass.js +2 -2
- package/package.json +2 -2
- package/src/shaders/barMark.glsl.generated.ts +1 -1
- package/src/shaders/barMark.wgsl.generated.ts +1 -1
- package/src/shaders/curveDistance.js.generated.ts +12 -0
- package/src/shaders/curveDistance.slang +1 -1
- package/src/shaders/insertionGlyph.generated.ts +14 -0
- package/src/shaders/insertionGlyph.slang +59 -0
- package/src/shaders/lineCenterMark.glsl.generated.ts +2 -2
- package/src/shaders/lineCenterMark.iface.generated.ts +21 -18
- package/src/shaders/lineCenterMark.slang +5 -1
- package/src/shaders/lineCenterMark.wgsl.generated.ts +1 -1
- package/src/shaders/lineCommon.js.generated.ts +20 -0
- package/src/shaders/lineCommon.slang +14 -4
- package/src/shaders/lineStepMark.glsl.generated.ts +2 -2
- package/src/shaders/lineStepMark.iface.generated.ts +21 -18
- package/src/shaders/lineStepMark.slang +5 -1
- package/src/shaders/lineStepMark.wgsl.generated.ts +1 -1
- package/src/shaders/linkMark.glsl.generated.ts +1 -1
- package/src/shaders/linkMark.js.generated.ts +3 -3
- package/src/shaders/linkMark.slang +10 -7
- package/src/shaders/linkMark.wgsl.generated.ts +1 -1
- package/src/shaders/pointMark.glsl.generated.ts +1 -1
- package/src/shaders/pointMark.wgsl.generated.ts +1 -1
- package/src/shaders/rowTable.slang +5 -1
- package/src/shaders/spanMark.glsl.generated.ts +1 -1
- package/src/shaders/spanMark.wgsl.generated.ts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S30;\n if((c_2.w) > 0.0)\n {\n\n _S30 = c_2;\n\n }\n else\n {\n\n _S30 = _S28;\n\n }\n\n p_0.color_0 = _S30;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S31 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n RowRectVsOut_0 o_0;\n if(_S31.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S32 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S32.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S31.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S31.color_0;\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n}\n\n";
|
|
1
|
+
export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n p_0.overridden_0 = false;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n bool _S30 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S30;\n\n vec4 _S31;\n if(_S30)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S28;\n\n }\n\n p_0.color_0 = _S31;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S32 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n RowRectVsOut_0 o_0;\n if(_S32.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S32.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S32.color_0;\n RowRectVsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_1;\n\n return;\n}\n\n";
|
|
2
2
|
export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
-
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S30;\n if((c_2.w) > 0.0)\n {\n\n _S30 = c_2;\n\n }\n else\n {\n\n _S30 = _S28;\n\n }\n\n p_0.color_0 = _S30;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S31 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n RowRectVsOut_0 o_0;\n if(_S31.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S32 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S32.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S31.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S31.color_0;\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n}\n\n";
|
|
3
|
+
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float minCellDenomPx_0;\n float minCellPx_0;\n float zero_0;\n float rowHeight_0;\n float rowProportion_0;\n float scrollTop_0;\n int rowTableKeys_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_0 > 0.0)\n {\n\n tMax_0 = domainMin_0;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_0, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_0;\n\n tMin_0 = domainMin_0;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S11 = v_0 == 0U;\n\n bool _S12;\n\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 2U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 3U;\n\n }\n\n float _S13;\n\n if(_S12)\n {\n\n _S13 = 0.0;\n\n }\n else\n {\n\n _S13 = 1.0;\n\n }\n if(_S11)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 1U;\n\n }\n\n if(_S12)\n {\n\n _S12 = true;\n\n }\n else\n {\n\n _S12 = v_0 == 4U;\n\n }\n\n float _S14;\n\n if(_S12)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n\n return vec2(_S13, _S14);\n}\n\n\nfloat drawnRowHeightPx_0(float rowHeight_1, float rowProportion_1)\n{\n\n return max(rowHeight_1 * rowProportion_1, 1.0);\n}\n\nfloat rowBandOffsetPx_0(float rowHeight_2, float rowProportion_2)\n{\n\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5;\n}\n\n\nstruct RowBand_0\n{\n float height_0;\n float offset_0;\n};\n\n\nRowBand_0 rowBandPx_0(float rowHeight_3, float rowProportion_3)\n{\n\n RowBand_0 band_1;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S15;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S15 = - minWidth_0;\n\n }\n else\n {\n\n _S15 = minWidth_0;\n\n }\n\n _S15 = x1_0 + _S15;\n\n }\n else\n {\n\n _S15 = x2_0;\n\n }\n\n return _S15;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nstruct RowRectUniforms_0\n{\n vec3 bpRangeX_1;\n float canvasHeight_2;\n float minCellDenomPx_1;\n float minCellPx_1;\n float zero_1;\n float rowHeight_4;\n float rowProportion_4;\n float scrollTop_1;\n};\n\n\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_2)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_2 = rowBandPx_0(u_2.rowHeight_4, u_2.rowProportion_4);\n float rowY_0 = band_2.offset_0 + u_2.rowHeight_4 * rowIndex_0 - u_2.scrollTop_1;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_2.bpRangeX_1, u_2.zero_1);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_2.bpRangeX_1, u_2.zero_1), u_2.minCellPx_1, u_2.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_2.canvasHeight_2), 0.0, 1.0);\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin uint a_row;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nvec4 rampColor_0(float _S16)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S16, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S17, int _S18, float _S19, float _S20, float _S21, int _S22, vec4 _S23, vec4 _S24)\n{\n\n if(_S18 == 0)\n {\n\n return unpackRGBA_0(_S17);\n }\n if(_S17 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_2;\n\n if((_S17 & 2139095040U) == 2139095040U)\n {\n\n if((_S17 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S17 & 2147483648U) != 0U;\n if(_S18 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_2 = 0;\n\n }\n else\n {\n\n scaleType_2 = _S22;\n\n }\n\n return u_0.colorBands_0[scaleType_2];\n }\n\n float _S25;\n\n if(negative_0)\n {\n\n _S25 = 0.0;\n\n }\n else\n {\n\n _S25 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S25, _S21));\n }\n float value_2 = uintBitsToFloat(_S17);\n if(_S18 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_2, _S22, _S23, _S24)];\n }\n if(_S18 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_2, _S19, _S20, scaleType_2, 1.0), _S21));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_0;\n vec4 color_0;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S26, int _S27, vec4 _S28)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = _S26;\n p_0.color_0 = _S28;\n p_0.overridden_0 = false;\n if(_S27 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S27);\n if(_S26 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_0 = rowTablePlaneHeight_0(n_0);\n uint _S29 = rowTableTexelX_0(_S26, n_0);\n\n float u_3 = (float(_S29) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_0);\n uint y_0 = rowTableTexelY_0(_S26, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_3, (float(y_0 + h_0) + 0.5) / rows_0)), (0.0)));\n bool _S30 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S30;\n\n vec4 _S31;\n if(_S30)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S28;\n\n }\n\n p_0.color_0 = _S31;\n return p_0;\n}\n\n\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_1;\n};\n\n\nvoid main()\n{\n\n RowPlacement_0 _S32 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n RowRectVsOut_0 o_0;\n if(_S32.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_1 = vec4(0.0);\n RowRectVsOut_0 _S33 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S33.color_1;\n\n return;\n }\n RowRectUniforms_0 r_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(a_x, a_x2, float(_S32.slot_0), uint(gl_VertexID), r_0);\n o_0.color_1 = _S32.color_0;\n RowRectVsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_1;\n\n return;\n}\n\n";
|
|
4
4
|
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S15 : bool = v_0 == u32(0);\n var _S16 : bool;\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(2);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(3);\n }\n var _S17 : f32;\n if(_S16)\n {\n _S17 = 0.0f;\n }\n else\n {\n _S17 = 1.0f;\n }\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(1);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(4);\n }\n var _S18 : f32;\n if(_S16)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n return vec2<f32>(_S17, _S18);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S19 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S19 = - minWidth_0;\n }\n else\n {\n _S19 = minWidth_0;\n }\n _S19 = x1_0 + _S19;\n }\n else\n {\n _S19 = x2_0;\n }\n return _S19;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S20 : texture_2d<f32>, _S21 : sampler, _S22 : u32, _S23 : i32, _S24 : f32, _S25 : f32, _S26 : f32, _S27 : i32, _S28 : vec4<f32>, _S29 : vec4<f32>) -> vec4<f32>\n{\n if(_S23 == i32(0))\n {\n return unpackRGBA_0(_S22);\n }\n if(_S22 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S22 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S22 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S22 & (u32(2147483648)))) != u32(0);\n if(_S23 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S27;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S30 : f32;\n if(negative_0)\n {\n _S30 = 0.0f;\n }\n else\n {\n _S30 = 1.0f;\n }\n return rampColor_0(_S20, _S21, rampMidT_0(_S30, _S26));\n }\n var value_2 : f32 = (bitcast<f32>((_S22)));\n if(_S23 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S27, _S28, _S29)];\n }\n if(_S23 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S20, _S21, rampMidT_0(normalizeScore_0(value_2, _S24, _S25, scaleType_2, 1.0f), _S26));\n}\n\n@vertex\nfn vs_main( _S31 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S32 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S31.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S31.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var o_0 : RowRectVsOut_0;\n if(_S32.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S31.x_2, _S31.x2_2, f32(_S32.slot_0), vid_2, r_0);\n o_0.color_1 = _S32.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S33 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S34 : pixelOutput_0 = pixelOutput_0( _S33.color_3 );\n return _S34;\n}\n\n";
|
|
1
|
+
export declare const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n overridden_0 : bool,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n p_0.overridden_0 = false;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : bool = (_S13.w) > 0.0f;\n p_0.overridden_0 = _S14;\n var _S15 : vec4<f32>;\n if(_S14)\n {\n _S15 = _S13;\n }\n else\n {\n _S15 = own_0;\n }\n p_0.color_0 = _S15;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S16 : bool = v_0 == u32(0);\n var _S17 : bool;\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(2);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(3);\n }\n var _S18 : f32;\n if(_S17)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(1);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(4);\n }\n var _S19 : f32;\n if(_S17)\n {\n _S19 = 0.0f;\n }\n else\n {\n _S19 = 1.0f;\n }\n return vec2<f32>(_S18, _S19);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S20 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S20 = - minWidth_0;\n }\n else\n {\n _S20 = minWidth_0;\n }\n _S20 = x1_0 + _S20;\n }\n else\n {\n _S20 = x2_0;\n }\n return _S20;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S21 : texture_2d<f32>, _S22 : sampler, _S23 : u32, _S24 : i32, _S25 : f32, _S26 : f32, _S27 : f32, _S28 : i32, _S29 : vec4<f32>, _S30 : vec4<f32>) -> vec4<f32>\n{\n if(_S24 == i32(0))\n {\n return unpackRGBA_0(_S23);\n }\n if(_S23 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S23 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S23 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S23 & (u32(2147483648)))) != u32(0);\n if(_S24 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S28;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S31 : f32;\n if(negative_0)\n {\n _S31 = 0.0f;\n }\n else\n {\n _S31 = 1.0f;\n }\n return rampColor_0(_S21, _S22, rampMidT_0(_S31, _S27));\n }\n var value_2 : f32 = (bitcast<f32>((_S23)));\n if(_S24 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S28, _S29, _S30)];\n }\n if(_S24 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S21, _S22, rampMidT_0(normalizeScore_0(value_2, _S25, _S26, scaleType_2, 1.0f), _S27));\n}\n\n@vertex\nfn vs_main( _S32 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S33 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S32.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S32.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var o_0 : RowRectVsOut_0;\n if(_S33.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S32.x_2, _S32.x2_2, f32(_S33.slot_0), vid_2, r_0);\n o_0.color_1 = _S33.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S34 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S35 : pixelOutput_0 = pixelOutput_0( _S34.color_3 );\n return _S35;\n}\n\n";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
-
export const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S15 : bool = v_0 == u32(0);\n var _S16 : bool;\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(2);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(3);\n }\n var _S17 : f32;\n if(_S16)\n {\n _S17 = 0.0f;\n }\n else\n {\n _S17 = 1.0f;\n }\n if(_S15)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(1);\n }\n if(_S16)\n {\n _S16 = true;\n }\n else\n {\n _S16 = v_0 == u32(4);\n }\n var _S18 : f32;\n if(_S16)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n return vec2<f32>(_S17, _S18);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S19 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S19 = - minWidth_0;\n }\n else\n {\n _S19 = minWidth_0;\n }\n _S19 = x1_0 + _S19;\n }\n else\n {\n _S19 = x2_0;\n }\n return _S19;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S20 : texture_2d<f32>, _S21 : sampler, _S22 : u32, _S23 : i32, _S24 : f32, _S25 : f32, _S26 : f32, _S27 : i32, _S28 : vec4<f32>, _S29 : vec4<f32>) -> vec4<f32>\n{\n if(_S23 == i32(0))\n {\n return unpackRGBA_0(_S22);\n }\n if(_S22 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S22 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S22 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S22 & (u32(2147483648)))) != u32(0);\n if(_S23 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S27;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S30 : f32;\n if(negative_0)\n {\n _S30 = 0.0f;\n }\n else\n {\n _S30 = 1.0f;\n }\n return rampColor_0(_S20, _S21, rampMidT_0(_S30, _S26));\n }\n var value_2 : f32 = (bitcast<f32>((_S22)));\n if(_S23 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S27, _S28, _S29)];\n }\n if(_S23 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S20, _S21, rampMidT_0(normalizeScore_0(value_2, _S24, _S25, scaleType_2, 1.0f), _S26));\n}\n\n@vertex\nfn vs_main( _S31 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S32 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S31.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S31.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var o_0 : RowRectVsOut_0;\n if(_S32.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S31.x_2, _S31.x2_2, f32(_S32.slot_0), vid_2, r_0);\n o_0.color_1 = _S32.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S33 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S34 : pixelOutput_0 = pixelOutput_0( _S33.color_3 );\n return _S34;\n}\n\n";
|
|
3
|
+
export const WGSL_SOURCE = "struct SpanMarkUniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minCellPx_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(16) rowProportion_0 : f32,\n @align(4) scrollTop_0 : f32,\n @align(8) rowTableKeys_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) rampMidNorm_0 : f32,\n @align(4) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : SpanMarkUniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_0, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_0 > 0.0f)\n {\n tMax_0 = domainMin_0;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_0, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_0;\n tMin_0 = domainMin_0;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n overridden_0 : bool,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n p_0.overridden_0 = false;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : bool = (_S13.w) > 0.0f;\n p_0.overridden_0 = _S14;\n var _S15 : vec4<f32>;\n if(_S14)\n {\n _S15 = _S13;\n }\n else\n {\n _S15 = own_0;\n }\n p_0.color_0 = _S15;\n return p_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S16 : bool = v_0 == u32(0);\n var _S17 : bool;\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(2);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(3);\n }\n var _S18 : f32;\n if(_S17)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(1);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(4);\n }\n var _S19 : f32;\n if(_S17)\n {\n _S19 = 0.0f;\n }\n else\n {\n _S19 = 1.0f;\n }\n return vec2<f32>(_S18, _S19);\n}\n\nfn drawnRowHeightPx_0( rowHeight_1 : f32, rowProportion_1 : f32) -> f32\n{\n return max(rowHeight_1 * rowProportion_1, 1.0f);\n}\n\nfn rowBandOffsetPx_0( rowHeight_2 : f32, rowProportion_2 : f32) -> f32\n{\n return (rowHeight_2 - drawnRowHeightPx_0(rowHeight_2, rowProportion_2)) * 0.5f;\n}\n\nstruct RowBand_0\n{\n height_0 : f32,\n offset_0 : f32,\n};\n\nfn rowBandPx_0( rowHeight_3 : f32, rowProportion_3 : f32) -> RowBand_0\n{\n var band_1 : RowBand_0;\n band_1.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_1.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_1;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S20 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S20 = - minWidth_0;\n }\n else\n {\n _S20 = minWidth_0;\n }\n _S20 = x1_0 + _S20;\n }\n else\n {\n _S20 = x2_0;\n }\n return _S20;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_0, canvasWidth_0));\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nstruct RowRectUniforms_0\n{\n bpRangeX_1 : vec3<f32>,\n canvasHeight_2 : f32,\n minCellDenomPx_1 : f32,\n minCellPx_1 : f32,\n zero_1 : f32,\n rowHeight_4 : f32,\n rowProportion_4 : f32,\n scrollTop_1 : f32,\n};\n\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_3 : RowRectUniforms_0) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_2 : RowBand_0 = rowBandPx_0(u_3.rowHeight_4, u_3.rowProportion_4);\n var rowY_0 : f32 = band_2.offset_0 + u_3.rowHeight_4 * rowIndex_0 - u_3.scrollTop_1;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), u_3.bpRangeX_1, u_3.zero_1);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_3.bpRangeX_1, u_3.zero_1), u_3.minCellPx_1, u_3.minCellDenomPx_1), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_2.height_0, local_0.y), u_3.canvasHeight_2), 0.0f, 1.0f);\n}\n\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) row_0 : u32,\n @location(3) color_2 : u32,\n};\n\nfn markScaleColor_0( _S21 : texture_2d<f32>, _S22 : sampler, _S23 : u32, _S24 : i32, _S25 : f32, _S26 : f32, _S27 : f32, _S28 : i32, _S29 : vec4<f32>, _S30 : vec4<f32>) -> vec4<f32>\n{\n if(_S24 == i32(0))\n {\n return unpackRGBA_0(_S23);\n }\n if(_S23 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_2 : i32;\n if(((_S23 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S23 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S23 & (u32(2147483648)))) != u32(0);\n if(_S24 == i32(3))\n {\n if(negative_0)\n {\n scaleType_2 = i32(0);\n }\n else\n {\n scaleType_2 = _S28;\n }\n return u_0.colorBands_0[scaleType_2];\n }\n var _S31 : f32;\n if(negative_0)\n {\n _S31 = 0.0f;\n }\n else\n {\n _S31 = 1.0f;\n }\n return rampColor_0(_S21, _S22, rampMidT_0(_S31, _S27));\n }\n var value_2 : f32 = (bitcast<f32>((_S23)));\n if(_S24 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_2, _S28, _S29, _S30)];\n }\n if(_S24 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(_S21, _S22, rampMidT_0(normalizeScore_0(value_2, _S25, _S26, scaleType_2, 1.0f), _S27));\n}\n\n@vertex\nfn vs_main( _S32 : vertexInput_0, @builtin(vertex_index) vid_2 : u32) -> RowRectVsOut_0\n{\n var _S33 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S32.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S32.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n var o_0 : RowRectVsOut_0;\n if(_S33.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n return o_0;\n }\n var r_0 : RowRectUniforms_0;\n r_0.bpRangeX_1 = u_0.bpRangeX_0;\n r_0.canvasHeight_2 = u_0.canvasHeight_0;\n r_0.minCellDenomPx_1 = u_0.minCellDenomPx_0;\n r_0.minCellPx_1 = u_0.minCellPx_0;\n r_0.zero_1 = u_0.zero_0;\n r_0.rowHeight_4 = u_0.rowHeight_0;\n r_0.rowProportion_4 = u_0.rowProportion_0;\n r_0.scrollTop_1 = u_0.scrollTop_0;\n o_0.position_0 = rowRectClipPos_0(_S32.x_2, _S32.x2_2, f32(_S33.slot_0), vid_2, r_0);\n o_0.color_1 = _S33.color_0;\n return o_0;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S34 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S35 : pixelOutput_0 = pixelOutput_0( _S34.color_3 );\n return _S35;\n}\n\n";
|
package/esm/slangPass.d.ts
CHANGED
|
@@ -18,8 +18,6 @@ export interface ShaderModule {
|
|
|
18
18
|
* Every remaining field is an override of something the module already carries,
|
|
19
19
|
* for a shader drawn by two passes that disagree:
|
|
20
20
|
*
|
|
21
|
-
* - `verticesPerInstance` — the canvas chevron pass, whose count is the
|
|
22
|
-
* shader's `CHEVRON_VERTS` times a cap the *renderer* chooses.
|
|
23
21
|
* - `blendState` / `topology` — no pass in the tree overrides these. Wiggle's
|
|
24
22
|
* step line and center line did while they shared one module and blended
|
|
25
23
|
* differently (src-over against max); each record now has its own module,
|
|
@@ -28,6 +26,11 @@ export interface ShaderModule {
|
|
|
28
26
|
* - `blend: false` — nothing disables blending today, which is why there is no
|
|
29
27
|
* `//! blend: none` to inherit it from.
|
|
30
28
|
*
|
|
29
|
+
* There is deliberately no `verticesPerInstance` override. A shape whose count
|
|
30
|
+
* moves per frame (the canvas chevrons, one slot per chevron the canvas can
|
|
31
|
+
* show) states one instance's worth in the module and answers the rest in
|
|
32
|
+
* `MarkShape.verticesPerInstance` at each draw.
|
|
33
|
+
*
|
|
31
34
|
* There is deliberately no `textures` override either. It existed for one
|
|
32
35
|
* caller, which rebuilt the generated `TEXTURES` with `filter: 'nearest'`
|
|
33
36
|
* because the codegen emitted `linear` for every sampler; the filter a module's
|
|
@@ -47,7 +50,6 @@ export interface ShaderModule {
|
|
|
47
50
|
export interface SlangPassOpts {
|
|
48
51
|
id: string;
|
|
49
52
|
mod: ShaderModule;
|
|
50
|
-
verticesPerInstance?: number;
|
|
51
53
|
topology?: PipelineDescriptor['topology'];
|
|
52
54
|
blend?: boolean;
|
|
53
55
|
blendState?: BlendState;
|
package/esm/slangPass.js
CHANGED
|
@@ -7,11 +7,11 @@ export function slangPass(opts) {
|
|
|
7
7
|
`binding stages, so an older jbrowse-build-shaders generated it; ` +
|
|
8
8
|
`regenerate it`);
|
|
9
9
|
}
|
|
10
|
-
const verticesPerInstance = opts.
|
|
10
|
+
const verticesPerInstance = opts.mod.VERTS_PER_INSTANCE;
|
|
11
11
|
if (verticesPerInstance === undefined) {
|
|
12
12
|
throw new Error(`slangPass(${opts.id}): no verticesPerInstance — declare ` +
|
|
13
13
|
`'public static const uint VERTS_PER_INSTANCE = N;' in the .slang ` +
|
|
14
|
-
`source
|
|
14
|
+
`source`);
|
|
15
15
|
}
|
|
16
16
|
return {
|
|
17
17
|
id: opts.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/render-core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "GPU/Canvas2D rendering primitives for JBrowse displays: the HAL, the draw-lifecycle mixin, per-region/global backend bases, and the React backend hooks",
|
|
6
6
|
"keywords": [
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@jbrowse/mobx-state-tree": "^6.7.0",
|
|
99
|
-
"mobx": "^7.0.
|
|
99
|
+
"mobx": "^7.0.6"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"react": ">=19.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
3
|
|
|
4
|
-
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_1) + 0.5) / rows_0)), (0.0)));\n\n vec4 _S31;\n if((c_2.w) > 0.0)\n {\n\n _S31 = c_2;\n\n }\n else\n {\n\n _S31 = _S29;\n\n }\n\n p_0.color_1 = _S31;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S32)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S33 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S33.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S34 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S34.color_0;\n\n v_barInkPx = _S34.barInkPx_0;\n\n return;\n }\n\n float _S35 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S35, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S33.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S36 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S36.color_0;\n\n v_barInkPx = _S36.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S38 = min(valueY_0, originY_0);\n float _S39 = max(valueY_0, originY_0);\n float vy_0 = mix(_S39 + padPx_0, _S38 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S33.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S38, vy_0 - _S39);\n VsOut_0 _S40 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S40.color_0;\n\n v_barInkPx = _S40.barInkPx_0;\n\n return;\n}\n\n"
|
|
4
|
+
export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nuniform sampler2D u_rowTable;\n\n\nvec4 unpackRGBA_0(uint c_0)\n{\n\n return vec4(float((c_0 >> 0U) & 255U), float((c_0 >> 8U) & 255U), float((c_0 >> 16U) & 255U), float((c_0 >> 24U) & 255U)) / 255.0;\n}\n\n\nfloat rampMidT_0(float t_0, float mid_0)\n{\n\n float _S1 = max(mid_0, 1.0 - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0 * _S1), 0.0, 1.0);\n}\n\n\nfloat colorCutAt_0(int i_0, vec4 cutsLo_0, vec4 cutsHi_0)\n{\n\n float _S2;\n if(i_0 < 4)\n {\n\n _S2 = cutsLo_0[i_0];\n\n }\n else\n {\n\n _S2 = cutsHi_0[i_0 - 4];\n\n }\n\n return _S2;\n}\n\n\nint thresholdBand_0(float value_0, int cutCount_0, vec4 cutsLo_1, vec4 cutsHi_1)\n{\n\n int band_0 = 0;\n\n int i_1 = 0;\n\n for(;;)\n {\n\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n\n break;\n }\n\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n\n band_0 = i_1 + 1;\n\n }\n\n i_1 = i_1 + 1;\n\n }\n\n return band_0;\n}\n\n\nfloat log1pf_0(float x_0)\n{\n\n float u_1 = 1.0 + x_0;\n\n float _S3;\n if(u_1 == 1.0)\n {\n\n _S3 = x_0;\n\n }\n else\n {\n\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0));\n\n }\n\n return _S3;\n}\n\nfloat symlogTransform_0(float x_1, float c_1)\n{\n\n return float((int(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\n\nfloat normalizeScoreUnclamped_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n float tMax_0;\n\n float tMin_0;\n\n float t_1;\n\n\n\n if(scaleType_0 == 2)\n {\n\n float _S4 = symlogTransform_0(score_0, symlogConstant_0);\n float _S5 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n\n tMin_0 = _S5;\n\n t_1 = _S4;\n\n }\n else\n {\n\n if(scaleType_0 == 1)\n {\n if(domainMin_1 > 0.0)\n {\n\n tMax_0 = domainMin_1;\n\n }\n else\n {\n\n tMax_0 = 1.0;\n\n }\n float _S6 = log2(max(score_0, tMax_0));\n float _S7 = log2(tMax_0);\n\n tMax_0 = log2(max(domainMax_1, tMax_0));\n\n tMin_0 = _S7;\n\n t_1 = _S6;\n\n }\n else\n {\n\n tMax_0 = domainMax_1;\n\n tMin_0 = domainMin_1;\n\n t_1 = score_0;\n\n }\n\n }\n\n float tRange_0 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n if(t_1 > tMin_0)\n {\n\n tMax_0 = 1.0;\n\n }\n else\n {\n\n tMax_0 = 0.0;\n\n }\n\n return tMax_0;\n }\n return (t_1 - tMin_0) / tRange_0;\n}\n\nfloat normalizeScore_0(float score_1, float domainMin_2, float domainMax_2, int scaleType_1, float symlogConstant_1)\n{\n\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0, 1.0);\n}\n\n\nuint rowTableWidth_0(uint keys_0)\n{\n\n return max(min(keys_0, 2048U), 1U);\n}\n\nuint rowTablePlaneHeight_0(uint keys_1)\n{\n\n uint w_0 = rowTableWidth_0(keys_1);\n uint _S8 = (keys_1 + w_0 - 1U) / w_0;\n\n return max(_S8, 1U);\n}\n\nuint rowTableTexelX_0(uint key_0, uint keys_2)\n{\n\n uint _S9 = key_0 % rowTableWidth_0(keys_2);\n\n return _S9;\n}\n\n\nuint rowTableTexelY_0(uint key_1, uint keys_3)\n{\n\n uint _S10 = key_1 / rowTableWidth_0(keys_3);\n\n return _S10;\n}\n\n\nuint byteOf_0(float channel_0)\n{\n\n return uint(channel_0 * 255.0 + 0.5);\n}\n\n\nvec2 hpSplitUint_0(uint value_1)\n{\n\n uint lo_0 = value_1 & 4095U;\n\n return vec2(float(value_1 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n\n float floorBp_0 = -3.00000000549775576e+38 + hpZero_0;\n float step_0 = 2.0 / bpRange_0.z;\n\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat pxToClipLen_0(float px_0, float size_0)\n{\n\n return px_0 * 2.0 / size_0;\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S11;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S11 = - minWidth_0;\n\n }\n else\n {\n\n _S11 = minWidth_0;\n\n }\n\n _S11 = x1_0 + _S11;\n\n }\n else\n {\n\n _S11 = x2_0;\n\n }\n\n return _S11;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S12 = v_0 == 0U;\n\n bool _S13;\n\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 2U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 3U;\n\n }\n\n float _S14;\n\n if(_S13)\n {\n\n _S14 = 0.0;\n\n }\n else\n {\n\n _S14 = 1.0;\n\n }\n if(_S12)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 1U;\n\n }\n\n if(_S13)\n {\n\n _S13 = true;\n\n }\n else\n {\n\n _S13 = v_0 == 4U;\n\n }\n\n float _S15;\n\n if(_S13)\n {\n\n _S15 = 0.0;\n\n }\n else\n {\n\n _S15 = 1.0;\n\n }\n\n return vec2(_S14, _S15);\n}\n\n\nfloat rowBandTopPx_0(float rowOffsetPx_1, float rowHeight_1, uint slot_0)\n{\n\n return rowOffsetPx_1 + rowHeight_1 * float(slot_0);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nint clipSide_0(float value_2, float domainMin_3, float domainMax_3, int scaleType_2)\n{\n\n float tolerance_0 = (domainMax_3 - domainMin_3) * 0.00000999999974738;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n\n return 1;\n }\n\n bool _S16;\n\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n\n _S16 = scaleType_2 != 1;\n\n }\n else\n {\n\n _S16 = false;\n\n }\n\n if(_S16)\n {\n\n return -1;\n }\n return 0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nfloat valueToYPxScaled_0(float value_3, float domainMin_4, float domainMax_4, float h_0, int scaleType_3, float symlogConstant_2)\n{\n\n return (1.0 - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nlayout(location = 4)\nin uint a_row;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S17)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S17, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markScaleColor_0(uint _S18, int _S19, float _S20, float _S21, float _S22, int _S23, vec4 _S24, vec4 _S25)\n{\n\n if(_S19 == 0)\n {\n\n return unpackRGBA_0(_S18);\n }\n if(_S18 == 2143289345U)\n {\n\n return unpackRGBA_0(4289703855U);\n }\n\n int scaleType_4;\n\n if((_S18 & 2139095040U) == 2139095040U)\n {\n\n if((_S18 & 8388607U) != 0U)\n {\n\n return unpackRGBA_0(4286611584U);\n }\n\n bool negative_0 = (_S18 & 2147483648U) != 0U;\n if(_S19 == 3)\n {\n\n if(negative_0)\n {\n\n scaleType_4 = 0;\n\n }\n else\n {\n\n scaleType_4 = _S23;\n\n }\n\n return u_0.colorBands_0[scaleType_4];\n }\n\n float _S26;\n\n if(negative_0)\n {\n\n _S26 = 0.0;\n\n }\n else\n {\n\n _S26 = 1.0;\n\n }\n\n return rampColor_0(rampMidT_0(_S26, _S22));\n }\n float value_4 = uintBitsToFloat(_S18);\n if(_S19 == 3)\n {\n\n return u_0.colorBands_0[thresholdBand_0(value_4, _S23, _S24, _S25)];\n }\n if(_S19 == 2)\n {\n\n scaleType_4 = 1;\n\n }\n else\n {\n\n scaleType_4 = 0;\n\n }\n return rampColor_0(rampMidT_0(normalizeScore_0(value_4, _S20, _S21, scaleType_4, 1.0), _S22));\n}\n\n\nstruct RowPlacement_0\n{\n bool hidden_0;\n uint slot_1;\n vec4 color_1;\n bool overridden_0;\n};\n\n\nRowPlacement_0 rowTableLookup_0(uint _S27, int _S28, vec4 _S29)\n{\n\n RowPlacement_0 p_0;\n p_0.hidden_0 = false;\n p_0.slot_1 = _S27;\n p_0.color_1 = _S29;\n p_0.overridden_0 = false;\n if(_S28 < 0)\n {\n\n return p_0;\n }\n uint n_0 = uint(_S28);\n if(_S27 >= n_0)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n uint h_1 = rowTablePlaneHeight_0(n_0);\n uint _S30 = rowTableTexelX_0(_S27, n_0);\n\n float u_2 = (float(_S30) + 0.5) / float(rowTableWidth_0(n_0));\n float rows_0 = float(2U * h_1);\n uint y_0 = rowTableTexelY_0(_S27, n_0);\n vec4 s_0 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0) + 0.5) / rows_0)), (0.0)));\n if((s_0.w) < 0.5)\n {\n\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_1 = ((byteOf_0(s_0.x)) | ((byteOf_0(s_0.y)) << 8)) | ((byteOf_0(s_0.z)) << 16);\n vec4 c_2 = (textureLod((u_rowTable), (vec2(u_2, (float(y_0 + h_1) + 0.5) / rows_0)), (0.0)));\n bool _S31 = (c_2.w) > 0.0;\n\n p_0.overridden_0 = _S31;\n\n vec4 _S32;\n if(_S31)\n {\n\n _S32 = c_2;\n\n }\n else\n {\n\n _S32 = _S29;\n\n }\n\n p_0.color_1 = _S32;\n return p_0;\n}\n\n\nfloat bpToClipX_0(uint _S33)\n{\n\n return hpToClipX_0(hpSplitUint_0(_S33), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n\nvoid main()\n{\n\n VsOut_0 o_0;\n\n RowPlacement_0 _S34 = rowTableLookup_0(a_row, u_0.rowTableKeys_0, markScaleColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[0], u_0.colorCuts_0[1]));\n\n\n if(_S34.hidden_0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S35 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S35.color_0;\n\n v_barInkPx = _S35.barInkPx_0;\n\n return;\n }\n\n float _S36 = bpToClipX_0(a_x);\n\n\n\n float sx2_0 = extendToMinWidthX_0(_S36, bpToClipX_0(a_x2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float bandTop_0 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_1);\n float padPx_0 = barAaPx_0();\n\n if(uint(gl_VertexID) >= 6U)\n {\n\n int side_0 = clipSide_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == 0)\n {\n\n o_0.position_0 = vec4(2.0, 2.0, 0.0, 1.0);\n o_0.color_0 = vec4(0.0);\n o_0.barInkPx_0 = vec2(0.0);\n VsOut_0 _S37 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S37.color_0;\n\n v_barInkPx = _S37.barInkPx_0;\n\n return;\n }\n\n float stripTop_0;\n\n if(side_0 > 0)\n {\n\n stripTop_0 = bandTop_0;\n\n }\n else\n {\n\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0;\n\n }\n float stripBot_0 = stripTop_0 + 2.0;\n float sy_0 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = vec4(unpackRGBA_0(4280821958U).xyz, 1.0);\n o_0.barInkPx_0 = vec2(sy_0 - stripTop_0, sy_0 - stripBot_0);\n VsOut_0 _S38 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S38.color_0;\n\n v_barInkPx = _S38.barInkPx_0;\n\n return;\n }\n\n float valueY_0 = bandTop_0 + valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n float originY_0 = bandTop_0 + u_0.originYPx_0;\n float _S39 = min(valueY_0, originY_0);\n float _S40 = max(valueY_0, originY_0);\n float vy_0 = mix(_S40 + padPx_0, _S39 - padPx_0, q_0.y);\n\n o_0.position_0 = vec4(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = _S34.color_1;\n o_0.barInkPx_0 = vec2(vy_0 - _S39, vy_0 - _S40);\n VsOut_0 _S41 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S41.color_0;\n\n v_barInkPx = _S41.barInkPx_0;\n\n return;\n}\n\n"
|
|
5
5
|
|
|
6
6
|
export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n float valueSymlogConstant_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float rampMidNorm_0;\n int colorCutCount_0;\n vec4 colorCuts_0[2];\n vec4 colorBands_0[9];\n float originYPx_0;\n float rowHeight_0;\n float rowBandPx_0;\n float rowOffsetPx_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n int rowTableKeys_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
|
|
2
2
|
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
3
|
|
|
4
|
-
export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) valueSymlogConstant_0 : f32,\n @align(16) rampMode_0 : i32,\n @align(4) rampMin_0 : f32,\n @align(8) rampMax_0 : f32,\n @align(4) rampMidNorm_0 : f32,\n @align(16) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n @align(16) originYPx_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(8) rowBandPx_0 : f32,\n @align(4) rowOffsetPx_0 : f32,\n @align(16) zero_0 : f32,\n @align(4) minCellDenomPx_0 : f32,\n @align(8) minWidthPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n @align(16) rowTableKeys_0 : i32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_2 : f32, domainMax_2 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : vec4<f32>;\n if((_S13.w) > 0.0f)\n {\n _S14 = _S13;\n }\n else\n {\n _S14 = own_0;\n }\n p_0.color_0 = _S14;\n return p_0;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S15 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S15 = - minWidth_0;\n }\n else\n {\n _S15 = minWidth_0;\n }\n _S15 = x1_0 + _S15;\n }\n else\n {\n _S15 = x2_0;\n }\n return _S15;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S16 : bool = v_0 == u32(0);\n var _S17 : bool;\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(2);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(3);\n }\n var _S18 : f32;\n if(_S17)\n {\n _S18 = 0.0f;\n }\n else\n {\n _S18 = 1.0f;\n }\n if(_S16)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(1);\n }\n if(_S17)\n {\n _S17 = true;\n }\n else\n {\n _S17 = v_0 == u32(4);\n }\n var _S19 : f32;\n if(_S17)\n {\n _S19 = 0.0f;\n }\n else\n {\n _S19 = 1.0f;\n }\n return vec2<f32>(_S18, _S19);\n}\n\nfn rowBandTopPx_0( rowOffsetPx_1 : f32, rowHeight_1 : f32, slot_1 : u32) -> f32\n{\n return rowOffsetPx_1 + rowHeight_1 * f32(slot_1);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn clipSide_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, scaleType_2 : i32) -> i32\n{\n var tolerance_0 : f32 = (domainMax_3 - domainMin_3) * 0.00000999999974738f;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n return i32(1);\n }\n var _S20 : bool;\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n _S20 = scaleType_2 != i32(1);\n }\n else\n {\n _S20 = false;\n }\n if(_S20)\n {\n return i32(-1);\n }\n return i32(0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn valueToYPxScaled_0( value_3 : f32, domainMin_4 : f32, domainMax_4 : f32, h_1 : f32, scaleType_3 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_1;\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_1 : f32,\n @location(3) color_2 : u32,\n @location(4) row_0 : u32,\n};\n\nfn markScaleColor_0( _S21 : texture_2d<f32>, _S22 : sampler, _S23 : u32, _S24 : i32, _S25 : f32, _S26 : f32, _S27 : f32, _S28 : i32, _S29 : vec4<f32>, _S30 : vec4<f32>) -> vec4<f32>\n{\n if(_S24 == i32(0))\n {\n return unpackRGBA_0(_S23);\n }\n if(_S23 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_4 : i32;\n if(((_S23 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S23 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S23 & (u32(2147483648)))) != u32(0);\n if(_S24 == i32(3))\n {\n if(negative_0)\n {\n scaleType_4 = i32(0);\n }\n else\n {\n scaleType_4 = _S28;\n }\n return u_0.colorBands_0[scaleType_4];\n }\n var _S31 : f32;\n if(negative_0)\n {\n _S31 = 0.0f;\n }\n else\n {\n _S31 = 1.0f;\n }\n return rampColor_0(_S21, _S22, rampMidT_0(_S31, _S27));\n }\n var value_4 : f32 = (bitcast<f32>((_S23)));\n if(_S24 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_4, _S28, _S29, _S30)];\n }\n if(_S24 == i32(2))\n {\n scaleType_4 = i32(1);\n }\n else\n {\n scaleType_4 = i32(0);\n }\n return rampColor_0(_S21, _S22, rampMidT_0(normalizeScore_0(value_4, _S25, _S26, scaleType_4, 1.0f), _S27));\n}\n\nfn bpToClipX_0( _S32 : u32) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(_S32), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n@vertex\nfn vs_main( _S33 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var o_0 : VsOut_0;\n var _S34 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S33.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S33.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n if(_S34.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n o_0.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var _S35 : f32 = bpToClipX_0(_S33.x_2);\n var sx2_0 : f32 = extendToMinWidthX_0(_S35, bpToClipX_0(_S33.x2_2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var bandTop_0 : f32 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S34.slot_0);\n var padPx_0 : f32 = barAaPx_0();\n if(vid_1 >= u32(6))\n {\n var side_0 : i32 = clipSide_0(_S33.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == i32(0))\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n o_0.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var stripTop_0 : f32;\n if(side_0 > i32(0))\n {\n stripTop_0 = bandTop_0;\n }\n else\n {\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0f;\n }\n var stripBot_0 : f32 = stripTop_0 + 2.0f;\n var sy_0 : f32 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(unpackRGBA_0(u32(4280821958)).xyz, 1.0f);\n o_0.barInkPx_0 = vec2<f32>(sy_0 - stripTop_0, sy_0 - stripBot_0);\n return o_0;\n }\n var valueY_0 : f32 = bandTop_0 + valueToYPxScaled_0(_S33.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n var originY_0 : f32 = bandTop_0 + u_0.originYPx_0;\n var _S36 : f32 = min(valueY_0, originY_0);\n var _S37 : f32 = max(valueY_0, originY_0);\n var vy_0 : f32 = mix(_S37 + padPx_0, _S36 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S35, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = _S34.color_0;\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S36, vy_0 - _S37);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S38 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S38.barInkPx_1.x, aaPx_1) - aaRamp_0(_S38.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S39 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S38.color_3.xyz, _S38.color_3.w * alpha_0) );\n return _S39;\n}\n\n"
|
|
4
|
+
export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) valueSymlogConstant_0 : f32,\n @align(16) rampMode_0 : i32,\n @align(4) rampMin_0 : f32,\n @align(8) rampMax_0 : f32,\n @align(4) rampMidNorm_0 : f32,\n @align(16) colorCutCount_0 : i32,\n @align(16) colorCuts_0 : array<vec4<f32>, i32(2)>,\n @align(16) colorBands_0 : array<vec4<f32>, i32(9)>,\n @align(16) originYPx_0 : f32,\n @align(4) rowHeight_0 : f32,\n @align(8) rowBandPx_0 : f32,\n @align(4) rowOffsetPx_0 : f32,\n @align(16) zero_0 : f32,\n @align(4) minCellDenomPx_0 : f32,\n @align(8) minWidthPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n @align(16) rowTableKeys_0 : i32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\n@binding(4) @group(0) var rowTable_texture_0 : texture_2d<f32>;\n\n@binding(5) @group(0) var rowTable_sampler_0 : sampler;\n\nfn unpackRGBA_0( c_0 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_0 >> (u32(0)))) & (u32(255)))), f32((((c_0 >> (u32(8)))) & (u32(255)))), f32((((c_0 >> (u32(16)))) & (u32(255)))), f32((((c_0 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampMidT_0( t_0 : f32, mid_0 : f32) -> f32\n{\n var _S1 : f32 = max(mid_0, 1.0f - mid_0);\n return clamp((t_0 + (_S1 - mid_0)) / (2.0f * _S1), 0.0f, 1.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_1 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_1, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn colorCutAt_0( i_0 : i32, cutsLo_0 : vec4<f32>, cutsHi_0 : vec4<f32>) -> f32\n{\n var _S2 : f32;\n if(i_0 < i32(4))\n {\n _S2 = cutsLo_0[i_0];\n }\n else\n {\n _S2 = cutsHi_0[i_0 - i32(4)];\n }\n return _S2;\n}\n\nfn thresholdBand_0( value_0 : f32, cutCount_0 : i32, cutsLo_1 : vec4<f32>, cutsHi_1 : vec4<f32>) -> i32\n{\n var band_0 : i32 = i32(0);\n var i_1 : i32 = i32(0);\n for(;;)\n {\n if(i_1 < cutCount_0)\n {\n }\n else\n {\n break;\n }\n if(value_0 >= (colorCutAt_0(i_1, cutsLo_1, cutsHi_1)))\n {\n band_0 = i_1 + i32(1);\n }\n i_1 = i_1 + i32(1);\n }\n return band_0;\n}\n\nfn log1pf_0( x_0 : f32) -> f32\n{\n var u_1 : f32 = 1.0f + x_0;\n var _S3 : f32;\n if(u_1 == 1.0f)\n {\n _S3 = x_0;\n }\n else\n {\n _S3 = log(u_1) * (x_0 / (u_1 - 1.0f));\n }\n return _S3;\n}\n\nfn symlogTransform_0( x_1 : f32, c_1 : f32) -> f32\n{\n return f32((i32(sign((x_1))))) * log1pf_0(abs(x_1 / c_1));\n}\n\nfn normalizeScoreUnclamped_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n var tMax_0 : f32;\n var tMin_0 : f32;\n var t_2 : f32;\n if(scaleType_0 == i32(2))\n {\n var _S4 : f32 = symlogTransform_0(score_0, symlogConstant_0);\n var _S5 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n tMax_0 = symlogTransform_0(domainMax_1, symlogConstant_0);\n tMin_0 = _S5;\n t_2 = _S4;\n }\n else\n {\n if(scaleType_0 == i32(1))\n {\n if(domainMin_1 > 0.0f)\n {\n tMax_0 = domainMin_1;\n }\n else\n {\n tMax_0 = 1.0f;\n }\n var _S6 : f32 = log2(max(score_0, tMax_0));\n var _S7 : f32 = log2(tMax_0);\n tMax_0 = log2(max(domainMax_1, tMax_0));\n tMin_0 = _S7;\n t_2 = _S6;\n }\n else\n {\n tMax_0 = domainMax_1;\n tMin_0 = domainMin_1;\n t_2 = score_0;\n }\n }\n var tRange_0 : f32 = tMax_0 - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n if(t_2 > tMin_0)\n {\n tMax_0 = 1.0f;\n }\n else\n {\n tMax_0 = 0.0f;\n }\n return tMax_0;\n }\n return (t_2 - tMin_0) / tRange_0;\n}\n\nfn normalizeScore_0( score_1 : f32, domainMin_2 : f32, domainMax_2 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return clamp(normalizeScoreUnclamped_0(score_1, domainMin_2, domainMax_2, scaleType_1, symlogConstant_1), 0.0f, 1.0f);\n}\n\nfn rowTableWidth_0( keys_0 : u32) -> u32\n{\n return max(min(keys_0, u32(2048)), u32(1));\n}\n\nfn rowTablePlaneHeight_0( keys_1 : u32) -> u32\n{\n var w_0 : u32 = rowTableWidth_0(keys_1);\n var _S8 : u32 = (keys_1 + w_0 - u32(1)) / w_0;\n return max(_S8, u32(1));\n}\n\nfn rowTableTexelX_0( key_0 : u32, keys_2 : u32) -> u32\n{\n var _S9 : u32 = key_0 % rowTableWidth_0(keys_2);\n return _S9;\n}\n\nfn rowTableTexelY_0( key_1 : u32, keys_3 : u32) -> u32\n{\n var _S10 : u32 = key_1 / rowTableWidth_0(keys_3);\n return _S10;\n}\n\nfn byteOf_0( channel_0 : f32) -> u32\n{\n return u32(channel_0 * 255.0f + 0.5f);\n}\n\nstruct RowPlacement_0\n{\n hidden_0 : bool,\n slot_0 : u32,\n color_0 : vec4<f32>,\n overridden_0 : bool,\n};\n\nfn rowTableLookup_0( table_texture_0 : texture_2d<f32>, table_sampler_0 : sampler, key_2 : u32, keys_4 : i32, own_0 : vec4<f32>) -> RowPlacement_0\n{\n var p_0 : RowPlacement_0;\n p_0.hidden_0 = false;\n p_0.slot_0 = key_2;\n p_0.color_0 = own_0;\n p_0.overridden_0 = false;\n if(keys_4 < i32(0))\n {\n return p_0;\n }\n var n_0 : u32 = u32(keys_4);\n if(key_2 >= n_0)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n var h_0 : u32 = rowTablePlaneHeight_0(n_0);\n var _S11 : u32 = rowTableTexelX_0(key_2, n_0);\n var u_2 : f32 = (f32(_S11) + 0.5f) / f32(rowTableWidth_0(n_0));\n var rows_0 : f32 = f32(u32(2) * h_0);\n var y_0 : u32 = rowTableTexelY_0(key_2, n_0);\n var _S12 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0) + 0.5f) / rows_0)), (0.0f)));\n if((_S12.w) < 0.5f)\n {\n p_0.hidden_0 = true;\n return p_0;\n }\n p_0.slot_0 = ((((byteOf_0(_S12.x)) | ((((byteOf_0(_S12.y)) << (u32(8))))))) | ((((byteOf_0(_S12.z)) << (u32(16))))));\n var _S13 : vec4<f32> = (textureSampleLevel((table_texture_0), (table_sampler_0), (vec2<f32>(u_2, (f32(y_0 + h_0) + 0.5f) / rows_0)), (0.0f)));\n var _S14 : bool = (_S13.w) > 0.0f;\n p_0.overridden_0 = _S14;\n var _S15 : vec4<f32>;\n if(_S14)\n {\n _S15 = _S13;\n }\n else\n {\n _S15 = own_0;\n }\n p_0.color_0 = _S15;\n return p_0;\n}\n\nfn hpSplitUint_0( value_1 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_1 & (u32(4095)));\n return vec2<f32>(f32(value_1 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var floorBp_0 : f32 = -3.00000000549775576e+38f + hpZero_0;\n var step_0 : f32 = 2.0f / bpRange_0.z;\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, floorBp_0), max(splitPos_0.y - bpRange_0.y, floorBp_0)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn pxToClipLen_0( px_0 : f32, size_0 : f32) -> f32\n{\n return px_0 * 2.0f / size_0;\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S16 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S16 = - minWidth_0;\n }\n else\n {\n _S16 = minWidth_0;\n }\n _S16 = x1_0 + _S16;\n }\n else\n {\n _S16 = x2_0;\n }\n return _S16;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, pxToClipLen_0(minWidthPx_1, canvasWidth_0));\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S17 : bool = v_0 == u32(0);\n var _S18 : bool;\n if(_S17)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(2);\n }\n if(_S18)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(3);\n }\n var _S19 : f32;\n if(_S18)\n {\n _S19 = 0.0f;\n }\n else\n {\n _S19 = 1.0f;\n }\n if(_S17)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(1);\n }\n if(_S18)\n {\n _S18 = true;\n }\n else\n {\n _S18 = v_0 == u32(4);\n }\n var _S20 : f32;\n if(_S18)\n {\n _S20 = 0.0f;\n }\n else\n {\n _S20 = 1.0f;\n }\n return vec2<f32>(_S19, _S20);\n}\n\nfn rowBandTopPx_0( rowOffsetPx_1 : f32, rowHeight_1 : f32, slot_1 : u32) -> f32\n{\n return rowOffsetPx_1 + rowHeight_1 * f32(slot_1);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn clipSide_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, scaleType_2 : i32) -> i32\n{\n var tolerance_0 : f32 = (domainMax_3 - domainMin_3) * 0.00000999999974738f;\n if(value_2 > (domainMax_3 + tolerance_0))\n {\n return i32(1);\n }\n var _S21 : bool;\n if(value_2 < (domainMin_3 - tolerance_0))\n {\n _S21 = scaleType_2 != i32(1);\n }\n else\n {\n _S21 = false;\n }\n if(_S21)\n {\n return i32(-1);\n }\n return i32(0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn valueToYPxScaled_0( value_3 : f32, domainMin_4 : f32, domainMax_4 : f32, h_1 : f32, scaleType_3 : i32, symlogConstant_2 : f32) -> f32\n{\n return (1.0f - normalizeScore_0(value_3, domainMin_4, domainMax_4, scaleType_3, symlogConstant_2)) * h_1;\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_1 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_2 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_1 : f32,\n @location(3) color_2 : u32,\n @location(4) row_0 : u32,\n};\n\nfn markScaleColor_0( _S22 : texture_2d<f32>, _S23 : sampler, _S24 : u32, _S25 : i32, _S26 : f32, _S27 : f32, _S28 : f32, _S29 : i32, _S30 : vec4<f32>, _S31 : vec4<f32>) -> vec4<f32>\n{\n if(_S25 == i32(0))\n {\n return unpackRGBA_0(_S24);\n }\n if(_S24 == u32(2143289345))\n {\n return unpackRGBA_0(u32(4289703855));\n }\n var scaleType_4 : i32;\n if(((_S24 & (u32(2139095040)))) == u32(2139095040))\n {\n if(((_S24 & (u32(8388607)))) != u32(0))\n {\n return unpackRGBA_0(u32(4286611584));\n }\n var negative_0 : bool = ((_S24 & (u32(2147483648)))) != u32(0);\n if(_S25 == i32(3))\n {\n if(negative_0)\n {\n scaleType_4 = i32(0);\n }\n else\n {\n scaleType_4 = _S29;\n }\n return u_0.colorBands_0[scaleType_4];\n }\n var _S32 : f32;\n if(negative_0)\n {\n _S32 = 0.0f;\n }\n else\n {\n _S32 = 1.0f;\n }\n return rampColor_0(_S22, _S23, rampMidT_0(_S32, _S28));\n }\n var value_4 : f32 = (bitcast<f32>((_S24)));\n if(_S25 == i32(3))\n {\n return u_0.colorBands_0[thresholdBand_0(value_4, _S29, _S30, _S31)];\n }\n if(_S25 == i32(2))\n {\n scaleType_4 = i32(1);\n }\n else\n {\n scaleType_4 = i32(0);\n }\n return rampColor_0(_S22, _S23, rampMidT_0(normalizeScore_0(value_4, _S26, _S27, scaleType_4, 1.0f), _S28));\n}\n\nfn bpToClipX_0( _S33 : u32) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(_S33), u_0.bpRangeX_0, u_0.zero_0);\n}\n\n@vertex\nfn vs_main( _S34 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var o_0 : VsOut_0;\n var _S35 : RowPlacement_0 = rowTableLookup_0(rowTable_texture_0, rowTable_sampler_0, _S34.row_0, u_0.rowTableKeys_0, markScaleColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S34.color_2, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.rampMidNorm_0, u_0.colorCutCount_0, u_0.colorCuts_0[i32(0)], u_0.colorCuts_0[i32(1)]));\n if(_S35.hidden_0)\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n o_0.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var _S36 : f32 = bpToClipX_0(_S34.x_2);\n var sx2_0 : f32 = extendToMinWidthX_0(_S36, bpToClipX_0(_S34.x2_2), u_0.minWidthPx_0, u_0.minCellDenomPx_0);\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var bandTop_0 : f32 = rowBandTopPx_0(u_0.rowOffsetPx_0, u_0.rowHeight_0, _S35.slot_0);\n var padPx_0 : f32 = barAaPx_0();\n if(vid_1 >= u32(6))\n {\n var side_0 : i32 = clipSide_0(_S34.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0);\n if(side_0 == i32(0))\n {\n o_0.position_0 = vec4<f32>(2.0f, 2.0f, 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(0.0f);\n o_0.barInkPx_0 = vec2<f32>(0.0f);\n return o_0;\n }\n var stripTop_0 : f32;\n if(side_0 > i32(0))\n {\n stripTop_0 = bandTop_0;\n }\n else\n {\n stripTop_0 = bandTop_0 + u_0.rowBandPx_0 - 2.0f;\n }\n var stripBot_0 : f32 = stripTop_0 + 2.0f;\n var sy_0 : f32 = mix(stripBot_0 + padPx_0, stripTop_0 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(sy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = vec4<f32>(unpackRGBA_0(u32(4280821958)).xyz, 1.0f);\n o_0.barInkPx_0 = vec2<f32>(sy_0 - stripTop_0, sy_0 - stripBot_0);\n return o_0;\n }\n var valueY_0 : f32 = bandTop_0 + valueToYPxScaled_0(_S34.y_1, u_0.domainMin_0, u_0.domainMax_0, u_0.rowBandPx_0, u_0.valueScaleType_0, u_0.valueSymlogConstant_0);\n var originY_0 : f32 = bandTop_0 + u_0.originYPx_0;\n var _S37 : f32 = min(valueY_0, originY_0);\n var _S38 : f32 = max(valueY_0, originY_0);\n var vy_0 : f32 = mix(_S38 + padPx_0, _S37 - padPx_0, q_0.y);\n o_0.position_0 = vec4<f32>(mix(_S36, sx2_0, q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_1 = _S35.color_0;\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S37, vy_0 - _S38);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_3 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S39 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S39.barInkPx_1.x, aaPx_1) - aaRamp_0(_S39.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S40 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S39.color_3.xyz, _S39.color_3.w * alpha_0) );\n return _S40;\n}\n\n"
|
|
@@ -4,15 +4,27 @@
|
|
|
4
4
|
// Scalar twins of curveDistance.slang, transliterated from slangc's WGSL so
|
|
5
5
|
// the Canvas2D and SVG paths run the shader's own math. See adr-051.
|
|
6
6
|
|
|
7
|
+
function _clamp(x: number, lo: number, hi: number) {
|
|
8
|
+
return _min(_max(x, lo), hi)
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
function _max(a: number, b: number) {
|
|
8
12
|
return b > a || Number.isNaN(a) ? b : a
|
|
9
13
|
}
|
|
10
14
|
|
|
15
|
+
function _min(a: number, b: number) {
|
|
16
|
+
return b < a || Number.isNaN(a) ? b : a
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
export function distToWideCirclePx(x: number, y: number, r: number): number {
|
|
12
20
|
let rk = ((2.0 * x) + (((x * x) + (y * y)) / r))
|
|
13
21
|
return Math.abs((rk / (Math.sqrt(_max((1.0 + (rk / r)), 0.0)) + 1.0)))
|
|
14
22
|
}
|
|
15
23
|
|
|
24
|
+
export function legSweepAngle(radiusPx: number, yReachPx: number): number {
|
|
25
|
+
return Math.asin(_clamp((yReachPx / _max(radiusPx, 9.99999997475242708e-07)), 0.0, 1.0))
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
export function wideCircleLeg(seg: number, segments: number, legSweep: number): [number, number] {
|
|
17
29
|
let half = Math.trunc(segments / 2)
|
|
18
30
|
if ((seg <= half)) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// The fragment ramps its alpha to zero at `halfWidth + aaHalfPx`, so the hull
|
|
8
8
|
// has to cover everything nearer the curve than that. Both flanks of a hull
|
|
9
9
|
// sampled from the offset curve fall short of it at a clamped dome's feet.
|
|
10
|
-
//! js-export: distToWideCirclePx, wideCircleLeg, wideCircleLegStep, ellipseHullPoint, wideCircleHullPoint
|
|
10
|
+
//! js-export: distToWideCirclePx, legSweepAngle, wideCircleLeg, wideCircleLegStep, ellipseHullPoint, wideCircleHullPoint
|
|
11
11
|
//! js-skip: nearCircleDistancePx — a float32 remedy with no float64 caller. The hit tests' copy of this file's solve (marks/ellipseDistance.ts) holds the ellipse at every aspect, so nothing outside the shader has an approximation to want.
|
|
12
12
|
//! oracle-skip: ellipseHullPoint — a miter between near-parallel tangent lines, so float32 and float64 part on the probe's arbitrary directions and radii; over the angles the hull steps through they agree to 0.004 px, and arcHull.test.ts referees the twin against every inked point instead
|
|
13
13
|
//! oracle-skip: wideCircleHullPoint — the foot-relative frame cancels at half steps and angles the band never reaches; arcHull.test.ts referees it with the legs
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/shader-tools/src/shader-codegen from insertionGlyph.slang.
|
|
2
|
+
// Do not edit. Run `pnpm gen:shaders` to regenerate.
|
|
3
|
+
|
|
4
|
+
export const LONG_INSERTION_MIN_LENGTH = 10
|
|
5
|
+
|
|
6
|
+
export const LONG_INSERTION_TEXT_THRESHOLD_PX = 15
|
|
7
|
+
|
|
8
|
+
export const MIN_HEIGHT_FOR_TEXT = 5
|
|
9
|
+
|
|
10
|
+
export const INSERTION_SERIF_MIN_PX_PER_BP = 3
|
|
11
|
+
|
|
12
|
+
export const SERIF_HALF_W_PX = 2
|
|
13
|
+
|
|
14
|
+
export const SERIF_H_PX = 2
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The insertion glyph's geometry: the marker's width, its serif caps, and
|
|
2
|
+
// whether it outgrows the reference span it stands on. The pileup's insertion
|
|
3
|
+
// pass and alignments-core's `insertion` mark both import it, and the Canvas2D,
|
|
4
|
+
// SVG and hit-test paths run its generated twins (adr-051).
|
|
5
|
+
//
|
|
6
|
+
// A marker is a 1px tick (small), a 1-5px bar (long), or a box sized for its
|
|
7
|
+
// count label (large: long, zoomed in past LONG_INSERTION_TEXT_THRESHOLD_PX,
|
|
8
|
+
// and in a row at least MIN_HEIGHT_FOR_TEXT tall). The long bar floors at 1px
|
|
9
|
+
// so the width stays monotonic in length; a sub-pixel bar rasterizes to a
|
|
10
|
+
// fraction of a column on either backend.
|
|
11
|
+
//
|
|
12
|
+
// Serif caps are wedges SERIF_HALF_W_PX either side of the bar, tapering
|
|
13
|
+
// SERIF_H_PX into the row, on small insertions zoomed in past
|
|
14
|
+
// INSERTION_SERIF_MIN_PX_PER_BP.
|
|
15
|
+
//! export-consts: LONG_INSERTION_MIN_LENGTH, LONG_INSERTION_TEXT_THRESHOLD_PX, MIN_HEIGHT_FOR_TEXT, INSERTION_SERIF_MIN_PX_PER_BP, SERIF_HALF_W_PX, SERIF_H_PX
|
|
16
|
+
//! consts-out: packages/alignments-core/src/insertionLabel.generated.ts
|
|
17
|
+
//! js-export: insertionBarWidthPx, textWidth, insertionSerifsDraw, insertionMarkerDraws
|
|
18
|
+
//! js-export-out: packages/alignments-core/src/insertionWidth.generated.ts
|
|
19
|
+
module insertionGlyph;
|
|
20
|
+
|
|
21
|
+
public static const uint LONG_INSERTION_MIN_LENGTH = 10u;
|
|
22
|
+
public static const float LONG_INSERTION_TEXT_THRESHOLD_PX = 15.0;
|
|
23
|
+
public static const float INSERTION_SERIF_MIN_PX_PER_BP = 3.0;
|
|
24
|
+
public static const float MIN_HEIGHT_FOR_TEXT = 5.0;
|
|
25
|
+
public static const float SERIF_HALF_W_PX = 2.0;
|
|
26
|
+
public static const float SERIF_H_PX = 2.0;
|
|
27
|
+
|
|
28
|
+
static const float LABEL_CHAR_W = 6.0;
|
|
29
|
+
static const float LABEL_PAD = 10.0;
|
|
30
|
+
|
|
31
|
+
public float textWidth(uint num) {
|
|
32
|
+
if (num < 10u) { return LABEL_CHAR_W + LABEL_PAD; }
|
|
33
|
+
if (num < 100u) { return LABEL_CHAR_W * 2.0 + LABEL_PAD; }
|
|
34
|
+
if (num < 1000u) { return LABEL_CHAR_W * 3.0 + LABEL_PAD; }
|
|
35
|
+
if (num < 10000u) { return LABEL_CHAR_W * 4.0 + LABEL_PAD; }
|
|
36
|
+
return LABEL_CHAR_W * 5.0 + LABEL_PAD;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public float insertionBarWidthPx(uint length, float pxPerBp, float featHeight) {
|
|
40
|
+
float insWPx = float(length) * pxPerBp;
|
|
41
|
+
bool isLong = length >= LONG_INSERTION_MIN_LENGTH;
|
|
42
|
+
bool isLarge = isLong
|
|
43
|
+
&& insWPx >= LONG_INSERTION_TEXT_THRESHOLD_PX
|
|
44
|
+
&& featHeight >= MIN_HEIGHT_FOR_TEXT;
|
|
45
|
+
if (isLarge) { return textWidth(length); }
|
|
46
|
+
if (isLong) { return clamp(insWPx / 3.0, 1.0, 5.0); }
|
|
47
|
+
return 1.0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public bool insertionSerifsDraw(uint length, float pxPerBp) {
|
|
51
|
+
return length < LONG_INSERTION_MIN_LENGTH && pxPerBp >= INSERTION_SERIF_MIN_PX_PER_BP;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// A marker standing on a reference span draws only where it is wider than
|
|
55
|
+
// that span, floored at `spanFloorPx`, the narrowest the span itself paints.
|
|
56
|
+
// An interbase insertion has no span and always draws.
|
|
57
|
+
public bool insertionMarkerDraws(float barWidthPx, float spanPx, float spanFloorPx) {
|
|
58
|
+
return barWidthPx > max(spanFloorPx, abs(spanPx));
|
|
59
|
+
}
|