@jbrowse/render-core 5.0.0-beta.2 → 5.0.0-beta.3

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.
Files changed (110) hide show
  1. package/esm/RenderLifecycleMixin.d.ts +20 -1
  2. package/esm/RenderLifecycleMixin.js +25 -2
  3. package/esm/canvas2dUtils.d.ts +25 -0
  4. package/esm/canvas2dUtils.js +27 -0
  5. package/esm/colorRampLut.d.ts +4 -4
  6. package/esm/colorRampLut.js +4 -4
  7. package/esm/computePipeline.d.ts +13 -0
  8. package/esm/computePipeline.js +55 -0
  9. package/esm/coverageBand.d.ts +0 -1
  10. package/esm/coverageBand.js +0 -1
  11. package/esm/coverageBandBuffers.d.ts +0 -6
  12. package/esm/coverageBandBuffers.js +1 -13
  13. package/esm/createRenderingBackend.d.ts +14 -18
  14. package/esm/createRenderingBackend.js +4 -2
  15. package/esm/encodeMemo.d.ts +14 -0
  16. package/esm/encodeMemo.js +48 -0
  17. package/esm/gpuDevice.d.ts +9 -0
  18. package/esm/gpuDevice.js +12 -3
  19. package/esm/graphicsCapabilities.d.ts +18 -15
  20. package/esm/graphicsCapabilities.js +23 -16
  21. package/esm/hal/createHal.d.ts +1 -2
  22. package/esm/hal/createHal.js +14 -4
  23. package/esm/hal/deviceGpuCache.js +2 -2
  24. package/esm/hal/gpuHalBase.d.ts +1 -1
  25. package/esm/hal/gpuHalBase.js +2 -3
  26. package/esm/hal/mockHal.d.ts +0 -1
  27. package/esm/hal/mockHal.js +0 -10
  28. package/esm/hal/regionRegistry.d.ts +0 -1
  29. package/esm/hal/regionRegistry.js +3 -15
  30. package/esm/hal/types.d.ts +5 -1
  31. package/esm/hal/webgl2Hal.d.ts +1 -1
  32. package/esm/hal/webgl2Hal.js +2 -2
  33. package/esm/hal/webgpuHal.d.ts +2 -2
  34. package/esm/hal/webgpuHal.js +13 -10
  35. package/esm/installUpload.d.ts +4 -1
  36. package/esm/installUpload.js +7 -39
  37. package/esm/instanceCache.d.ts +10 -7
  38. package/esm/instanceCache.js +14 -15
  39. package/esm/mapUploadSync.d.ts +0 -8
  40. package/esm/mapUploadSync.js +0 -1
  41. package/esm/marks/colorFill.d.ts +17 -0
  42. package/esm/marks/colorFill.js +26 -0
  43. package/esm/marks/drawAgainstHit.d.ts +47 -0
  44. package/esm/marks/drawAgainstHit.js +140 -0
  45. package/esm/marks/glyphPaint.d.ts +16 -0
  46. package/esm/marks/glyphPaint.js +41 -0
  47. package/esm/marks/index.d.ts +9 -0
  48. package/esm/marks/index.js +6 -0
  49. package/esm/marks/markBackend.d.ts +87 -0
  50. package/esm/marks/markBackend.js +133 -0
  51. package/esm/marks/markPaint.d.ts +13 -0
  52. package/esm/marks/markPaint.js +18 -0
  53. package/esm/marks/pointMark.d.ts +24 -0
  54. package/esm/marks/pointMark.js +98 -0
  55. package/esm/marks/spanMark.d.ts +45 -0
  56. package/esm/marks/spanMark.js +71 -0
  57. package/esm/marks/types.d.ts +206 -0
  58. package/esm/marks/types.js +125 -0
  59. package/esm/perRegionRenderingBackend.d.ts +15 -3
  60. package/esm/perRegionRenderingBackend.js +26 -3
  61. package/esm/regionDataMap.d.ts +2 -2
  62. package/esm/regionDataMap.js +2 -2
  63. package/esm/renderingBackendBase.d.ts +11 -14
  64. package/esm/renderingBackendBase.js +7 -7
  65. package/esm/shaders/capsule.js.generated.d.ts +1 -0
  66. package/esm/shaders/capsule.js.generated.js +11 -0
  67. package/esm/shaders/coverageBar.generated.d.ts +2 -2
  68. package/esm/shaders/coverageBar.generated.js +2 -2
  69. package/esm/shaders/coverageMod.generated.d.ts +2 -2
  70. package/esm/shaders/coverageMod.generated.js +2 -2
  71. package/esm/shaders/coverageSnp.generated.d.ts +2 -2
  72. package/esm/shaders/coverageSnp.generated.js +2 -2
  73. package/esm/shaders/pointMark.consts.generated.d.ts +4 -0
  74. package/esm/shaders/pointMark.consts.generated.js +6 -0
  75. package/esm/shaders/pointMark.generated.d.ts +5 -0
  76. package/esm/shaders/pointMark.generated.js +7 -0
  77. package/esm/shaders/pointMark.iface.generated.d.ts +55 -0
  78. package/esm/shaders/pointMark.iface.generated.js +100 -0
  79. package/esm/shaders/pointMark.js.generated.d.ts +1 -0
  80. package/esm/shaders/pointMark.js.generated.js +16 -0
  81. package/esm/shaders/spanMark.generated.d.ts +4 -0
  82. package/esm/shaders/spanMark.generated.js +6 -0
  83. package/esm/shaders/spanMark.iface.generated.d.ts +58 -0
  84. package/esm/shaders/spanMark.iface.generated.js +122 -0
  85. package/esm/sharedBackendKey.d.ts +18 -0
  86. package/esm/{keyedRenderingBackend.js → sharedBackendKey.js} +5 -0
  87. package/esm/slangPass.d.ts +2 -0
  88. package/esm/slangPass.js +2 -0
  89. package/package.json +13 -4
  90. package/src/shaders/capsule.js.generated.ts +14 -0
  91. package/src/shaders/capsule.slang +12 -4
  92. package/src/shaders/colorPack.slang +5 -1
  93. package/src/shaders/coverageBand.slang +38 -15
  94. package/src/shaders/coverageBar.generated.ts +2 -2
  95. package/src/shaders/coverageBar.slang +9 -0
  96. package/src/shaders/coverageMod.generated.ts +2 -2
  97. package/src/shaders/coverageSnp.generated.ts +2 -2
  98. package/src/shaders/hpmath.slang +7 -1
  99. package/src/shaders/pointMark.consts.generated.ts +10 -0
  100. package/src/shaders/pointMark.generated.ts +12 -0
  101. package/src/shaders/pointMark.iface.generated.ts +146 -0
  102. package/src/shaders/pointMark.js.generated.ts +21 -0
  103. package/src/shaders/pointMark.slang +192 -0
  104. package/src/shaders/rowRect.slang +7 -8
  105. package/src/shaders/spanMark.generated.ts +10 -0
  106. package/src/shaders/spanMark.iface.generated.ts +168 -0
  107. package/src/shaders/spanMark.slang +22 -0
  108. package/esm/globalRenderingBackend.d.ts +0 -90
  109. package/esm/globalRenderingBackend.js +0 -53
  110. package/esm/keyedRenderingBackend.d.ts +0 -41
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from coverageSnp.slang.
2
2
  // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
- export const WGSL_SOURCE = "struct CoverageBandUniforms_std140_0\n{\n @align(16) bpHi_0 : f32,\n @align(4) bpLo_0 : f32,\n @align(8) bpLen_0 : f32,\n @align(4) hpZero_0 : f32,\n @align(16) canvasW_0 : f32,\n @align(4) canvasH_0 : f32,\n @align(8) covHeight_0 : f32,\n @align(4) covYOffset_0 : f32,\n @align(16) covTop_0 : f32,\n @align(4) regionMaxDepth_0 : f32,\n @align(8) depthDomainMax_0 : f32,\n @align(4) depthDomainMin_0 : f32,\n @align(16) coverageSymlogConstant_0 : f32,\n @align(4) binSize_0 : f32,\n @align(8) interbaseHeight_0 : f32,\n @align(4) snpMinFreq_0 : f32,\n @align(16) reversed_0 : f32,\n @align(4) coverageScaleType_0 : i32,\n @align(8) colorCoverage_0 : u32,\n @align(4) colorBaseA_0 : u32,\n @align(16) colorBaseC_0 : u32,\n @align(4) colorBaseG_0 : u32,\n @align(8) colorBaseT_0 : u32,\n @align(4) colorBaseN_0 : u32,\n @align(16) colorInsertionIndicator_0 : u32,\n @align(4) colorSoftclipIndicator_0 : u32,\n @align(8) colorHardclipIndicator_0 : u32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : CoverageBandUniforms_std140_0;\nstruct CoverageVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n};\n\nfn covDiscardVertex_0() -> CoverageVsOut_0\n{\n var o_0 : CoverageVsOut_0;\n var _S1 : vec4<f32> = vec4<f32>(0.0f);\n o_0.position_0 = _S1;\n o_0.color_0 = _S1;\n return o_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S2 : bool = v_0 == u32(0);\n var _S3 : bool;\n if(_S2)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(2);\n }\n if(_S3)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(3);\n }\n var _S4 : f32;\n if(_S3)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n if(_S2)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(1);\n }\n if(_S3)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(4);\n }\n var _S5 : f32;\n if(_S3)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n return vec2<f32>(_S4, _S5);\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_1 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S6 : f32 = - (1.0f / hpZero_1);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S6), max(splitPos_0.y - bpRange_0.y, _S6)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn covBpToClipX_0( bp_0 : u32, u_1 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3<f32>((*u_1).bpHi_0, (*u_1).bpLo_0, (*u_1).bpLen_0), (*u_1).hpZero_0);\n}\n\nfn expandToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> vec2<f32>\n{\n if((x2_0 - x1_0) < minWidth_0)\n {\n var mid_0 : f32 = (x1_0 + x2_0) * 0.5f;\n var _S7 : f32 = minWidth_0 * 0.5f;\n return vec2<f32>(mid_0 - _S7, mid_0 + _S7);\n }\n return vec2<f32>(x1_0, x2_0);\n}\n\nfn expandToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> vec2<f32>\n{\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0f / canvasWidth_0);\n}\n\nfn covExpandMinWidthX_0( x1_2 : f32, x2_2 : f32, canvasWidth_1 : f32) -> vec2<f32>\n{\n return expandToMinWidthX_0(x1_2, x2_2, 1.0f, canvasWidth_1);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_0 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_0 * 2.0f;\n}\n\nfn covAreaTop_0( u_2 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return yPxToClipY_0((*u_2).covTop_0, (*u_2).canvasH_0);\n}\n\nfn covBottomOffsetPx_0( covHeight_1 : f32, covYOffset_1 : f32) -> f32\n{\n return covHeight_1 - covYOffset_1;\n}\n\nfn covBottom_0( u_3 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n var _S8 : f32 = covAreaTop_0(&((*u_3)));\n return _S8 - covBottomOffsetPx_0((*u_3).covHeight_0, (*u_3).covYOffset_0) / (*u_3).canvasH_0 * 2.0f;\n}\n\nfn symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_0 > 0.0f)\n {\n floorV_0 = domainMin_0;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_0) / range_0, 0.0f, 1.0f);\n}\n\nfn normalizeDepthScalar_0( rawDepth_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\nfn covNormalizeDepth_0( relDepth_0 : f32, u_4 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return normalizeDepthScalar_0(relDepth_0 * (*u_4).regionMaxDepth_0, (*u_4).depthDomainMin_0, (*u_4).depthDomainMax_0, (*u_4).coverageScaleType_0, (*u_4).coverageSymlogConstant_0);\n}\n\nfn covEffectiveHeightPx_0( covHeight_2 : f32, covYOffset_2 : f32) -> f32\n{\n return max(covHeight_2 - 2.0f * covYOffset_2, 0.0f);\n}\n\nfn covEffHeight_0( u_5 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return covEffectiveHeightPx_0((*u_5).covHeight_0, (*u_5).covYOffset_0);\n}\n\nfn covBarScale_0( relDepth_1 : f32, u_6 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n var _S9 : f32 = covNormalizeDepth_0(relDepth_1, &((*u_6)));\n var _S10 : f32 = covEffHeight_0(&((*u_6)));\n return _S9 * _S10 / (*u_6).canvasH_0 * 2.0f;\n}\n\nfn covFlipX_0( x_1 : f32, u_7 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return mix(x_1, - x_1, (*u_7).reversed_0);\n}\n\nfn covFlippedQuad_0( x0_0 : f32, x1_3 : f32, yBot_0 : f32, yTop_0 : f32, local_0 : vec2<f32>, u_8 : ptr<function, CoverageBandUniforms_std140_0>) -> vec4<f32>\n{\n var _S11 : f32 = covFlipX_0(mix(x0_0, x1_3, local_0.x), &((*u_8)));\n return vec4<f32>(_S11, mix(yBot_0, yTop_0, local_0.y), 0.0f, 1.0f);\n}\n\nfn covSegQuad_0( position_1 : u32, widthBp_0 : u32, yOffset_0 : f32, segHeight_0 : f32, relDepth_2 : f32, local_1 : vec2<f32>, u_9 : ptr<function, CoverageBandUniforms_std140_0>) -> vec4<f32>\n{\n var _S12 : f32 = covBpToClipX_0(position_1, &((*u_9)));\n var _S13 : f32 = covBpToClipX_0(position_1 + widthBp_0, &((*u_9)));\n var xx_0 : vec2<f32> = covExpandMinWidthX_0(_S12, _S13, (*u_9).canvasW_0);\n var _S14 : f32 = covBottom_0(&((*u_9)));\n var _S15 : f32 = covBarScale_0(relDepth_2, &((*u_9)));\n var segBot_0 : f32 = _S14 + yOffset_0 * _S15;\n var _S16 : vec4<f32> = covFlippedQuad_0(xx_0.x, xx_0.y, segBot_0, segBot_0 + segHeight_0 * _S15, local_1, &((*u_9)));\n return _S16;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn covSnpColor_0( ct_0 : f32, u_10 : ptr<function, CoverageBandUniforms_std140_0>) -> vec3<f32>\n{\n switch(i32(ct_0))\n {\n case i32(1):\n {\n return unpackRGBA_0((*u_10).colorBaseA_0).xyz;\n }\n case i32(2):\n {\n return unpackRGBA_0((*u_10).colorBaseC_0).xyz;\n }\n case i32(3):\n {\n return unpackRGBA_0((*u_10).colorBaseG_0).xyz;\n }\n case i32(4):\n {\n return unpackRGBA_0((*u_10).colorBaseT_0).xyz;\n }\n default :\n {\n return unpackRGBA_0((*u_10).colorBaseN_0).xyz;\n }\n }\n}\n\nstruct vertexInput_0\n{\n @location(0) position_2 : u32,\n @location(1) yOffset_1 : f32,\n @location(2) segHeight_1 : f32,\n @location(3) colorType_0 : f32,\n @location(4) relDepth_3 : f32,\n};\n\n@vertex\nfn vs_main( _S17 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> CoverageVsOut_0\n{\n if((_S17.segHeight_1) < (u_0.snpMinFreq_0))\n {\n return covDiscardVertex_0();\n }\n var o_1 : CoverageVsOut_0;\n var _S18 : vec2<f32> = quadLocal_0(vid_1);\n var _S19 : CoverageBandUniforms_std140_0 = u_0;\n var _S20 : vec4<f32> = covSegQuad_0(_S17.position_2, u32(1), _S17.yOffset_1, _S17.segHeight_1, _S17.relDepth_3, _S18, &(_S19));\n o_1.position_0 = _S20;\n var _S21 : vec3<f32> = covSnpColor_0(_S17.colorType_0, &(_S19));\n o_1.color_0 = vec4<f32>(_S21, 1.0f);\n return o_1;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_1 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S22 : pixelInput_0, @builtin(position) position_3 : vec4<f32>) -> pixelOutput_0\n{\n var _S23 : pixelOutput_0 = pixelOutput_0( _S22.color_1 );\n return _S23;\n}\n\n";
4
- export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct CoverageBandUniforms_0\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n}u_0;\n\nstruct CoverageVsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n};\n\n\n\nCoverageVsOut_0 covDiscardVertex_0()\n{\n\n CoverageVsOut_0 o_0;\n const vec4 _S1 = vec4(0.0);\n\n o_0.position_0 = _S1;\n o_0.color_0 = _S1;\n return o_0;\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S2 = v_0 == 0U;\n\n bool _S3;\n\n if(_S2)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 2U;\n\n }\n\n if(_S3)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 3U;\n\n }\n\n float _S4;\n\n if(_S3)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n if(_S2)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 1U;\n\n }\n\n if(_S3)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 4U;\n\n }\n\n float _S5;\n\n if(_S3)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n\n return vec2(_S4, _S5);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_1)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S6 = - (1.0 / hpZero_1);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S6), max(splitPos_0.y - bpRange_0.y, _S6)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat covBpToClipX_0(uint bp_0, CoverageBandUniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3(u_1.bpHi_0, u_1.bpLo_0, u_1.bpLen_0), u_1.hpZero_0);\n}\n\n\nvec2 expandToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n if((x2_0 - x1_0) < minWidth_0)\n {\n\n float mid_0 = (x1_0 + x2_0) * 0.5;\n float _S7 = minWidth_0 * 0.5;\n\n return vec2(mid_0 - _S7, mid_0 + _S7);\n }\n return vec2(x1_0, x2_0);\n}\n\nvec2 expandToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 covExpandMinWidthX_0(float x1_2, float x2_2, float canvasWidth_1)\n{\n\n return expandToMinWidthX_0(x1_2, x2_2, 1.0, canvasWidth_1);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_0)\n{\n\n return 1.0 - yPx_0 / canvasHeight_0 * 2.0;\n}\n\n\nfloat covAreaTop_0(CoverageBandUniforms_0 u_2)\n{\n\n return yPxToClipY_0(u_2.covTop_0, u_2.canvasH_0);\n}\n\n\nfloat covBottomOffsetPx_0(float covHeight_1, float covYOffset_1)\n{\n\n return covHeight_1 - covYOffset_1;\n}\n\n\nfloat covBottom_0(CoverageBandUniforms_0 u_3)\n{\n\n return covAreaTop_0(u_3) - covBottomOffsetPx_0(u_3.covHeight_0, u_3.covYOffset_0) / u_3.canvasH_0 * 2.0;\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_0 > 0.0)\n {\n\n floorV_0 = domainMin_0;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_0) / range_0, 0.0, 1.0);\n}\n\n\nfloat normalizeDepthScalar_0(float rawDepth_0, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\n\nfloat covNormalizeDepth_0(float relDepth_0, CoverageBandUniforms_0 u_4)\n{\n return normalizeDepthScalar_0(relDepth_0 * u_4.regionMaxDepth_0, u_4.depthDomainMin_0, u_4.depthDomainMax_0, u_4.coverageScaleType_0, u_4.coverageSymlogConstant_0);\n}\n\n\nfloat covEffectiveHeightPx_0(float covHeight_2, float covYOffset_2)\n{\n\n return max(covHeight_2 - 2.0 * covYOffset_2, 0.0);\n}\n\n\nfloat covEffHeight_0(CoverageBandUniforms_0 u_5)\n{\n\n return covEffectiveHeightPx_0(u_5.covHeight_0, u_5.covYOffset_0);\n}\n\n\nfloat covBarScale_0(float relDepth_1, CoverageBandUniforms_0 u_6)\n{\n\n return covNormalizeDepth_0(relDepth_1, u_6) * covEffHeight_0(u_6) / u_6.canvasH_0 * 2.0;\n}\n\n\nfloat covFlipX_0(float x_1, CoverageBandUniforms_0 u_7)\n{\n\n return mix(x_1, - x_1, u_7.reversed_0);\n}\n\n\nvec4 covFlippedQuad_0(float x0_0, float x1_3, float yBot_0, float yTop_0, vec2 local_0, CoverageBandUniforms_0 u_8)\n{\n return vec4(covFlipX_0(mix(x0_0, x1_3, local_0.x), u_8), mix(yBot_0, yTop_0, local_0.y), 0.0, 1.0);\n}\n\n\nvec4 covSegQuad_0(uint position_1, uint widthBp_0, float yOffset_0, float segHeight_0, float relDepth_2, vec2 local_1, CoverageBandUniforms_0 u_9)\n{\n\n vec2 xx_0 = covExpandMinWidthX_0(covBpToClipX_0(position_1, u_9), covBpToClipX_0(position_1 + widthBp_0, u_9), u_9.canvasW_0);\n\n\n float k_0 = covBarScale_0(relDepth_2, u_9);\n float segBot_0 = covBottom_0(u_9) + yOffset_0 * k_0;\n\n return covFlippedQuad_0(xx_0.x, xx_0.y, segBot_0, segBot_0 + segHeight_0 * k_0, local_1, u_9);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nvec3 covSnpColor_0(float ct_0, CoverageBandUniforms_0 u_10)\n{\n\n switch(int(ct_0))\n {\n case 1:\n {\n\n return unpackRGBA_0(u_10.colorBaseA_0).xyz;\n }\n case 2:\n {\n\n return unpackRGBA_0(u_10.colorBaseC_0).xyz;\n }\n case 3:\n {\n\n return unpackRGBA_0(u_10.colorBaseG_0).xyz;\n }\n case 4:\n {\n\n return unpackRGBA_0(u_10.colorBaseT_0).xyz;\n }\n default:\n {\n\n return unpackRGBA_0(u_10.colorBaseN_0).xyz;\n }\n }\n\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_position;\n\n\nlayout(location = 1)\nin float a_yOffset;\n\n\nlayout(location = 2)\nin float a_segHeight;\n\n\nlayout(location = 3)\nin float a_colorType;\n\n\nlayout(location = 4)\nin float a_relDepth;\n\n\nvoid main()\n{\n\n if(a_segHeight < (u_0.snpMinFreq_0))\n {\n\n CoverageVsOut_0 _S8 = covDiscardVertex_0();\n\n gl_Position = _S8.position_0;\n\n v_color = _S8.color_0;\n\n return;\n }\n CoverageVsOut_0 o_1;\n\n CoverageBandUniforms_0 _S9 = CoverageBandUniforms_0(u_0.bpHi_0, u_0.bpLo_0, u_0.bpLen_0, u_0.hpZero_0, u_0.canvasW_0, u_0.canvasH_0, u_0.covHeight_0, u_0.covYOffset_0, u_0.covTop_0, u_0.regionMaxDepth_0, u_0.depthDomainMax_0, u_0.depthDomainMin_0, u_0.coverageSymlogConstant_0, u_0.binSize_0, u_0.interbaseHeight_0, u_0.snpMinFreq_0, u_0.reversed_0, u_0.coverageScaleType_0, u_0.colorCoverage_0, u_0.colorBaseA_0, u_0.colorBaseC_0, u_0.colorBaseG_0, u_0.colorBaseT_0, u_0.colorBaseN_0, u_0.colorInsertionIndicator_0, u_0.colorSoftclipIndicator_0, u_0.colorHardclipIndicator_0);\n o_1.position_0 = covSegQuad_0(a_position, 1U, a_yOffset, a_segHeight, a_relDepth, quadLocal_0(uint(gl_VertexID)), _S9);\n\n o_1.color_0 = vec4(covSnpColor_0(a_colorType, _S9), 1.0);\n CoverageVsOut_0 _S10 = o_1;\n\n gl_Position = o_1.position_0;\n\n v_color = _S10.color_0;\n\n return;\n}\n\n";
3
+ export const WGSL_SOURCE = "struct CoverageBandUniforms_std140_0\n{\n @align(16) bpHi_0 : f32,\n @align(4) bpLo_0 : f32,\n @align(8) bpLen_0 : f32,\n @align(4) hpZero_0 : f32,\n @align(16) canvasW_0 : f32,\n @align(4) canvasH_0 : f32,\n @align(8) covHeight_0 : f32,\n @align(4) covYOffset_0 : f32,\n @align(16) covTop_0 : f32,\n @align(4) regionMaxDepth_0 : f32,\n @align(8) depthDomainMax_0 : f32,\n @align(4) depthDomainMin_0 : f32,\n @align(16) coverageSymlogConstant_0 : f32,\n @align(4) binSize_0 : f32,\n @align(8) interbaseHeight_0 : f32,\n @align(4) snpMinFreq_0 : f32,\n @align(16) reversed_0 : f32,\n @align(4) coverageScaleType_0 : i32,\n @align(8) colorCoverage_0 : u32,\n @align(4) colorBaseA_0 : u32,\n @align(16) colorBaseC_0 : u32,\n @align(4) colorBaseG_0 : u32,\n @align(8) colorBaseT_0 : u32,\n @align(4) colorBaseN_0 : u32,\n @align(16) colorInsertionIndicator_0 : u32,\n @align(4) colorSoftclipIndicator_0 : u32,\n @align(8) colorHardclipIndicator_0 : u32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : CoverageBandUniforms_std140_0;\nstruct CoverageVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n};\n\nfn covDiscardVertex_0() -> CoverageVsOut_0\n{\n var o_0 : CoverageVsOut_0;\n var _S1 : vec4<f32> = vec4<f32>(0.0f);\n o_0.position_0 = _S1;\n o_0.color_0 = _S1;\n return o_0;\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S2 : bool = v_0 == u32(0);\n var _S3 : bool;\n if(_S2)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(2);\n }\n if(_S3)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(3);\n }\n var _S4 : f32;\n if(_S3)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n if(_S2)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(1);\n }\n if(_S3)\n {\n _S3 = true;\n }\n else\n {\n _S3 = v_0 == u32(4);\n }\n var _S5 : f32;\n if(_S3)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n return vec2<f32>(_S4, _S5);\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_1 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S6 : f32 = - (1.0f / hpZero_1);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S6), max(splitPos_0.y - bpRange_0.y, _S6)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn covBpToClipX_0( bp_0 : u32, u_1 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3<f32>((*u_1).bpHi_0, (*u_1).bpLo_0, (*u_1).bpLen_0), (*u_1).hpZero_0);\n}\n\nfn expandToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> vec2<f32>\n{\n if((x2_0 - x1_0) < minWidth_0)\n {\n var mid_0 : f32 = (x1_0 + x2_0) * 0.5f;\n var _S7 : f32 = minWidth_0 * 0.5f;\n return vec2<f32>(mid_0 - _S7, mid_0 + _S7);\n }\n return vec2<f32>(x1_0, x2_0);\n}\n\nfn expandToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_0 : f32, canvasWidth_0 : f32) -> vec2<f32>\n{\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0f / canvasWidth_0);\n}\n\nfn covExpandMinWidthX_0( x1_2 : f32, x2_2 : f32, canvasWidth_1 : f32) -> vec2<f32>\n{\n return expandToMinWidthX_0(x1_2, x2_2, 1.0f, canvasWidth_1);\n}\n\nfn covBottomOffsetPx_0( covHeight_1 : f32, covYOffset_1 : f32) -> f32\n{\n return covHeight_1 - covYOffset_1;\n}\n\nfn covBaselinePx_0( u_2 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return (*u_2).covTop_0 + covBottomOffsetPx_0((*u_2).covHeight_0, (*u_2).covYOffset_0);\n}\n\nfn symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_0 : f32, domainMax_0 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_0, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_0 > 0.0f)\n {\n floorV_0 = domainMin_0;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_0) / range_0, 0.0f, 1.0f);\n}\n\nfn normalizeDepthScalar_0( rawDepth_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_1 : i32, symlogConstant_1 : f32) -> f32\n{\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\nfn covNormalizeDepth_0( relDepth_0 : f32, u_3 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return normalizeDepthScalar_0(relDepth_0 * (*u_3).regionMaxDepth_0, (*u_3).depthDomainMin_0, (*u_3).depthDomainMax_0, (*u_3).coverageScaleType_0, (*u_3).coverageSymlogConstant_0);\n}\n\nfn covEffectiveHeightPx_0( covHeight_2 : f32, covYOffset_2 : f32) -> f32\n{\n return max(covHeight_2 - 2.0f * covYOffset_2, 0.0f);\n}\n\nfn covEffHeight_0( u_4 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return covEffectiveHeightPx_0((*u_4).covHeight_0, (*u_4).covYOffset_0);\n}\n\nfn covBarHeightPx_0( depthFraction_0 : f32, effectiveHeightPx_0 : f32) -> f32\n{\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\nfn covSegBottomPx_0( baselinePx_0 : f32, yOffset_0 : f32, barHeightPx_0 : f32) -> f32\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_0 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_0 * 2.0f;\n}\n\nfn covSegTopPx_0( baselinePx_1 : f32, yOffset_1 : f32, segHeight_0 : f32, barHeightPx_1 : f32) -> f32\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\nfn covFlipX_0( x_1 : f32, u_5 : ptr<function, CoverageBandUniforms_std140_0>) -> f32\n{\n return mix(x_1, - x_1, (*u_5).reversed_0);\n}\n\nfn covFlippedQuad_0( x0_0 : f32, x1_3 : f32, yBot_0 : f32, yTop_0 : f32, local_0 : vec2<f32>, u_6 : ptr<function, CoverageBandUniforms_std140_0>) -> vec4<f32>\n{\n var _S8 : f32 = covFlipX_0(mix(x0_0, x1_3, local_0.x), &((*u_6)));\n return vec4<f32>(_S8, mix(yBot_0, yTop_0, local_0.y), 0.0f, 1.0f);\n}\n\nfn covSegQuad_0( position_1 : u32, widthBp_0 : u32, yOffset_2 : f32, segHeight_1 : f32, relDepth_1 : f32, local_1 : vec2<f32>, u_7 : ptr<function, CoverageBandUniforms_std140_0>) -> vec4<f32>\n{\n var _S9 : f32 = covBpToClipX_0(position_1, &((*u_7)));\n var _S10 : f32 = covBpToClipX_0(position_1 + widthBp_0, &((*u_7)));\n var xx_0 : vec2<f32> = covExpandMinWidthX_0(_S9, _S10, (*u_7).canvasW_0);\n var _S11 : f32 = covBaselinePx_0(&((*u_7)));\n var _S12 : f32 = covNormalizeDepth_0(relDepth_1, &((*u_7)));\n var _S13 : f32 = covEffHeight_0(&((*u_7)));\n var barPx_0 : f32 = covBarHeightPx_0(_S12, _S13);\n var _S14 : vec4<f32> = covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(_S11, yOffset_2, barPx_0), (*u_7).canvasH_0), yPxToClipY_0(covSegTopPx_0(_S11, yOffset_2, segHeight_1, barPx_0), (*u_7).canvasH_0), local_1, &((*u_7)));\n return _S14;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn covSnpColor_0( ct_0 : f32, u_8 : ptr<function, CoverageBandUniforms_std140_0>) -> vec3<f32>\n{\n switch(i32(ct_0))\n {\n case i32(1):\n {\n return unpackRGBA_0((*u_8).colorBaseA_0).xyz;\n }\n case i32(2):\n {\n return unpackRGBA_0((*u_8).colorBaseC_0).xyz;\n }\n case i32(3):\n {\n return unpackRGBA_0((*u_8).colorBaseG_0).xyz;\n }\n case i32(4):\n {\n return unpackRGBA_0((*u_8).colorBaseT_0).xyz;\n }\n default :\n {\n return unpackRGBA_0((*u_8).colorBaseN_0).xyz;\n }\n }\n}\n\nstruct vertexInput_0\n{\n @location(0) position_2 : u32,\n @location(1) yOffset_3 : f32,\n @location(2) segHeight_2 : f32,\n @location(3) colorType_0 : f32,\n @location(4) relDepth_2 : f32,\n};\n\n@vertex\nfn vs_main( _S15 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> CoverageVsOut_0\n{\n if((_S15.segHeight_2) < (u_0.snpMinFreq_0))\n {\n return covDiscardVertex_0();\n }\n var o_1 : CoverageVsOut_0;\n var _S16 : vec2<f32> = quadLocal_0(vid_1);\n var _S17 : CoverageBandUniforms_std140_0 = u_0;\n var _S18 : vec4<f32> = covSegQuad_0(_S15.position_2, u32(1), _S15.yOffset_3, _S15.segHeight_2, _S15.relDepth_2, _S16, &(_S17));\n o_1.position_0 = _S18;\n var _S19 : vec3<f32> = covSnpColor_0(_S15.colorType_0, &(_S17));\n o_1.color_0 = vec4<f32>(_S19, 1.0f);\n return o_1;\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_1 : vec4<f32>,\n};\n\n@fragment\nfn fs_main( _S20 : pixelInput_0, @builtin(position) position_3 : vec4<f32>) -> pixelOutput_0\n{\n var _S21 : pixelOutput_0 = pixelOutput_0( _S20.color_1 );\n return _S21;\n}\n\n";
4
+ export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct CoverageBandUniforms_0\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n float bpHi_0;\n float bpLo_0;\n float bpLen_0;\n float hpZero_0;\n float canvasW_0;\n float canvasH_0;\n float covHeight_0;\n float covYOffset_0;\n float covTop_0;\n float regionMaxDepth_0;\n float depthDomainMax_0;\n float depthDomainMin_0;\n float coverageSymlogConstant_0;\n float binSize_0;\n float interbaseHeight_0;\n float snpMinFreq_0;\n float reversed_0;\n int coverageScaleType_0;\n uint colorCoverage_0;\n uint colorBaseA_0;\n uint colorBaseC_0;\n uint colorBaseG_0;\n uint colorBaseT_0;\n uint colorBaseN_0;\n uint colorInsertionIndicator_0;\n uint colorSoftclipIndicator_0;\n uint colorHardclipIndicator_0;\n}u_0;\n\nstruct CoverageVsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n};\n\n\n\nCoverageVsOut_0 covDiscardVertex_0()\n{\n\n CoverageVsOut_0 o_0;\n const vec4 _S1 = vec4(0.0);\n\n o_0.position_0 = _S1;\n o_0.color_0 = _S1;\n return o_0;\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S2 = v_0 == 0U;\n\n bool _S3;\n\n if(_S2)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 2U;\n\n }\n\n if(_S3)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 3U;\n\n }\n\n float _S4;\n\n if(_S3)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n if(_S2)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 1U;\n\n }\n\n if(_S3)\n {\n\n _S3 = true;\n\n }\n else\n {\n\n _S3 = v_0 == 4U;\n\n }\n\n float _S5;\n\n if(_S3)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n\n return vec2(_S4, _S5);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_1)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S6 = - (1.0 / hpZero_1);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S6), max(splitPos_0.y - bpRange_0.y, _S6)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat covBpToClipX_0(uint bp_0, CoverageBandUniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), vec3(u_1.bpHi_0, u_1.bpLo_0, u_1.bpLen_0), u_1.hpZero_0);\n}\n\n\nvec2 expandToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n if((x2_0 - x1_0) < minWidth_0)\n {\n\n float mid_0 = (x1_0 + x2_0) * 0.5;\n float _S7 = minWidth_0 * 0.5;\n\n return vec2(mid_0 - _S7, mid_0 + _S7);\n }\n return vec2(x1_0, x2_0);\n}\n\nvec2 expandToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_0, float canvasWidth_0)\n{\n\n return expandToMinWidthPx_0(x1_1, x2_1, minWidthPx_0 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 covExpandMinWidthX_0(float x1_2, float x2_2, float canvasWidth_1)\n{\n\n return expandToMinWidthX_0(x1_2, x2_2, 1.0, canvasWidth_1);\n}\n\n\nfloat covBottomOffsetPx_0(float covHeight_1, float covYOffset_1)\n{\n\n return covHeight_1 - covYOffset_1;\n}\n\n\nfloat covBaselinePx_0(CoverageBandUniforms_0 u_2)\n{\n\n return u_2.covTop_0 + covBottomOffsetPx_0(u_2.covHeight_0, u_2.covYOffset_0);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_0, float domainMax_0, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_0, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_0, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_0 > 0.0)\n {\n\n floorV_0 = domainMin_0;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_0, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_0 - domainMin_0;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_0) / range_0, 0.0, 1.0);\n}\n\n\nfloat normalizeDepthScalar_0(float rawDepth_0, float domainMin_1, float domainMax_1, int scaleType_1, float symlogConstant_1)\n{\n\n return normalizeScore_0(rawDepth_0, domainMin_1, domainMax_1, scaleType_1, symlogConstant_1);\n}\n\n\nfloat covNormalizeDepth_0(float relDepth_0, CoverageBandUniforms_0 u_3)\n{\n return normalizeDepthScalar_0(relDepth_0 * u_3.regionMaxDepth_0, u_3.depthDomainMin_0, u_3.depthDomainMax_0, u_3.coverageScaleType_0, u_3.coverageSymlogConstant_0);\n}\n\n\nfloat covEffectiveHeightPx_0(float covHeight_2, float covYOffset_2)\n{\n\n return max(covHeight_2 - 2.0 * covYOffset_2, 0.0);\n}\n\n\nfloat covEffHeight_0(CoverageBandUniforms_0 u_4)\n{\n\n return covEffectiveHeightPx_0(u_4.covHeight_0, u_4.covYOffset_0);\n}\n\n\nfloat covBarHeightPx_0(float depthFraction_0, float effectiveHeightPx_0)\n{\n\n return depthFraction_0 * effectiveHeightPx_0;\n}\n\n\nfloat covSegBottomPx_0(float baselinePx_0, float yOffset_0, float barHeightPx_0)\n{\n return baselinePx_0 - yOffset_0 * barHeightPx_0;\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_0)\n{\n\n return 1.0 - yPx_0 / canvasHeight_0 * 2.0;\n}\n\n\nfloat covSegTopPx_0(float baselinePx_1, float yOffset_1, float segHeight_0, float barHeightPx_1)\n{\n return covSegBottomPx_0(baselinePx_1, yOffset_1, barHeightPx_1) - segHeight_0 * barHeightPx_1;\n}\n\n\nfloat covFlipX_0(float x_1, CoverageBandUniforms_0 u_5)\n{\n\n return mix(x_1, - x_1, u_5.reversed_0);\n}\n\n\nvec4 covFlippedQuad_0(float x0_0, float x1_3, float yBot_0, float yTop_0, vec2 local_0, CoverageBandUniforms_0 u_6)\n{\n return vec4(covFlipX_0(mix(x0_0, x1_3, local_0.x), u_6), mix(yBot_0, yTop_0, local_0.y), 0.0, 1.0);\n}\n\n\nvec4 covSegQuad_0(uint position_1, uint widthBp_0, float yOffset_2, float segHeight_1, float relDepth_1, vec2 local_1, CoverageBandUniforms_0 u_7)\n{\n\n vec2 xx_0 = covExpandMinWidthX_0(covBpToClipX_0(position_1, u_7), covBpToClipX_0(position_1 + widthBp_0, u_7), u_7.canvasW_0);\n\n float basePx_0 = covBaselinePx_0(u_7);\n float barPx_0 = covBarHeightPx_0(covNormalizeDepth_0(relDepth_1, u_7), covEffHeight_0(u_7));\n return covFlippedQuad_0(xx_0.x, xx_0.y, yPxToClipY_0(covSegBottomPx_0(basePx_0, yOffset_2, barPx_0), u_7.canvasH_0), yPxToClipY_0(covSegTopPx_0(basePx_0, yOffset_2, segHeight_1, barPx_0), u_7.canvasH_0), local_1, u_7);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nvec3 covSnpColor_0(float ct_0, CoverageBandUniforms_0 u_8)\n{\n\n switch(int(ct_0))\n {\n case 1:\n {\n\n return unpackRGBA_0(u_8.colorBaseA_0).xyz;\n }\n case 2:\n {\n\n return unpackRGBA_0(u_8.colorBaseC_0).xyz;\n }\n case 3:\n {\n\n return unpackRGBA_0(u_8.colorBaseG_0).xyz;\n }\n case 4:\n {\n\n return unpackRGBA_0(u_8.colorBaseT_0).xyz;\n }\n default:\n {\n\n return unpackRGBA_0(u_8.colorBaseN_0).xyz;\n }\n }\n\n}\n\n\nout vec4 v_color;\n\n\nlayout(location = 0)\nin uint a_position;\n\n\nlayout(location = 1)\nin float a_yOffset;\n\n\nlayout(location = 2)\nin float a_segHeight;\n\n\nlayout(location = 3)\nin float a_colorType;\n\n\nlayout(location = 4)\nin float a_relDepth;\n\n\nvoid main()\n{\n\n if(a_segHeight < (u_0.snpMinFreq_0))\n {\n\n CoverageVsOut_0 _S8 = covDiscardVertex_0();\n\n gl_Position = _S8.position_0;\n\n v_color = _S8.color_0;\n\n return;\n }\n CoverageVsOut_0 o_1;\n\n CoverageBandUniforms_0 _S9 = CoverageBandUniforms_0(u_0.bpHi_0, u_0.bpLo_0, u_0.bpLen_0, u_0.hpZero_0, u_0.canvasW_0, u_0.canvasH_0, u_0.covHeight_0, u_0.covYOffset_0, u_0.covTop_0, u_0.regionMaxDepth_0, u_0.depthDomainMax_0, u_0.depthDomainMin_0, u_0.coverageSymlogConstant_0, u_0.binSize_0, u_0.interbaseHeight_0, u_0.snpMinFreq_0, u_0.reversed_0, u_0.coverageScaleType_0, u_0.colorCoverage_0, u_0.colorBaseA_0, u_0.colorBaseC_0, u_0.colorBaseG_0, u_0.colorBaseT_0, u_0.colorBaseN_0, u_0.colorInsertionIndicator_0, u_0.colorSoftclipIndicator_0, u_0.colorHardclipIndicator_0);\n o_1.position_0 = covSegQuad_0(a_position, 1U, a_yOffset, a_segHeight, a_relDepth, quadLocal_0(uint(gl_VertexID)), _S9);\n\n o_1.color_0 = vec4(covSnpColor_0(a_colorType, _S9), 1.0);\n CoverageVsOut_0 _S10 = o_1;\n\n gl_Position = o_1.position_0;\n\n v_color = _S10.color_0;\n\n return;\n}\n\n";
5
5
  export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
6
6
  export * from './coverageSnp.iface.generated.js';
@@ -0,0 +1,4 @@
1
+ export declare const DIAMOND_GLYPH_SCALE = 1.6;
2
+ export declare const GLYPH_DISC = 0;
3
+ export declare const GLYPH_TRIANGLE = 1;
4
+ export declare const GLYPH_DIAMOND = 2;
@@ -0,0 +1,6 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const DIAMOND_GLYPH_SCALE = 1.6;
4
+ export const GLYPH_DISC = 0;
5
+ export const GLYPH_TRIANGLE = 1;
6
+ export const GLYPH_DIAMOND = 2;
@@ -0,0 +1,5 @@
1
+ export declare const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) viewportWidth_0 : f32,\n @align(16) radiusPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S5 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_0);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_1 : f32, domainMax_1 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_1) / max(domainMax_1 - domainMin_1, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_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 clipLenToPx_0( clipLen_0 : f32, size_0 : f32) -> f32\n{\n return clipLen_0 * 0.5f * size_0;\n}\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 pxToClipLen_0( px_0 : f32, size_1 : f32) -> f32\n{\n return px_0 * 2.0f / size_1;\n}\n\nfn clipXToPx_0( clipX_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return (clipX_0 + 1.0f) * 0.5f * canvasWidth_0;\n}\n\nfn crispSquareTopLeftPx_0( centerPx_0 : f32, diameterPx_0 : f32) -> f32\n{\n return floor(centerPx_0 - diameterPx_0 * 0.5f + 0.5f);\n}\n\nfn crispSquareCornerPx_0( centerPx_1 : vec2<f32>, diameterPx_1 : f32, q_0 : vec2<f32>) -> vec2<f32>\n{\n return vec2<f32>(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * vec2<f32>(diameterPx_1);\n}\n\nfn pxToClipX_0( xPx_0 : f32, canvasWidth_1 : f32) -> f32\n{\n return xPx_0 / canvasWidth_1 * 2.0f - 1.0f;\n}\n\nfn crispSquareCornerClip_0( centerClipX_0 : f32, centerYPx_0 : f32, diameterPx_2 : f32, q_1 : vec2<f32>, viewportWidth_1 : f32, canvasHeight_2 : f32) -> vec4<f32>\n{\n var vPx_0 : vec2<f32> = crispSquareCornerPx_0(vec2<f32>(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4<f32>(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0f, 1.0f);\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 discExpand_0( radiusPx_1 : f32, dpr_2 : f32) -> f32\n{\n return (radiusPx_1 + aaHalfPx_0(dpr_2)) / max(radiusPx_1, 0.5f);\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(2) localPos_0 : vec2<f32>,\n @interpolate(flat) @location(1) shape_0 : f32,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_0 : u32,\n @location(1) x2_0 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n @location(4) glyph_0 : u32,\n};\n\n@vertex\nfn vs_main( _S6 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var q_2 : vec2<f32> = quadLocal_0(vid_1 % u32(6));\n var local_0 : vec2<f32> = q_2 * vec2<f32>(2.0f) - vec2<f32>(1.0f);\n var xZero_0 : bool = (q_2.x) < 0.5f;\n var _S7 : Uniforms_std140_0 = u_0;\n var _S8 : f32 = bpToClipX_0(_S6.x_0, &(_S7));\n var _S9 : f32 = bpToClipX_0(_S6.x2_0, &(_S7));\n var yPx_1 : f32 = valueToYPx_0(_S6.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0);\n var centerClipY_0 : f32 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n var isBar_0 : bool = (clipLenToPx_0(abs(_S9 - _S8), u_0.viewportWidth_0)) > (u_0.radiusPx_0 * 2.0f);\n var o_0 : VsOut_0;\n o_0.color_0 = unpackRGBA_0(_S6.color_1);\n var x_1 : f32;\n if(isBar_0)\n {\n var overdrawClipX_0 : f32 = pxToClipLen_0(1.0f, u_0.viewportWidth_0);\n if(xZero_0)\n {\n x_1 = min(_S8, _S9) - overdrawClipX_0;\n }\n else\n {\n x_1 = max(_S8, _S9) + overdrawClipX_0;\n }\n o_0.position_0 = vec4<f32>(x_1, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var _S10 : bool;\n if((_S6.glyph_0) == u32(0))\n {\n _S10 = (u_0.radiusPx_0 * 2.0f) <= 3.0f;\n }\n else\n {\n _S10 = false;\n }\n if(_S10)\n {\n o_0.position_0 = crispSquareCornerClip_0(_S8, yPx_1, u_0.radiusPx_0 * 2.0f, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var expand_0 : f32 = discExpand_0(u_0.radiusPx_0, u_0.devicePixelRatio_0);\n var _S11 : bool = (_S6.glyph_0) == u32(2);\n if(_S11)\n {\n x_1 = 1.60000002384185791f;\n }\n else\n {\n x_1 = 1.0f;\n }\n var halfPx_0 : f32 = u_0.radiusPx_0 * expand_0 * x_1;\n o_0.position_0 = vec4<f32>(_S8 + pxToClipLen_0(local_0.x * halfPx_0, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * halfPx_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0 * vec2<f32>(expand_0);\n if((_S6.glyph_0) == u32(1))\n {\n x_1 = 2.0f;\n }\n else\n {\n if(_S11)\n {\n x_1 = 1.0f;\n }\n else\n {\n x_1 = 0.0f;\n }\n }\n o_0.shape_0 = x_1;\n }\n }\n return o_0;\n}\n\nfn discCoverage_0( localPos_1 : vec2<f32>) -> f32\n{\n return 1.0f - length(localPos_1);\n}\n\nfn aaGradient_0( d_0 : f32) -> f32\n{\n return max(length(vec2<f32>(dpdx(d_0), dpdy(d_0))), 0.00000999999974738f);\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\nfn glyphEdgeAlpha_0( coverage_0 : f32) -> f32\n{\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(2) localPos_2 : vec2<f32>,\n @interpolate(flat) @location(1) shape_1 : f32,\n};\n\n@fragment\nfn fs_main( _S12 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var coverage_1 : f32;\n if((_S12.shape_1) > 2.5f)\n {\n coverage_1 = 1.0f;\n }\n else\n {\n if((_S12.shape_1) > 1.5f)\n {\n var _S13 : f32 = _S12.localPos_2.y;\n var _S14 : f32 = _S12.localPos_2.x;\n coverage_1 = min(1.0f - _S13, min((2.0f * _S14 + _S13 + 1.0f) * 0.44721359014511108f, (-2.0f * _S14 + _S13 + 1.0f) * 0.44721359014511108f));\n }\n else\n {\n if((_S12.shape_1) > 0.5f)\n {\n coverage_1 = 1.0f - (abs(_S12.localPos_2.x) + abs(_S12.localPos_2.y));\n }\n else\n {\n coverage_1 = discCoverage_0(_S12.localPos_2);\n }\n }\n }\n var alpha_0 : f32 = glyphEdgeAlpha_0(coverage_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S15 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S12.color_2.xyz, _S12.color_2.w * alpha_0) );\n return _S15;\n}\n\n";
2
+ export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_1, float domainMax_1, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_1) / max(domainMax_1 - domainMin_1, 9.99999997475242708e-07), 0.0, 1.0)) * h_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 clipLenToPx_0(float clipLen_0, float size_0)\n{\n\n return clipLen_0 * 0.5 * size_0;\n}\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 pxToClipLen_0(float px_0, float size_1)\n{\n\n return px_0 * 2.0 / size_1;\n}\n\n\nfloat clipXToPx_0(float clipX_0, float canvasWidth_0)\n{\n\n return (clipX_0 + 1.0) * 0.5 * canvasWidth_0;\n}\n\n\nfloat crispSquareTopLeftPx_0(float centerPx_0, float diameterPx_0)\n{\n\n return floor(centerPx_0 - diameterPx_0 * 0.5 + 0.5);\n}\n\n\n\nvec2 crispSquareCornerPx_0(vec2 centerPx_1, float diameterPx_1, vec2 q_0)\n{\n\n\n\n return vec2(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * diameterPx_1;\n}\n\n\nfloat pxToClipX_0(float xPx_0, float canvasWidth_1)\n{\n\n return xPx_0 / canvasWidth_1 * 2.0 - 1.0;\n}\n\n\nvec4 crispSquareCornerClip_0(float centerClipX_0, float centerYPx_0, float diameterPx_2, vec2 q_1, float viewportWidth_1, float canvasHeight_2)\n{\n\n\n\n vec2 vPx_0 = crispSquareCornerPx_0(vec2(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0, 1.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 discExpand_0(float radiusPx_1, float dpr_2)\n{\n\n return (radiusPx_1 + aaHalfPx_0(dpr_2)) / max(radiusPx_1, 0.5);\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_localPos;\n\n\nflat out float v_shape;\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_glyph;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 localPos_0;\n float shape_0;\n};\n\n\nvoid main()\n{\n\n\n vec2 q_2 = quadLocal_0(uint(gl_VertexID) % 6U);\n vec2 local_0 = q_2 * 2.0 - 1.0;\n bool xZero_0 = (q_2.x) < 0.5;\n\n Uniforms_0 _S6 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.zero_0, u_0.viewportWidth_0, u_0.radiusPx_0, u_0.devicePixelRatio_0);\n\n float startClipX_0 = bpToClipX_0(a_x, _S6);\n float endClipX_0 = bpToClipX_0(a_x2, _S6);\n float yPx_1 = valueToYPx_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0);\n float centerClipY_0 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n\n bool isBar_0 = (clipLenToPx_0(abs(endClipX_0 - startClipX_0), u_0.viewportWidth_0)) > (u_0.radiusPx_0 * 2.0);\n\n VsOut_0 o_0;\n o_0.color_0 = unpackRGBA_0(a_color);\n\n float x_0;\n if(isBar_0)\n {\n float overdrawClipX_0 = pxToClipLen_0(1.0, u_0.viewportWidth_0);\n\n\n if(xZero_0)\n {\n\n x_0 = min(startClipX_0, endClipX_0) - overdrawClipX_0;\n\n }\n else\n {\n\n x_0 = max(startClipX_0, endClipX_0) + overdrawClipX_0;\n\n }\n\n\n\n o_0.position_0 = vec4(x_0, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0;\n\n }\n else\n {\n\n bool _S7;\n\n if(a_glyph == 0U)\n {\n\n _S7 = (u_0.radiusPx_0 * 2.0) <= 3.0;\n\n }\n else\n {\n\n _S7 = false;\n\n }\n\n if(_S7)\n {\n\n\n o_0.position_0 = crispSquareCornerClip_0(startClipX_0, yPx_1, u_0.radiusPx_0 * 2.0, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0;\n\n }\n else\n {\n\n float expand_0 = discExpand_0(u_0.radiusPx_0, u_0.devicePixelRatio_0);\n if(a_glyph == 2U)\n {\n\n x_0 = 1.60000002384185791;\n\n }\n else\n {\n\n x_0 = 1.0;\n\n }\n float halfPx_0 = u_0.radiusPx_0 * expand_0 * x_0;\n\n\n o_0.position_0 = vec4(startClipX_0 + pxToClipLen_0(local_0.x * halfPx_0, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * halfPx_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.localPos_0 = local_0 * expand_0;\n if(a_glyph == 1U)\n {\n\n x_0 = 2.0;\n\n }\n else\n {\n\n if(a_glyph == 2U)\n {\n\n x_0 = 1.0;\n\n }\n else\n {\n\n x_0 = 0.0;\n\n }\n\n }\n\n o_0.shape_0 = x_0;\n\n }\n\n }\n\n VsOut_0 _S8 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S8.color_0;\n\n v_localPos = _S8.localPos_0;\n\n v_shape = _S8.shape_0;\n\n return;\n}\n\n";
3
+ export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nfloat discCoverage_0(vec2 localPos_0)\n{\n\n return 1.0 - length(localPos_0);\n}\n\n\nfloat aaGradient_0(float d_0)\n{\n\n return max(length(vec2(dFdx(d_0), dFdy(d_0))), 0.00000999999974738);\n}\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\nfloat glyphEdgeAlpha_0(float coverage_0)\n{\n\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_localPos;\n\n\nflat in float v_shape;\n\n\nvoid main()\n{\n\n float coverage_1;\n\n if(v_shape > 2.5)\n {\n\n coverage_1 = 1.0;\n\n }\n else\n {\n\n if(v_shape > 1.5)\n {\n\n float _S1 = v_localPos.y;\n float _S2 = v_localPos.x;\n\n coverage_1 = min(1.0 - _S1, min((2.0 * _S2 + _S1 + 1.0) * 0.44721359014511108, (-2.0 * _S2 + _S1 + 1.0) * 0.44721359014511108));\n\n }\n else\n {\n\n if(v_shape > 0.5)\n {\n\n coverage_1 = 1.0 - (abs(v_localPos.x) + abs(v_localPos.y));\n\n }\n else\n {\n\n coverage_1 = discCoverage_0(v_localPos);\n\n }\n\n }\n\n }\n\n float alpha_0 = glyphEdgeAlpha_0(coverage_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";
4
+ export * from './pointMark.iface.generated.ts';
5
+ export * from './pointMark.consts.generated.ts';
@@ -0,0 +1,7 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) zero_0 : f32,\n @align(4) viewportWidth_0 : f32,\n @align(16) radiusPx_0 : f32,\n @align(4) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S5 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_0);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_1 : f32, domainMax_1 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_1) / max(domainMax_1 - domainMin_1, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_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 clipLenToPx_0( clipLen_0 : f32, size_0 : f32) -> f32\n{\n return clipLen_0 * 0.5f * size_0;\n}\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 pxToClipLen_0( px_0 : f32, size_1 : f32) -> f32\n{\n return px_0 * 2.0f / size_1;\n}\n\nfn clipXToPx_0( clipX_0 : f32, canvasWidth_0 : f32) -> f32\n{\n return (clipX_0 + 1.0f) * 0.5f * canvasWidth_0;\n}\n\nfn crispSquareTopLeftPx_0( centerPx_0 : f32, diameterPx_0 : f32) -> f32\n{\n return floor(centerPx_0 - diameterPx_0 * 0.5f + 0.5f);\n}\n\nfn crispSquareCornerPx_0( centerPx_1 : vec2<f32>, diameterPx_1 : f32, q_0 : vec2<f32>) -> vec2<f32>\n{\n return vec2<f32>(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * vec2<f32>(diameterPx_1);\n}\n\nfn pxToClipX_0( xPx_0 : f32, canvasWidth_1 : f32) -> f32\n{\n return xPx_0 / canvasWidth_1 * 2.0f - 1.0f;\n}\n\nfn crispSquareCornerClip_0( centerClipX_0 : f32, centerYPx_0 : f32, diameterPx_2 : f32, q_1 : vec2<f32>, viewportWidth_1 : f32, canvasHeight_2 : f32) -> vec4<f32>\n{\n var vPx_0 : vec2<f32> = crispSquareCornerPx_0(vec2<f32>(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4<f32>(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0f, 1.0f);\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 discExpand_0( radiusPx_1 : f32, dpr_2 : f32) -> f32\n{\n return (radiusPx_1 + aaHalfPx_0(dpr_2)) / max(radiusPx_1, 0.5f);\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(2) localPos_0 : vec2<f32>,\n @interpolate(flat) @location(1) shape_0 : f32,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_0 : u32,\n @location(1) x2_0 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n @location(4) glyph_0 : u32,\n};\n\n@vertex\nfn vs_main( _S6 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var q_2 : vec2<f32> = quadLocal_0(vid_1 % u32(6));\n var local_0 : vec2<f32> = q_2 * vec2<f32>(2.0f) - vec2<f32>(1.0f);\n var xZero_0 : bool = (q_2.x) < 0.5f;\n var _S7 : Uniforms_std140_0 = u_0;\n var _S8 : f32 = bpToClipX_0(_S6.x_0, &(_S7));\n var _S9 : f32 = bpToClipX_0(_S6.x2_0, &(_S7));\n var yPx_1 : f32 = valueToYPx_0(_S6.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0);\n var centerClipY_0 : f32 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n var isBar_0 : bool = (clipLenToPx_0(abs(_S9 - _S8), u_0.viewportWidth_0)) > (u_0.radiusPx_0 * 2.0f);\n var o_0 : VsOut_0;\n o_0.color_0 = unpackRGBA_0(_S6.color_1);\n var x_1 : f32;\n if(isBar_0)\n {\n var overdrawClipX_0 : f32 = pxToClipLen_0(1.0f, u_0.viewportWidth_0);\n if(xZero_0)\n {\n x_1 = min(_S8, _S9) - overdrawClipX_0;\n }\n else\n {\n x_1 = max(_S8, _S9) + overdrawClipX_0;\n }\n o_0.position_0 = vec4<f32>(x_1, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var _S10 : bool;\n if((_S6.glyph_0) == u32(0))\n {\n _S10 = (u_0.radiusPx_0 * 2.0f) <= 3.0f;\n }\n else\n {\n _S10 = false;\n }\n if(_S10)\n {\n o_0.position_0 = crispSquareCornerClip_0(_S8, yPx_1, u_0.radiusPx_0 * 2.0f, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0f;\n }\n else\n {\n var expand_0 : f32 = discExpand_0(u_0.radiusPx_0, u_0.devicePixelRatio_0);\n var _S11 : bool = (_S6.glyph_0) == u32(2);\n if(_S11)\n {\n x_1 = 1.60000002384185791f;\n }\n else\n {\n x_1 = 1.0f;\n }\n var halfPx_0 : f32 = u_0.radiusPx_0 * expand_0 * x_1;\n o_0.position_0 = vec4<f32>(_S8 + pxToClipLen_0(local_0.x * halfPx_0, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * halfPx_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.localPos_0 = local_0 * vec2<f32>(expand_0);\n if((_S6.glyph_0) == u32(1))\n {\n x_1 = 2.0f;\n }\n else\n {\n if(_S11)\n {\n x_1 = 1.0f;\n }\n else\n {\n x_1 = 0.0f;\n }\n }\n o_0.shape_0 = x_1;\n }\n }\n return o_0;\n}\n\nfn discCoverage_0( localPos_1 : vec2<f32>) -> f32\n{\n return 1.0f - length(localPos_1);\n}\n\nfn aaGradient_0( d_0 : f32) -> f32\n{\n return max(length(vec2<f32>(dpdx(d_0), dpdy(d_0))), 0.00000999999974738f);\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\nfn glyphEdgeAlpha_0( coverage_0 : f32) -> f32\n{\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(2) localPos_2 : vec2<f32>,\n @interpolate(flat) @location(1) shape_1 : f32,\n};\n\n@fragment\nfn fs_main( _S12 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var coverage_1 : f32;\n if((_S12.shape_1) > 2.5f)\n {\n coverage_1 = 1.0f;\n }\n else\n {\n if((_S12.shape_1) > 1.5f)\n {\n var _S13 : f32 = _S12.localPos_2.y;\n var _S14 : f32 = _S12.localPos_2.x;\n coverage_1 = min(1.0f - _S13, min((2.0f * _S14 + _S13 + 1.0f) * 0.44721359014511108f, (-2.0f * _S14 + _S13 + 1.0f) * 0.44721359014511108f));\n }\n else\n {\n if((_S12.shape_1) > 0.5f)\n {\n coverage_1 = 1.0f - (abs(_S12.localPos_2.x) + abs(_S12.localPos_2.y));\n }\n else\n {\n coverage_1 = discCoverage_0(_S12.localPos_2);\n }\n }\n }\n var alpha_0 : f32 = glyphEdgeAlpha_0(coverage_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S15 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S12.color_2.xyz, _S12.color_2.w * alpha_0) );\n return _S15;\n}\n\n";
4
+ export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_1, float domainMax_1, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_1) / max(domainMax_1 - domainMin_1, 9.99999997475242708e-07), 0.0, 1.0)) * h_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 clipLenToPx_0(float clipLen_0, float size_0)\n{\n\n return clipLen_0 * 0.5 * size_0;\n}\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 pxToClipLen_0(float px_0, float size_1)\n{\n\n return px_0 * 2.0 / size_1;\n}\n\n\nfloat clipXToPx_0(float clipX_0, float canvasWidth_0)\n{\n\n return (clipX_0 + 1.0) * 0.5 * canvasWidth_0;\n}\n\n\nfloat crispSquareTopLeftPx_0(float centerPx_0, float diameterPx_0)\n{\n\n return floor(centerPx_0 - diameterPx_0 * 0.5 + 0.5);\n}\n\n\n\nvec2 crispSquareCornerPx_0(vec2 centerPx_1, float diameterPx_1, vec2 q_0)\n{\n\n\n\n return vec2(crispSquareTopLeftPx_0(centerPx_1.x, diameterPx_1), crispSquareTopLeftPx_0(centerPx_1.y, diameterPx_1)) + q_0 * diameterPx_1;\n}\n\n\nfloat pxToClipX_0(float xPx_0, float canvasWidth_1)\n{\n\n return xPx_0 / canvasWidth_1 * 2.0 - 1.0;\n}\n\n\nvec4 crispSquareCornerClip_0(float centerClipX_0, float centerYPx_0, float diameterPx_2, vec2 q_1, float viewportWidth_1, float canvasHeight_2)\n{\n\n\n\n vec2 vPx_0 = crispSquareCornerPx_0(vec2(clipXToPx_0(centerClipX_0, viewportWidth_1), centerYPx_0), diameterPx_2, q_1);\n return vec4(pxToClipX_0(vPx_0.x, viewportWidth_1), yPxToClipY_0(vPx_0.y, canvasHeight_2), 0.0, 1.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 discExpand_0(float radiusPx_1, float dpr_2)\n{\n\n return (radiusPx_1 + aaHalfPx_0(dpr_2)) / max(radiusPx_1, 0.5);\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_localPos;\n\n\nflat out float v_shape;\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_glyph;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 localPos_0;\n float shape_0;\n};\n\n\nvoid main()\n{\n\n\n vec2 q_2 = quadLocal_0(uint(gl_VertexID) % 6U);\n vec2 local_0 = q_2 * 2.0 - 1.0;\n bool xZero_0 = (q_2.x) < 0.5;\n\n Uniforms_0 _S6 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.zero_0, u_0.viewportWidth_0, u_0.radiusPx_0, u_0.devicePixelRatio_0);\n\n float startClipX_0 = bpToClipX_0(a_x, _S6);\n float endClipX_0 = bpToClipX_0(a_x2, _S6);\n float yPx_1 = valueToYPx_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0);\n float centerClipY_0 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n\n bool isBar_0 = (clipLenToPx_0(abs(endClipX_0 - startClipX_0), u_0.viewportWidth_0)) > (u_0.radiusPx_0 * 2.0);\n\n VsOut_0 o_0;\n o_0.color_0 = unpackRGBA_0(a_color);\n\n float x_0;\n if(isBar_0)\n {\n float overdrawClipX_0 = pxToClipLen_0(1.0, u_0.viewportWidth_0);\n\n\n if(xZero_0)\n {\n\n x_0 = min(startClipX_0, endClipX_0) - overdrawClipX_0;\n\n }\n else\n {\n\n x_0 = max(startClipX_0, endClipX_0) + overdrawClipX_0;\n\n }\n\n\n\n o_0.position_0 = vec4(x_0, centerClipY_0 + pxToClipLen_0(local_0.y * u_0.radiusPx_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0;\n\n }\n else\n {\n\n bool _S7;\n\n if(a_glyph == 0U)\n {\n\n _S7 = (u_0.radiusPx_0 * 2.0) <= 3.0;\n\n }\n else\n {\n\n _S7 = false;\n\n }\n\n if(_S7)\n {\n\n\n o_0.position_0 = crispSquareCornerClip_0(startClipX_0, yPx_1, u_0.radiusPx_0 * 2.0, q_2, u_0.viewportWidth_0, u_0.canvasHeight_0);\n\n o_0.localPos_0 = local_0;\n o_0.shape_0 = 3.0;\n\n }\n else\n {\n\n float expand_0 = discExpand_0(u_0.radiusPx_0, u_0.devicePixelRatio_0);\n if(a_glyph == 2U)\n {\n\n x_0 = 1.60000002384185791;\n\n }\n else\n {\n\n x_0 = 1.0;\n\n }\n float halfPx_0 = u_0.radiusPx_0 * expand_0 * x_0;\n\n\n o_0.position_0 = vec4(startClipX_0 + pxToClipLen_0(local_0.x * halfPx_0, u_0.viewportWidth_0), centerClipY_0 + pxToClipLen_0(local_0.y * halfPx_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.localPos_0 = local_0 * expand_0;\n if(a_glyph == 1U)\n {\n\n x_0 = 2.0;\n\n }\n else\n {\n\n if(a_glyph == 2U)\n {\n\n x_0 = 1.0;\n\n }\n else\n {\n\n x_0 = 0.0;\n\n }\n\n }\n\n o_0.shape_0 = x_0;\n\n }\n\n }\n\n VsOut_0 _S8 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S8.color_0;\n\n v_localPos = _S8.localPos_0;\n\n v_shape = _S8.shape_0;\n\n return;\n}\n\n";
5
+ export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nfloat discCoverage_0(vec2 localPos_0)\n{\n\n return 1.0 - length(localPos_0);\n}\n\n\nfloat aaGradient_0(float d_0)\n{\n\n return max(length(vec2(dFdx(d_0), dFdy(d_0))), 0.00000999999974738);\n}\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\nfloat glyphEdgeAlpha_0(float coverage_0)\n{\n\n return aaRamp_0(coverage_0, aaGradient_0(coverage_0));\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_localPos;\n\n\nflat in float v_shape;\n\n\nvoid main()\n{\n\n float coverage_1;\n\n if(v_shape > 2.5)\n {\n\n coverage_1 = 1.0;\n\n }\n else\n {\n\n if(v_shape > 1.5)\n {\n\n float _S1 = v_localPos.y;\n float _S2 = v_localPos.x;\n\n coverage_1 = min(1.0 - _S1, min((2.0 * _S2 + _S1 + 1.0) * 0.44721359014511108, (-2.0 * _S2 + _S1 + 1.0) * 0.44721359014511108));\n\n }\n else\n {\n\n if(v_shape > 0.5)\n {\n\n coverage_1 = 1.0 - (abs(v_localPos.x) + abs(v_localPos.y));\n\n }\n else\n {\n\n coverage_1 = discCoverage_0(v_localPos);\n\n }\n\n }\n\n }\n\n float alpha_0 = glyphEdgeAlpha_0(coverage_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
6
+ export * from './pointMark.iface.generated.js';
7
+ export * from './pointMark.consts.generated.js';
@@ -0,0 +1,55 @@
1
+ import type { VertexAttributeLayout, ShaderBinding } from '@jbrowse/render-core/hal';
2
+ export declare const BINDINGS: readonly ShaderBinding[];
3
+ export declare const VERTS_PER_INSTANCE = 6;
4
+ export declare const UNIFORMS_SIZE_BYTES = 48;
5
+ export declare const UNIFORM_OFFSET_F32: {
6
+ readonly bpRangeX: 0;
7
+ readonly canvasHeight: 3;
8
+ readonly domainMin: 4;
9
+ readonly domainMax: 5;
10
+ readonly zero: 6;
11
+ readonly viewportWidth: 7;
12
+ readonly radiusPx: 8;
13
+ readonly devicePixelRatio: 9;
14
+ };
15
+ export interface Uniforms {
16
+ bpRangeX: [number, number, number];
17
+ canvasHeight: number;
18
+ domainMin: number;
19
+ domainMax: number;
20
+ zero: number;
21
+ viewportWidth: number;
22
+ radiusPx: number;
23
+ devicePixelRatio: number;
24
+ }
25
+ export declare function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms): void;
26
+ export declare const INSTANCE_STRIDE_BYTES = 20;
27
+ export declare const INSTANCE_STRIDE_WORDS = 5;
28
+ export declare const INSTANCE_OFFSET_F32: {
29
+ readonly y: 2;
30
+ };
31
+ export declare const INSTANCE_OFFSET_U32: {
32
+ readonly x: 0;
33
+ readonly x2: 1;
34
+ readonly color: 3;
35
+ readonly glyph: 4;
36
+ };
37
+ export declare const VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
38
+ export interface InstanceArrays {
39
+ x: ArrayLike<number>;
40
+ x2: ArrayLike<number>;
41
+ y: ArrayLike<number>;
42
+ color: ArrayLike<number>;
43
+ glyph: ArrayLike<number>;
44
+ }
45
+ export declare function packInstances(arrays: InstanceArrays, numInstances: number, buf?: ArrayBuffer): ArrayBuffer;
46
+ export declare function getInstanceX(u32: Uint32Array, i: number): number;
47
+ export declare function setInstanceX(u32: Uint32Array, i: number, v: number): void;
48
+ export declare function getInstanceX2(u32: Uint32Array, i: number): number;
49
+ export declare function setInstanceX2(u32: Uint32Array, i: number, v: number): void;
50
+ export declare function getInstanceY(f32: Float32Array, i: number): number;
51
+ export declare function setInstanceY(f32: Float32Array, i: number, v: number): void;
52
+ export declare function getInstanceColor(u32: Uint32Array, i: number): number;
53
+ export declare function setInstanceColor(u32: Uint32Array, i: number, v: number): void;
54
+ export declare function getInstanceGlyph(u32: Uint32Array, i: number): number;
55
+ export declare function setInstanceGlyph(u32: Uint32Array, i: number, v: number): void;
@@ -0,0 +1,100 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const BINDINGS = [
4
+ { index: 1, kind: 'uniform', name: 'u' },
5
+ ];
6
+ export const VERTS_PER_INSTANCE = 6;
7
+ export const UNIFORMS_SIZE_BYTES = 48;
8
+ // Word indices into a Float32Array view over the uniform buffer.
9
+ export const UNIFORM_OFFSET_F32 = {
10
+ bpRangeX: 0,
11
+ canvasHeight: 3,
12
+ domainMin: 4,
13
+ domainMax: 5,
14
+ zero: 6,
15
+ viewportWidth: 7,
16
+ radiusPx: 8,
17
+ devicePixelRatio: 9,
18
+ };
19
+ export function writeUniforms(buf, uniforms) {
20
+ const f32 = new Float32Array(buf);
21
+ f32[0] = uniforms.bpRangeX[0];
22
+ f32[1] = uniforms.bpRangeX[1];
23
+ f32[2] = uniforms.bpRangeX[2];
24
+ f32[3] = uniforms.canvasHeight;
25
+ f32[4] = uniforms.domainMin;
26
+ f32[5] = uniforms.domainMax;
27
+ f32[6] = uniforms.zero;
28
+ f32[7] = uniforms.viewportWidth;
29
+ f32[8] = uniforms.radiusPx;
30
+ f32[9] = uniforms.devicePixelRatio;
31
+ }
32
+ export const INSTANCE_STRIDE_BYTES = 20;
33
+ export const INSTANCE_STRIDE_WORDS = 5;
34
+ // Word indices into a Float32Array view over the instance buffer.
35
+ export const INSTANCE_OFFSET_F32 = {
36
+ y: 2,
37
+ };
38
+ // Word indices into a Uint32Array view over the instance buffer.
39
+ export const INSTANCE_OFFSET_U32 = {
40
+ x: 0,
41
+ x2: 1,
42
+ color: 3,
43
+ glyph: 4,
44
+ };
45
+ export const VERTEX_ATTRIBUTES = [
46
+ { name: 'a_x', components: 1, type: 'uint', offsetBytes: 0, integer: true },
47
+ { name: 'a_x2', components: 1, type: 'uint', offsetBytes: 4, integer: true },
48
+ { name: 'a_y', components: 1, type: 'float', offsetBytes: 8, integer: false },
49
+ { name: 'a_color', components: 1, type: 'uint', offsetBytes: 12, integer: true },
50
+ { name: 'a_glyph', components: 1, type: 'uint', offsetBytes: 16, integer: true },
51
+ ];
52
+ export function packInstances(arrays, numInstances, buf = new ArrayBuffer(numInstances * INSTANCE_STRIDE_BYTES)) {
53
+ const f32 = new Float32Array(buf);
54
+ const u32 = new Uint32Array(buf);
55
+ const { x, x2, y, color, glyph } = arrays;
56
+ for (let i = 0; i < numInstances; i++) {
57
+ const o = i * INSTANCE_STRIDE_WORDS;
58
+ u32[o + 0] = x[i];
59
+ u32[o + 1] = x2[i];
60
+ f32[o + 2] = y[i];
61
+ u32[o + 3] = color[i];
62
+ u32[o + 4] = glyph[i];
63
+ }
64
+ return buf;
65
+ }
66
+ // Instance `i`'s `x`.
67
+ export function getInstanceX(u32, i) {
68
+ return u32[i * INSTANCE_STRIDE_WORDS];
69
+ }
70
+ export function setInstanceX(u32, i, v) {
71
+ u32[i * INSTANCE_STRIDE_WORDS] = v;
72
+ }
73
+ // Instance `i`'s `x2`.
74
+ export function getInstanceX2(u32, i) {
75
+ return u32[i * INSTANCE_STRIDE_WORDS + 1];
76
+ }
77
+ export function setInstanceX2(u32, i, v) {
78
+ u32[i * INSTANCE_STRIDE_WORDS + 1] = v;
79
+ }
80
+ // Instance `i`'s `y`.
81
+ export function getInstanceY(f32, i) {
82
+ return f32[i * INSTANCE_STRIDE_WORDS + 2];
83
+ }
84
+ export function setInstanceY(f32, i, v) {
85
+ f32[i * INSTANCE_STRIDE_WORDS + 2] = v;
86
+ }
87
+ // Instance `i`'s `color`.
88
+ export function getInstanceColor(u32, i) {
89
+ return u32[i * INSTANCE_STRIDE_WORDS + 3];
90
+ }
91
+ export function setInstanceColor(u32, i, v) {
92
+ u32[i * INSTANCE_STRIDE_WORDS + 3] = v;
93
+ }
94
+ // Instance `i`'s `glyph`.
95
+ export function getInstanceGlyph(u32, i) {
96
+ return u32[i * INSTANCE_STRIDE_WORDS + 4];
97
+ }
98
+ export function setInstanceGlyph(u32, i, v) {
99
+ u32[i * INSTANCE_STRIDE_WORDS + 4] = v;
100
+ }
@@ -0,0 +1 @@
1
+ export declare function valueToYPx(value: number, domainMin: number, domainMax: number, h: number): number;
@@ -0,0 +1,16 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ // Scalar twins of pointMark.slang, transliterated from slangc's WGSL so
4
+ // the Canvas2D and SVG paths run the shader's own math. See adr-051.
5
+ function _clamp(x, lo, hi) {
6
+ return _min(_max(x, lo), hi);
7
+ }
8
+ function _max(a, b) {
9
+ return b > a || Number.isNaN(a) ? b : a;
10
+ }
11
+ function _min(a, b) {
12
+ return b < a || Number.isNaN(a) ? b : a;
13
+ }
14
+ export function valueToYPx(value, domainMin, domainMax, h) {
15
+ return ((1.0 - _clamp(((value - domainMin) / _max((domainMax - domainMin), 9.99999997475242708e-07)), 0.0, 1.0)) * h);
16
+ }
@@ -0,0 +1,4 @@
1
+ export declare const WGSL_SOURCE = "struct RowRectUniforms_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};\n\n@binding(1) @group(0) var<uniform> u_0 : RowRectUniforms_std140_0;\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\n\nfn 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_0 : RowBand_0;\n band_0.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_0.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_0;\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S5 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S6 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S6 = - minWidth_0;\n }\n else\n {\n _S6 = minWidth_0;\n }\n _S6 = x1_0 + _S6;\n }\n else\n {\n _S6 = x2_0;\n }\n return _S6;\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, minWidthPx_0 * 2.0f / 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\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_1 : ptr<function, RowRectUniforms_std140_0>) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_1 : RowBand_0 = rowBandPx_0((*u_1).rowHeight_0, (*u_1).rowProportion_0);\n var rowY_0 : f32 = band_1.offset_0 + (*u_1).rowHeight_0 * rowIndex_0 - (*u_1).scrollTop_0;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), (*u_1).bpRangeX_0, (*u_1).zero_0);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), (*u_1).bpRangeX_0, (*u_1).zero_0), (*u_1).minCellPx_0, (*u_1).minCellDenomPx_0), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_1.height_0, local_0.y), (*u_1).canvasHeight_0), 0.0f, 1.0f);\n}\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\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n};\n\nstruct RowRectInstance_0\n{\n x_0 : u32,\n x2_2 : u32,\n row_0 : u32,\n color_1 : u32,\n};\n\nfn rowRectVertex_0( inst_0 : RowRectInstance_0, vid_2 : u32, u_2 : ptr<function, RowRectUniforms_std140_0>) -> RowRectVsOut_0\n{\n var o_0 : RowRectVsOut_0;\n var _S7 : vec4<f32> = rowRectClipPos_0(inst_0.x_0, inst_0.x2_2, f32(inst_0.row_0), vid_2, &((*u_2)));\n o_0.position_0 = _S7;\n o_0.color_0 = unpackRGBA_0(inst_0.color_1);\n return o_0;\n}\n\nstruct vertexInput_0\n{\n @location(0) x_1 : u32,\n @location(1) x2_3 : u32,\n @location(2) row_1 : u32,\n @location(3) color_2 : u32,\n};\n\n@vertex\nfn vs_main( _S8 : vertexInput_0, @builtin(vertex_index) vid_3 : u32) -> RowRectVsOut_0\n{\n var _S9 : RowRectInstance_0 = RowRectInstance_0( _S8.x_1, _S8.x2_3, _S8.row_1, _S8.color_2 );\n var _S10 : RowRectUniforms_std140_0 = u_0;\n var _S11 : RowRectVsOut_0 = rowRectVertex_0(_S9, vid_3, &(_S10));\n return _S11;\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( _S12 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S13 : pixelOutput_0 = pixelOutput_0( _S12.color_3 );\n return _S13;\n}\n\n";
2
+ export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct RowRectUniforms_0\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};\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}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\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_0;\n band_0.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_0.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_0;\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S6;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S6 = - minWidth_0;\n\n }\n else\n {\n\n _S6 = minWidth_0;\n\n }\n\n _S6 = x1_0 + _S6;\n\n }\n else\n {\n\n _S6 = x2_0;\n\n }\n\n return _S6;\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, minWidthPx_0 * 2.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\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_1)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_1 = rowBandPx_0(u_1.rowHeight_0, u_1.rowProportion_0);\n float rowY_0 = band_1.offset_0 + u_1.rowHeight_0 * rowIndex_0 - u_1.scrollTop_0;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_1.bpRangeX_0, u_1.zero_0);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_1.bpRangeX_0, u_1.zero_0), u_1.minCellPx_0, u_1.minCellDenomPx_0), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_1.height_0, local_0.y), u_1.canvasHeight_0), 0.0, 1.0);\n}\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\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n};\n\n\nstruct RowRectInstance_0\n{\n uint x_0;\n uint x2_2;\n uint row_0;\n uint color_1;\n};\n\n\nRowRectVsOut_0 rowRectVertex_0(RowRectInstance_0 inst_0, uint vid_2, RowRectUniforms_0 u_2)\n{\n\n RowRectVsOut_0 o_0;\n o_0.position_0 = rowRectClipPos_0(inst_0.x_0, inst_0.x2_2, float(inst_0.row_0), vid_2, u_2);\n o_0.color_0 = unpackRGBA_0(inst_0.color_1);\n return o_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\nvoid main()\n{\n\n RowRectUniforms_0 _S7 = RowRectUniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.minCellDenomPx_0, u_0.minCellPx_0, u_0.zero_0, u_0.rowHeight_0, u_0.rowProportion_0, u_0.scrollTop_0);\n\n RowRectInstance_0 _S8 = RowRectInstance_0(a_x, a_x2, a_row, a_color);\n RowRectVsOut_0 _S9 = rowRectVertex_0(_S8, uint(gl_VertexID), _S7);\n\n gl_Position = _S9.position_0;\n\n v_color = _S9.color_0;\n\n return;\n}\n\n";
3
+ export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
4
+ export * from './spanMark.iface.generated.ts';
@@ -0,0 +1,6 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const WGSL_SOURCE = "struct RowRectUniforms_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};\n\n@binding(1) @group(0) var<uniform> u_0 : RowRectUniforms_std140_0;\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S1 : bool = v_0 == u32(0);\n var _S2 : bool;\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(2);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(3);\n }\n var _S3 : f32;\n if(_S2)\n {\n _S3 = 0.0f;\n }\n else\n {\n _S3 = 1.0f;\n }\n if(_S1)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(1);\n }\n if(_S2)\n {\n _S2 = true;\n }\n else\n {\n _S2 = v_0 == u32(4);\n }\n var _S4 : f32;\n if(_S2)\n {\n _S4 = 0.0f;\n }\n else\n {\n _S4 = 1.0f;\n }\n return vec2<f32>(_S3, _S4);\n}\n\nfn 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_0 : RowBand_0;\n band_0.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_0.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_0;\n}\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S5 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S6 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S6 = - minWidth_0;\n }\n else\n {\n _S6 = minWidth_0;\n }\n _S6 = x1_0 + _S6;\n }\n else\n {\n _S6 = x2_0;\n }\n return _S6;\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, minWidthPx_0 * 2.0f / 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\nfn rowRectClipPos_0( startBp_0 : u32, endBp_0 : u32, rowIndex_0 : f32, vid_1 : u32, u_1 : ptr<function, RowRectUniforms_std140_0>) -> vec4<f32>\n{\n var local_0 : vec2<f32> = quadLocal_0(vid_1);\n var band_1 : RowBand_0 = rowBandPx_0((*u_1).rowHeight_0, (*u_1).rowProportion_0);\n var rowY_0 : f32 = band_1.offset_0 + (*u_1).rowHeight_0 * rowIndex_0 - (*u_1).scrollTop_0;\n var sx1_0 : f32 = hpToClipX_0(hpSplitUint_0(startBp_0), (*u_1).bpRangeX_0, (*u_1).zero_0);\n return vec4<f32>(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), (*u_1).bpRangeX_0, (*u_1).zero_0), (*u_1).minCellPx_0, (*u_1).minCellDenomPx_0), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_1.height_0, local_0.y), (*u_1).canvasHeight_0), 0.0f, 1.0f);\n}\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\nstruct RowRectVsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n};\n\nstruct RowRectInstance_0\n{\n x_0 : u32,\n x2_2 : u32,\n row_0 : u32,\n color_1 : u32,\n};\n\nfn rowRectVertex_0( inst_0 : RowRectInstance_0, vid_2 : u32, u_2 : ptr<function, RowRectUniforms_std140_0>) -> RowRectVsOut_0\n{\n var o_0 : RowRectVsOut_0;\n var _S7 : vec4<f32> = rowRectClipPos_0(inst_0.x_0, inst_0.x2_2, f32(inst_0.row_0), vid_2, &((*u_2)));\n o_0.position_0 = _S7;\n o_0.color_0 = unpackRGBA_0(inst_0.color_1);\n return o_0;\n}\n\nstruct vertexInput_0\n{\n @location(0) x_1 : u32,\n @location(1) x2_3 : u32,\n @location(2) row_1 : u32,\n @location(3) color_2 : u32,\n};\n\n@vertex\nfn vs_main( _S8 : vertexInput_0, @builtin(vertex_index) vid_3 : u32) -> RowRectVsOut_0\n{\n var _S9 : RowRectInstance_0 = RowRectInstance_0( _S8.x_1, _S8.x2_3, _S8.row_1, _S8.color_2 );\n var _S10 : RowRectUniforms_std140_0 = u_0;\n var _S11 : RowRectVsOut_0 = rowRectVertex_0(_S9, vid_3, &(_S10));\n return _S11;\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( _S12 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var _S13 : pixelOutput_0 = pixelOutput_0( _S12.color_3 );\n return _S13;\n}\n\n";
4
+ export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nstruct RowRectUniforms_0\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};\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}u_0;\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S1 = v_0 == 0U;\n\n bool _S2;\n\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 2U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 3U;\n\n }\n\n float _S3;\n\n if(_S2)\n {\n\n _S3 = 0.0;\n\n }\n else\n {\n\n _S3 = 1.0;\n\n }\n if(_S1)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 1U;\n\n }\n\n if(_S2)\n {\n\n _S2 = true;\n\n }\n else\n {\n\n _S2 = v_0 == 4U;\n\n }\n\n float _S4;\n\n if(_S2)\n {\n\n _S4 = 0.0;\n\n }\n else\n {\n\n _S4 = 1.0;\n\n }\n\n return vec2(_S3, _S4);\n}\n\n\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_0;\n band_0.height_0 = drawnRowHeightPx_0(rowHeight_3, rowProportion_3);\n band_0.offset_0 = rowBandOffsetPx_0(rowHeight_3, rowProportion_3);\n return band_0;\n}\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S5 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S5), max(splitPos_0.y - bpRange_0.y, _S5)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S6;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S6 = - minWidth_0;\n\n }\n else\n {\n\n _S6 = minWidth_0;\n\n }\n\n _S6 = x1_0 + _S6;\n\n }\n else\n {\n\n _S6 = x2_0;\n\n }\n\n return _S6;\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, minWidthPx_0 * 2.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\nvec4 rowRectClipPos_0(uint startBp_0, uint endBp_0, float rowIndex_0, uint vid_1, RowRectUniforms_0 u_1)\n{\n\n vec2 local_0 = quadLocal_0(vid_1);\n\n RowBand_0 band_1 = rowBandPx_0(u_1.rowHeight_0, u_1.rowProportion_0);\n float rowY_0 = band_1.offset_0 + u_1.rowHeight_0 * rowIndex_0 - u_1.scrollTop_0;\n\n float sx1_0 = hpToClipX_0(hpSplitUint_0(startBp_0), u_1.bpRangeX_0, u_1.zero_0);\n\n return vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, hpToClipX_0(hpSplitUint_0(endBp_0), u_1.bpRangeX_0, u_1.zero_0), u_1.minCellPx_0, u_1.minCellDenomPx_0), local_0.x), yPxToClipY_0(mix(rowY_0, rowY_0 + band_1.height_0, local_0.y), u_1.canvasHeight_0), 0.0, 1.0);\n}\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\nstruct RowRectVsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n};\n\n\nstruct RowRectInstance_0\n{\n uint x_0;\n uint x2_2;\n uint row_0;\n uint color_1;\n};\n\n\nRowRectVsOut_0 rowRectVertex_0(RowRectInstance_0 inst_0, uint vid_2, RowRectUniforms_0 u_2)\n{\n\n RowRectVsOut_0 o_0;\n o_0.position_0 = rowRectClipPos_0(inst_0.x_0, inst_0.x2_2, float(inst_0.row_0), vid_2, u_2);\n o_0.color_0 = unpackRGBA_0(inst_0.color_1);\n return o_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\nvoid main()\n{\n\n RowRectUniforms_0 _S7 = RowRectUniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.minCellDenomPx_0, u_0.minCellPx_0, u_0.zero_0, u_0.rowHeight_0, u_0.rowProportion_0, u_0.scrollTop_0);\n\n RowRectInstance_0 _S8 = RowRectInstance_0(a_x, a_x2, a_row, a_color);\n RowRectVsOut_0 _S9 = rowRectVertex_0(_S8, uint(gl_VertexID), _S7);\n\n gl_Position = _S9.position_0;\n\n v_color = _S9.color_0;\n\n return;\n}\n\n";
5
+ export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nvoid main()\n{\n\n entryPointParam_fs_main_0 = v_color;\n\n return;\n}\n\n";
6
+ export * from './spanMark.iface.generated.js';
@@ -0,0 +1,58 @@
1
+ import type { VertexAttributeLayout, ShaderBinding } from '@jbrowse/render-core/hal';
2
+ export declare const BINDINGS: readonly ShaderBinding[];
3
+ export declare const VERTS_PER_INSTANCE = 6;
4
+ export declare const UNIFORMS_SIZE_BYTES = 48;
5
+ export declare const UNIFORM_OFFSET_F32: {
6
+ readonly bpRangeX: 0;
7
+ readonly canvasHeight: 3;
8
+ readonly minCellDenomPx: 4;
9
+ readonly minCellPx: 5;
10
+ readonly zero: 6;
11
+ readonly rowHeight: 7;
12
+ readonly rowProportion: 8;
13
+ readonly scrollTop: 9;
14
+ };
15
+ export interface Uniforms {
16
+ bpRangeX: [number, number, number];
17
+ canvasHeight: number;
18
+ minCellDenomPx: number;
19
+ minCellPx: number;
20
+ zero: number;
21
+ rowHeight: number;
22
+ rowProportion: number;
23
+ scrollTop: number;
24
+ }
25
+ export declare function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms): void;
26
+ export declare const INSTANCE_STRIDE_BYTES = 16;
27
+ export declare const INSTANCE_STRIDE_WORDS = 4;
28
+ export declare const INSTANCE_OFFSET_U32: {
29
+ readonly x: 0;
30
+ readonly x2: 1;
31
+ readonly row: 2;
32
+ readonly color: 3;
33
+ };
34
+ export declare const VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
35
+ export interface InstanceArrays {
36
+ x: ArrayLike<number>;
37
+ x2: ArrayLike<number>;
38
+ row: ArrayLike<number>;
39
+ color: ArrayLike<number>;
40
+ }
41
+ export declare function packInstances(arrays: InstanceArrays, numInstances: number, buf?: ArrayBuffer): ArrayBuffer;
42
+ export declare function getInstanceX(u32: Uint32Array, i: number): number;
43
+ export declare function setInstanceX(u32: Uint32Array, i: number, v: number): void;
44
+ export declare function getInstanceX2(u32: Uint32Array, i: number): number;
45
+ export declare function setInstanceX2(u32: Uint32Array, i: number, v: number): void;
46
+ export declare function getInstanceRow(u32: Uint32Array, i: number): number;
47
+ export declare function setInstanceRow(u32: Uint32Array, i: number, v: number): void;
48
+ export declare function getInstanceColor(u32: Uint32Array, i: number): number;
49
+ export declare function setInstanceColor(u32: Uint32Array, i: number, v: number): void;
50
+ export declare class InstanceWriter {
51
+ private buf;
52
+ private u32;
53
+ private capacity;
54
+ count: number;
55
+ constructor(capacity: number);
56
+ push(x: number, x2: number, row: number, color: number): void;
57
+ finish(): ArrayBuffer;
58
+ }
@@ -0,0 +1,122 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from spanMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const BINDINGS = [
4
+ { index: 1, kind: 'uniform', name: 'u' },
5
+ ];
6
+ export const VERTS_PER_INSTANCE = 6;
7
+ export const UNIFORMS_SIZE_BYTES = 48;
8
+ // Word indices into a Float32Array view over the uniform buffer.
9
+ export const UNIFORM_OFFSET_F32 = {
10
+ bpRangeX: 0,
11
+ canvasHeight: 3,
12
+ minCellDenomPx: 4,
13
+ minCellPx: 5,
14
+ zero: 6,
15
+ rowHeight: 7,
16
+ rowProportion: 8,
17
+ scrollTop: 9,
18
+ };
19
+ export function writeUniforms(buf, uniforms) {
20
+ const f32 = new Float32Array(buf);
21
+ f32[0] = uniforms.bpRangeX[0];
22
+ f32[1] = uniforms.bpRangeX[1];
23
+ f32[2] = uniforms.bpRangeX[2];
24
+ f32[3] = uniforms.canvasHeight;
25
+ f32[4] = uniforms.minCellDenomPx;
26
+ f32[5] = uniforms.minCellPx;
27
+ f32[6] = uniforms.zero;
28
+ f32[7] = uniforms.rowHeight;
29
+ f32[8] = uniforms.rowProportion;
30
+ f32[9] = uniforms.scrollTop;
31
+ }
32
+ export const INSTANCE_STRIDE_BYTES = 16;
33
+ export const INSTANCE_STRIDE_WORDS = 4;
34
+ // Word indices into a Uint32Array view over the instance buffer.
35
+ export const INSTANCE_OFFSET_U32 = {
36
+ x: 0,
37
+ x2: 1,
38
+ row: 2,
39
+ color: 3,
40
+ };
41
+ export const VERTEX_ATTRIBUTES = [
42
+ { name: 'a_x', components: 1, type: 'uint', offsetBytes: 0, integer: true },
43
+ { name: 'a_x2', components: 1, type: 'uint', offsetBytes: 4, integer: true },
44
+ { name: 'a_row', components: 1, type: 'uint', offsetBytes: 8, integer: true },
45
+ { name: 'a_color', components: 1, type: 'uint', offsetBytes: 12, integer: true },
46
+ ];
47
+ export function packInstances(arrays, numInstances, buf = new ArrayBuffer(numInstances * INSTANCE_STRIDE_BYTES)) {
48
+ const u32 = new Uint32Array(buf);
49
+ const { x, x2, row, color } = arrays;
50
+ for (let i = 0; i < numInstances; i++) {
51
+ const o = i * INSTANCE_STRIDE_WORDS;
52
+ u32[o + 0] = x[i];
53
+ u32[o + 1] = x2[i];
54
+ u32[o + 2] = row[i];
55
+ u32[o + 3] = color[i];
56
+ }
57
+ return buf;
58
+ }
59
+ // Instance `i`'s `x`.
60
+ export function getInstanceX(u32, i) {
61
+ return u32[i * INSTANCE_STRIDE_WORDS];
62
+ }
63
+ export function setInstanceX(u32, i, v) {
64
+ u32[i * INSTANCE_STRIDE_WORDS] = v;
65
+ }
66
+ // Instance `i`'s `x2`.
67
+ export function getInstanceX2(u32, i) {
68
+ return u32[i * INSTANCE_STRIDE_WORDS + 1];
69
+ }
70
+ export function setInstanceX2(u32, i, v) {
71
+ u32[i * INSTANCE_STRIDE_WORDS + 1] = v;
72
+ }
73
+ // Instance `i`'s `row`.
74
+ export function getInstanceRow(u32, i) {
75
+ return u32[i * INSTANCE_STRIDE_WORDS + 2];
76
+ }
77
+ export function setInstanceRow(u32, i, v) {
78
+ u32[i * INSTANCE_STRIDE_WORDS + 2] = v;
79
+ }
80
+ // Instance `i`'s `color`.
81
+ export function getInstanceColor(u32, i) {
82
+ return u32[i * INSTANCE_STRIDE_WORDS + 3];
83
+ }
84
+ export function setInstanceColor(u32, i, v) {
85
+ u32[i * INSTANCE_STRIDE_WORDS + 3] = v;
86
+ }
87
+ // Appends instances one at a time, for an encoder that cannot say up front
88
+ // how many it will emit. Seed the constructor with an upper bound and the
89
+ // common path allocates exactly once; the doubling is a correctness
90
+ // backstop, not the expected route.
91
+ export class InstanceWriter {
92
+ buf;
93
+ u32;
94
+ capacity;
95
+ count = 0;
96
+ constructor(capacity) {
97
+ this.capacity = Math.max(1, capacity);
98
+ this.buf = new ArrayBuffer(this.capacity * INSTANCE_STRIDE_BYTES);
99
+ this.u32 = new Uint32Array(this.buf);
100
+ }
101
+ push(x, x2, row, color) {
102
+ if (this.count === this.capacity) {
103
+ this.capacity *= 2;
104
+ const grown = new ArrayBuffer(this.capacity * INSTANCE_STRIDE_BYTES);
105
+ new Uint8Array(grown).set(new Uint8Array(this.buf));
106
+ this.buf = grown;
107
+ this.u32 = new Uint32Array(grown);
108
+ }
109
+ const o = this.count * INSTANCE_STRIDE_WORDS;
110
+ this.u32[o] = x;
111
+ this.u32[o + 1] = x2;
112
+ this.u32[o + 2] = row;
113
+ this.u32[o + 3] = color;
114
+ this.count++;
115
+ }
116
+ // A right-sized COPY, not a subarray view — see the class comment. Skipped
117
+ // entirely when the seed turned out to be exact, which is the common path.
118
+ finish() {
119
+ const used = this.count * INSTANCE_STRIDE_BYTES;
120
+ return used === this.buf.byteLength ? this.buf : this.buf.slice(0, used);
121
+ }
122
+ }