@jbrowse/render-core 5.0.0-beta.4 → 5.0.0-beta.8

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 (69) hide show
  1. package/esm/RenderLifecycleMixin.d.ts +1 -0
  2. package/esm/RenderLifecycleMixin.js +8 -0
  3. package/esm/gpuContextLostError.d.ts +30 -0
  4. package/esm/gpuContextLostError.js +40 -0
  5. package/esm/gpuDevice.js +4 -1
  6. package/esm/hal/gpuHalBase.d.ts +3 -3
  7. package/esm/hal/index.d.ts +1 -1
  8. package/esm/hal/mockHal.d.ts +3 -3
  9. package/esm/hal/mockHal.js +3 -2
  10. package/esm/hal/oomReporter.d.ts +7 -0
  11. package/esm/hal/oomReporter.js +10 -0
  12. package/esm/hal/types.d.ts +8 -1
  13. package/esm/hal/webgl2Hal.d.ts +2 -2
  14. package/esm/hal/webgl2Hal.js +8 -1
  15. package/esm/hal/webgpuHal.d.ts +12 -2
  16. package/esm/hal/webgpuHal.js +43 -5
  17. package/esm/marks/barMark.d.ts +28 -0
  18. package/esm/marks/barMark.js +63 -0
  19. package/esm/marks/drawAgainstHit.d.ts +85 -14
  20. package/esm/marks/drawAgainstHit.js +260 -38
  21. package/esm/marks/glyphPaint.d.ts +10 -2
  22. package/esm/marks/glyphPaint.js +21 -0
  23. package/esm/marks/index.d.ts +9 -2
  24. package/esm/marks/index.js +4 -1
  25. package/esm/marks/markBackend.d.ts +14 -2
  26. package/esm/marks/markBackend.js +43 -13
  27. package/esm/marks/markHit.d.ts +8 -1
  28. package/esm/marks/markHit.js +15 -0
  29. package/esm/marks/markInk.d.ts +14 -0
  30. package/esm/marks/markInk.js +34 -0
  31. package/esm/marks/markPlan.d.ts +25 -0
  32. package/esm/marks/markPlan.js +20 -0
  33. package/esm/marks/markRamp.d.ts +43 -0
  34. package/esm/marks/markRamp.js +68 -0
  35. package/esm/marks/pointMark.d.ts +8 -4
  36. package/esm/marks/pointMark.js +32 -9
  37. package/esm/marks/spanMark.d.ts +8 -0
  38. package/esm/marks/spanMark.js +19 -14
  39. package/esm/marks/types.d.ts +90 -3
  40. package/esm/marks/types.js +56 -4
  41. package/esm/shaders/barMark.generated.d.ts +4 -0
  42. package/esm/shaders/barMark.generated.js +6 -0
  43. package/esm/shaders/barMark.iface.generated.d.ts +64 -0
  44. package/esm/shaders/barMark.iface.generated.js +110 -0
  45. package/esm/shaders/markColor.generated.d.ts +3 -0
  46. package/esm/shaders/markColor.generated.js +5 -0
  47. package/esm/shaders/pointMark.generated.d.ts +3 -3
  48. package/esm/shaders/pointMark.generated.js +3 -3
  49. package/esm/shaders/pointMark.iface.generated.d.ts +17 -6
  50. package/esm/shaders/pointMark.iface.generated.js +27 -9
  51. package/esm/shaders/pointMark.js.generated.d.ts +1 -0
  52. package/esm/shaders/pointMark.js.generated.js +39 -0
  53. package/esm/shaders/scoreScale.generated.d.ts +2 -0
  54. package/esm/shaders/scoreScale.generated.js +4 -0
  55. package/esm/useRenderingBackend.d.ts +1 -16
  56. package/esm/useRenderingBackend.js +2 -24
  57. package/package.json +4 -2
  58. package/src/shaders/barMark.generated.ts +10 -0
  59. package/src/shaders/barMark.iface.generated.ts +160 -0
  60. package/src/shaders/barMark.slang +109 -0
  61. package/src/shaders/markColor.generated.ts +8 -0
  62. package/src/shaders/markColor.slang +47 -0
  63. package/src/shaders/pointMark.generated.ts +3 -3
  64. package/src/shaders/pointMark.iface.generated.ts +34 -10
  65. package/src/shaders/pointMark.js.generated.ts +41 -0
  66. package/src/shaders/pointMark.slang +15 -26
  67. package/src/shaders/scoreScale.generated.ts +6 -0
  68. package/src/shaders/scoreScale.slang +1 -0
  69. package/src/shaders/valueScale.slang +52 -0
@@ -0,0 +1,4 @@
1
+ export declare const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) origin_0 : f32,\n @align(4) zero_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minWidthPx_0 : f32,\n @align(8) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S1 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_0);\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S2 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S2 = - minWidth_0;\n }\n else\n {\n _S2 = minWidth_0;\n }\n _S2 = x1_0 + _S2;\n }\n else\n {\n _S2 = x2_0;\n }\n return _S2;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0f / canvasWidth_0);\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S3 : bool = v_0 == u32(0);\n var _S4 : bool;\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(2);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(3);\n }\n var _S5 : f32;\n if(_S4)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(1);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(4);\n }\n var _S6 : f32;\n if(_S4)\n {\n _S6 = 0.0f;\n }\n else\n {\n _S6 = 1.0f;\n }\n return vec2<f32>(_S5, _S6);\n}\n\nfn symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_1 > 0.0f)\n {\n floorV_0 = domainMin_1;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_1) / range_0, 0.0f, 1.0f);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_0;\n}\n\nfn valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_1 : i32) -> f32\n{\n if(scaleType_1 == i32(1))\n {\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, i32(1), 1.0f)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_0 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_0, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_1 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n};\n\n@vertex\nfn vs_main( _S7 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var _S8 : Uniforms_std140_0 = u_0;\n var _S9 : f32 = bpToClipX_0(_S7.x_1, &(_S8));\n var _S10 : f32 = bpToClipX_0(_S7.x2_2, &(_S8));\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var valueY_0 : f32 = valueToYPxScaled_0(_S7.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var originY_0 : f32 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var _S11 : f32 = min(valueY_0, originY_0);\n var _S12 : f32 = max(valueY_0, originY_0);\n var padPx_0 : f32 = barAaPx_0();\n var vy_0 : f32 = mix(_S12 + padPx_0, _S11 - padPx_0, q_0.y);\n var o_0 : VsOut_0;\n o_0.position_0 = vec4<f32>(mix(_S9, extendToMinWidthX_0(_S9, _S10, u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S7.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S11, vy_0 - _S12);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S13 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S13.barInkPx_1.x, aaPx_1) - aaRamp_0(_S13.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S14 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S13.color_2.xyz, _S13.color_2.w * alpha_0) );\n return _S14;\n}\n\n";
2
+ export declare const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S1 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_0);\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S2;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S2 = - minWidth_0;\n\n }\n else\n {\n\n _S2 = minWidth_0;\n\n }\n\n _S2 = x1_0 + _S2;\n\n }\n else\n {\n\n _S2 = x2_0;\n\n }\n\n return _S2;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S3 = v_0 == 0U;\n\n bool _S4;\n\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 2U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 3U;\n\n }\n\n float _S5;\n\n if(_S4)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 1U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 4U;\n\n }\n\n float _S6;\n\n if(_S4)\n {\n\n _S6 = 0.0;\n\n }\n else\n {\n\n _S6 = 1.0;\n\n }\n\n return vec2(_S5, _S6);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_1 > 0.0)\n {\n\n floorV_0 = domainMin_1;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_1) / range_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_2, float domainMax_2, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07), 0.0, 1.0)) * h_0;\n}\n\n\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_1, int scaleType_1)\n{\n\n if(scaleType_1 == 1)\n {\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, 1, 1.0)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S7)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S7, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S8, int _S9, float _S10, float _S11)\n{\n\n if(_S9 == 0)\n {\n\n return unpackRGBA_0(_S8);\n }\n\n int scaleType_2;\n\n if(_S9 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S8), _S10, _S11, scaleType_2, 1.0));\n}\n\n\nvoid main()\n{\n\n Uniforms_0 _S12 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.origin_0, u_0.zero_0, u_0.minCellDenomPx_0, u_0.minWidthPx_0, u_0.devicePixelRatio_0);\n float sx1_0 = bpToClipX_0(a_x, _S12);\n\n\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float valueY_0 = valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float originY_0 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float _S13 = min(valueY_0, originY_0);\n float _S14 = max(valueY_0, originY_0);\n float padPx_0 = barAaPx_0();\n float vy_0 = mix(_S14 + padPx_0, _S13 - padPx_0, q_0.y);\n\n VsOut_0 o_0;\n o_0.position_0 = vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, bpToClipX_0(a_x2, _S12), u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2(vy_0 - _S13, vy_0 - _S14);\n VsOut_0 _S15 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S15.color_0;\n\n v_barInkPx = _S15.barInkPx_0;\n\n return;\n}\n\n";
3
+ export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
4
+ export * from './barMark.iface.generated.ts';
@@ -0,0 +1,6 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) origin_0 : f32,\n @align(4) zero_0 : f32,\n @align(16) minCellDenomPx_0 : f32,\n @align(4) minWidthPx_0 : f32,\n @align(8) devicePixelRatio_0 : f32,\n};\n\n@binding(1) @group(0) var<uniform> u_0 : Uniforms_std140_0;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn hpSplitUint_0( value_0 : u32) -> vec2<f32>\n{\n var lo_0 : u32 = (value_0 & (u32(4095)));\n return vec2<f32>(f32(value_0 - lo_0), f32(lo_0));\n}\n\nfn hpToClipX_0( splitPos_0 : vec2<f32>, bpRange_0 : vec3<f32>, hpZero_0 : f32) -> f32\n{\n var step_0 : f32 = 2.0f / bpRange_0.z;\n var _S1 : f32 = - (1.0f / hpZero_0);\n return dot(vec3<f32>(-1.0f, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3<f32>(1.0f, step_0, step_0));\n}\n\nfn bpToClipX_0( bp_0 : u32, u_1 : ptr<function, Uniforms_std140_0>) -> f32\n{\n return hpToClipX_0(hpSplitUint_0(bp_0), (*u_1).bpRangeX_0, (*u_1).zero_0);\n}\n\nfn extendToMinWidthPx_0( x1_0 : f32, x2_0 : f32, minWidth_0 : f32) -> f32\n{\n var dx_0 : f32 = x2_0 - x1_0;\n var _S2 : f32;\n if((abs(dx_0)) < minWidth_0)\n {\n if(dx_0 < 0.0f)\n {\n _S2 = - minWidth_0;\n }\n else\n {\n _S2 = minWidth_0;\n }\n _S2 = x1_0 + _S2;\n }\n else\n {\n _S2 = x2_0;\n }\n return _S2;\n}\n\nfn extendToMinWidthX_0( x1_1 : f32, x2_1 : f32, minWidthPx_1 : f32, canvasWidth_0 : f32) -> f32\n{\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0f / canvasWidth_0);\n}\n\nfn quadLocal_0( vid_0 : u32) -> vec2<f32>\n{\n var v_0 : u32 = vid_0 % u32(6);\n var _S3 : bool = v_0 == u32(0);\n var _S4 : bool;\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(2);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(3);\n }\n var _S5 : f32;\n if(_S4)\n {\n _S5 = 0.0f;\n }\n else\n {\n _S5 = 1.0f;\n }\n if(_S3)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(1);\n }\n if(_S4)\n {\n _S4 = true;\n }\n else\n {\n _S4 = v_0 == u32(4);\n }\n var _S6 : f32;\n if(_S4)\n {\n _S6 = 0.0f;\n }\n else\n {\n _S6 = 1.0f;\n }\n return vec2<f32>(_S5, _S6);\n}\n\nfn symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_1 > 0.0f)\n {\n floorV_0 = domainMin_1;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_1) / range_0, 0.0f, 1.0f);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_0;\n}\n\nfn valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_1 : i32) -> f32\n{\n if(scaleType_1 == i32(1))\n {\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, i32(1), 1.0f)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\nfn aaPx_0( dpr_0 : f32) -> f32\n{\n return 1.0f / max(dpr_0, 1.0f);\n}\n\nfn aaHalfPx_0( dpr_1 : f32) -> f32\n{\n return 0.5f * aaPx_0(dpr_1);\n}\n\nfn barAaPx_0() -> f32\n{\n return 2.0f * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\nfn yPxToClipY_0( yPx_0 : f32, canvasHeight_1 : f32) -> f32\n{\n return 1.0f - yPx_0 / canvasHeight_1 * 2.0f;\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_0 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_0, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\nstruct VsOut_0\n{\n @builtin(position) position_0 : vec4<f32>,\n @location(0) color_0 : vec4<f32>,\n @location(1) barInkPx_0 : vec2<f32>,\n};\n\nstruct vertexInput_0\n{\n @location(0) x_1 : u32,\n @location(1) x2_2 : u32,\n @location(2) y_0 : f32,\n @location(3) color_1 : u32,\n};\n\n@vertex\nfn vs_main( _S7 : vertexInput_0, @builtin(vertex_index) vid_1 : u32) -> VsOut_0\n{\n var _S8 : Uniforms_std140_0 = u_0;\n var _S9 : f32 = bpToClipX_0(_S7.x_1, &(_S8));\n var _S10 : f32 = bpToClipX_0(_S7.x2_2, &(_S8));\n var q_0 : vec2<f32> = quadLocal_0(vid_1);\n var valueY_0 : f32 = valueToYPxScaled_0(_S7.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var originY_0 : f32 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var _S11 : f32 = min(valueY_0, originY_0);\n var _S12 : f32 = max(valueY_0, originY_0);\n var padPx_0 : f32 = barAaPx_0();\n var vy_0 : f32 = mix(_S12 + padPx_0, _S11 - padPx_0, q_0.y);\n var o_0 : VsOut_0;\n o_0.position_0 = vec4<f32>(mix(_S9, extendToMinWidthX_0(_S9, _S10, u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0f, 1.0f);\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S7.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2<f32>(vy_0 - _S11, vy_0 - _S12);\n return o_0;\n}\n\nfn aaRamp_0( signedInk_0 : f32, widthPx_0 : f32) -> f32\n{\n return clamp(signedInk_0 / widthPx_0 + 0.5f, 0.0f, 1.0f);\n}\n\nstruct pixelOutput_0\n{\n @location(0) output_0 : vec4<f32>,\n};\n\nstruct pixelInput_0\n{\n @location(0) color_2 : vec4<f32>,\n @location(1) barInkPx_1 : vec2<f32>,\n};\n\n@fragment\nfn fs_main( _S13 : pixelInput_0, @builtin(position) position_1 : vec4<f32>) -> pixelOutput_0\n{\n var aaPx_1 : f32 = barAaPx_0();\n var alpha_0 : f32 = aaRamp_0(_S13.barInkPx_1.x, aaPx_1) - aaRamp_0(_S13.barInkPx_1.y, aaPx_1);\n if(alpha_0 <= 0.0f)\n {\n discard;\n }\n var _S14 : pixelOutput_0 = pixelOutput_0( vec4<f32>(_S13.color_2.xyz, _S13.color_2.w * alpha_0) );\n return _S14;\n}\n\n";
4
+ export const GLSL_VERTEX = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n};\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\n\nvec2 hpSplitUint_0(uint value_0)\n{\n\n uint lo_0 = value_0 & 4095U;\n\n return vec2(float(value_0 - lo_0), float(lo_0));\n}\n\n\nfloat hpToClipX_0(vec2 splitPos_0, vec3 bpRange_0, float hpZero_0)\n{\n float step_0 = 2.0 / bpRange_0.z;\n float _S1 = - (1.0 / hpZero_0);\n\n return dot(vec3(-1.0, max(splitPos_0.x - bpRange_0.x, _S1), max(splitPos_0.y - bpRange_0.y, _S1)), vec3(1.0, step_0, step_0));\n}\n\n\nfloat bpToClipX_0(uint bp_0, Uniforms_0 u_1)\n{\n\n return hpToClipX_0(hpSplitUint_0(bp_0), u_1.bpRangeX_0, u_1.zero_0);\n}\n\n\nfloat extendToMinWidthPx_0(float x1_0, float x2_0, float minWidth_0)\n{\n\n float dx_0 = x2_0 - x1_0;\n\n float _S2;\n if((abs(dx_0)) < minWidth_0)\n {\n\n if(dx_0 < 0.0)\n {\n\n _S2 = - minWidth_0;\n\n }\n else\n {\n\n _S2 = minWidth_0;\n\n }\n\n _S2 = x1_0 + _S2;\n\n }\n else\n {\n\n _S2 = x2_0;\n\n }\n\n return _S2;\n}\n\nfloat extendToMinWidthX_0(float x1_1, float x2_1, float minWidthPx_1, float canvasWidth_0)\n{\n\n return extendToMinWidthPx_0(x1_1, x2_1, minWidthPx_1 * 2.0 / canvasWidth_0);\n}\n\n\nvec2 quadLocal_0(uint vid_0)\n{\n\n uint v_0 = vid_0 % 6U;\n\n bool _S3 = v_0 == 0U;\n\n bool _S4;\n\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 2U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 3U;\n\n }\n\n float _S5;\n\n if(_S4)\n {\n\n _S5 = 0.0;\n\n }\n else\n {\n\n _S5 = 1.0;\n\n }\n if(_S3)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 1U;\n\n }\n\n if(_S4)\n {\n\n _S4 = true;\n\n }\n else\n {\n\n _S4 = v_0 == 4U;\n\n }\n\n float _S6;\n\n if(_S4)\n {\n\n _S6 = 0.0;\n\n }\n else\n {\n\n _S6 = 1.0;\n\n }\n\n return vec2(_S5, _S6);\n}\n\n\nfloat symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_1 > 0.0)\n {\n\n floorV_0 = domainMin_1;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_1) / range_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_2, float domainMax_2, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07), 0.0, 1.0)) * h_0;\n}\n\n\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_1, int scaleType_1)\n{\n\n if(scaleType_1 == 1)\n {\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, 1, 1.0)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat yPxToClipY_0(float yPx_0, float canvasHeight_1)\n{\n\n return 1.0 - yPx_0 / canvasHeight_1 * 2.0;\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\nout vec4 v_color;\n\n\nout vec2 v_barInkPx;\n\n\nlayout(location = 0)\nin uint a_x;\n\n\nlayout(location = 1)\nin uint a_x2;\n\n\nlayout(location = 2)\nin float a_y;\n\n\nlayout(location = 3)\nin uint a_color;\n\n\nstruct VsOut_0\n{\n vec4 position_0;\n vec4 color_0;\n vec2 barInkPx_0;\n};\n\n\nvec4 rampColor_0(float _S7)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S7, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S8, int _S9, float _S10, float _S11)\n{\n\n if(_S9 == 0)\n {\n\n return unpackRGBA_0(_S8);\n }\n\n int scaleType_2;\n\n if(_S9 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S8), _S10, _S11, scaleType_2, 1.0));\n}\n\n\nvoid main()\n{\n\n Uniforms_0 _S12 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.origin_0, u_0.zero_0, u_0.minCellDenomPx_0, u_0.minWidthPx_0, u_0.devicePixelRatio_0);\n float sx1_0 = bpToClipX_0(a_x, _S12);\n\n\n vec2 q_0 = quadLocal_0(uint(gl_VertexID));\n\n float valueY_0 = valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float originY_0 = valueToYPxScaled_0(u_0.origin_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float _S13 = min(valueY_0, originY_0);\n float _S14 = max(valueY_0, originY_0);\n float padPx_0 = barAaPx_0();\n float vy_0 = mix(_S14 + padPx_0, _S13 - padPx_0, q_0.y);\n\n VsOut_0 o_0;\n o_0.position_0 = vec4(mix(sx1_0, extendToMinWidthX_0(sx1_0, bpToClipX_0(a_x2, _S12), u_0.minWidthPx_0, u_0.minCellDenomPx_0), q_0.x), yPxToClipY_0(vy_0, u_0.canvasHeight_0), 0.0, 1.0);\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n o_0.barInkPx_0 = vec2(vy_0 - _S13, vy_0 - _S14);\n VsOut_0 _S15 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S15.color_0;\n\n v_barInkPx = _S15.barInkPx_0;\n\n return;\n}\n\n";
5
+ export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float origin_0;\n float zero_0;\n float minCellDenomPx_0;\n float minWidthPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nfloat aaPx_0(float dpr_0)\n{\n\n return 1.0 / max(dpr_0, 1.0);\n}\n\n\nfloat aaHalfPx_0(float dpr_1)\n{\n\n return 0.5 * aaPx_0(dpr_1);\n}\n\n\nfloat barAaPx_0()\n{\n\n return 2.0 * aaHalfPx_0(u_0.devicePixelRatio_0);\n}\n\n\nfloat aaRamp_0(float signedInk_0, float widthPx_0)\n{\n\n return clamp(signedInk_0 / widthPx_0 + 0.5, 0.0, 1.0);\n}\n\n\nlayout(location = 0)\nout vec4 entryPointParam_fs_main_0;\n\n\nin vec4 v_color;\n\n\nin vec2 v_barInkPx;\n\n\nvoid main()\n{\n\n float aaPx_1 = barAaPx_0();\n float alpha_0 = aaRamp_0(v_barInkPx.x, aaPx_1) - aaRamp_0(v_barInkPx.y, aaPx_1);\n if(alpha_0 <= 0.0)\n {\n\n discard;\n\n }\n\n entryPointParam_fs_main_0 = vec4(v_color.xyz, v_color.w * alpha_0);\n\n return;\n}\n\n";
6
+ export * from './barMark.iface.generated.js';
@@ -0,0 +1,64 @@
1
+ import type { VertexAttributeLayout, ShaderBinding, TextureBinding } from '@jbrowse/render-core/hal';
2
+ export declare const BINDINGS: readonly ShaderBinding[];
3
+ export declare const VERTS_PER_INSTANCE = 6;
4
+ export declare const UNIFORMS_SIZE_BYTES = 64;
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 rampMin: 8;
11
+ readonly rampMax: 9;
12
+ readonly origin: 10;
13
+ readonly zero: 11;
14
+ readonly minCellDenomPx: 12;
15
+ readonly minWidthPx: 13;
16
+ readonly devicePixelRatio: 14;
17
+ };
18
+ export declare const UNIFORM_OFFSET_I32: {
19
+ readonly valueScaleType: 6;
20
+ readonly rampMode: 7;
21
+ };
22
+ export interface Uniforms {
23
+ bpRangeX: [number, number, number];
24
+ canvasHeight: number;
25
+ domainMin: number;
26
+ domainMax: number;
27
+ valueScaleType: number;
28
+ rampMode: number;
29
+ rampMin: number;
30
+ rampMax: number;
31
+ origin: number;
32
+ zero: number;
33
+ minCellDenomPx: number;
34
+ minWidthPx: number;
35
+ devicePixelRatio: number;
36
+ }
37
+ export declare function writeUniforms(buf: ArrayBuffer, uniforms: Uniforms): void;
38
+ export declare const INSTANCE_STRIDE_BYTES = 16;
39
+ export declare const INSTANCE_STRIDE_WORDS = 4;
40
+ export declare const INSTANCE_OFFSET_F32: {
41
+ readonly y: 2;
42
+ };
43
+ export declare const INSTANCE_OFFSET_U32: {
44
+ readonly x: 0;
45
+ readonly x2: 1;
46
+ readonly color: 3;
47
+ };
48
+ export declare const VERTEX_ATTRIBUTES: readonly VertexAttributeLayout[];
49
+ export interface InstanceArrays {
50
+ x: ArrayLike<number>;
51
+ x2: ArrayLike<number>;
52
+ y: ArrayLike<number>;
53
+ color: ArrayLike<number>;
54
+ }
55
+ export declare function packInstances(arrays: InstanceArrays, numInstances: number, buf?: ArrayBuffer): ArrayBuffer;
56
+ export declare function getInstanceX(u32: Uint32Array, i: number): number;
57
+ export declare function setInstanceX(u32: Uint32Array, i: number, v: number): void;
58
+ export declare function getInstanceX2(u32: Uint32Array, i: number): number;
59
+ export declare function setInstanceX2(u32: Uint32Array, i: number, v: number): void;
60
+ export declare function getInstanceY(f32: Float32Array, i: number): number;
61
+ export declare function setInstanceY(f32: Float32Array, i: number, v: number): void;
62
+ export declare function getInstanceColor(u32: Uint32Array, i: number): number;
63
+ export declare function setInstanceColor(u32: Uint32Array, i: number, v: number): void;
64
+ export declare const TEXTURES: readonly [TextureBinding, ...TextureBinding[]];
@@ -0,0 +1,110 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from barMark.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const BINDINGS = [
4
+ { index: 1, kind: 'uniform', name: 'u' },
5
+ { index: 2, kind: 'texture', name: 'colorRamp' },
6
+ { index: 3, kind: 'sampler', name: 'colorRamp' },
7
+ ];
8
+ export const VERTS_PER_INSTANCE = 6;
9
+ export const UNIFORMS_SIZE_BYTES = 64;
10
+ // Word indices into a Float32Array view over the uniform buffer.
11
+ export const UNIFORM_OFFSET_F32 = {
12
+ bpRangeX: 0,
13
+ canvasHeight: 3,
14
+ domainMin: 4,
15
+ domainMax: 5,
16
+ rampMin: 8,
17
+ rampMax: 9,
18
+ origin: 10,
19
+ zero: 11,
20
+ minCellDenomPx: 12,
21
+ minWidthPx: 13,
22
+ devicePixelRatio: 14,
23
+ };
24
+ // Word indices into a Int32Array view over the uniform buffer.
25
+ export const UNIFORM_OFFSET_I32 = {
26
+ valueScaleType: 6,
27
+ rampMode: 7,
28
+ };
29
+ export function writeUniforms(buf, uniforms) {
30
+ const f32 = new Float32Array(buf);
31
+ const i32 = new Int32Array(buf);
32
+ f32[0] = uniforms.bpRangeX[0];
33
+ f32[1] = uniforms.bpRangeX[1];
34
+ f32[2] = uniforms.bpRangeX[2];
35
+ f32[3] = uniforms.canvasHeight;
36
+ f32[4] = uniforms.domainMin;
37
+ f32[5] = uniforms.domainMax;
38
+ i32[6] = uniforms.valueScaleType;
39
+ i32[7] = uniforms.rampMode;
40
+ f32[8] = uniforms.rampMin;
41
+ f32[9] = uniforms.rampMax;
42
+ f32[10] = uniforms.origin;
43
+ f32[11] = uniforms.zero;
44
+ f32[12] = uniforms.minCellDenomPx;
45
+ f32[13] = uniforms.minWidthPx;
46
+ f32[14] = uniforms.devicePixelRatio;
47
+ }
48
+ export const INSTANCE_STRIDE_BYTES = 16;
49
+ export const INSTANCE_STRIDE_WORDS = 4;
50
+ // Word indices into a Float32Array view over the instance buffer.
51
+ export const INSTANCE_OFFSET_F32 = {
52
+ y: 2,
53
+ };
54
+ // Word indices into a Uint32Array view over the instance buffer.
55
+ export const INSTANCE_OFFSET_U32 = {
56
+ x: 0,
57
+ x2: 1,
58
+ color: 3,
59
+ };
60
+ export const VERTEX_ATTRIBUTES = [
61
+ { name: 'a_x', components: 1, type: 'uint', offsetBytes: 0, integer: true },
62
+ { name: 'a_x2', components: 1, type: 'uint', offsetBytes: 4, integer: true },
63
+ { name: 'a_y', components: 1, type: 'float', offsetBytes: 8, integer: false },
64
+ { name: 'a_color', components: 1, type: 'uint', offsetBytes: 12, integer: true },
65
+ ];
66
+ export function packInstances(arrays, numInstances, buf = new ArrayBuffer(numInstances * INSTANCE_STRIDE_BYTES)) {
67
+ const f32 = new Float32Array(buf);
68
+ const u32 = new Uint32Array(buf);
69
+ const { x, x2, y, color } = arrays;
70
+ for (let i = 0; i < numInstances; i++) {
71
+ const o = i * INSTANCE_STRIDE_WORDS;
72
+ u32[o + 0] = x[i];
73
+ u32[o + 1] = x2[i];
74
+ f32[o + 2] = y[i];
75
+ u32[o + 3] = color[i];
76
+ }
77
+ return buf;
78
+ }
79
+ // Instance `i`'s `x`.
80
+ export function getInstanceX(u32, i) {
81
+ return u32[i * INSTANCE_STRIDE_WORDS];
82
+ }
83
+ export function setInstanceX(u32, i, v) {
84
+ u32[i * INSTANCE_STRIDE_WORDS] = v;
85
+ }
86
+ // Instance `i`'s `x2`.
87
+ export function getInstanceX2(u32, i) {
88
+ return u32[i * INSTANCE_STRIDE_WORDS + 1];
89
+ }
90
+ export function setInstanceX2(u32, i, v) {
91
+ u32[i * INSTANCE_STRIDE_WORDS + 1] = v;
92
+ }
93
+ // Instance `i`'s `y`.
94
+ export function getInstanceY(f32, i) {
95
+ return f32[i * INSTANCE_STRIDE_WORDS + 2];
96
+ }
97
+ export function setInstanceY(f32, i, v) {
98
+ f32[i * INSTANCE_STRIDE_WORDS + 2] = v;
99
+ }
100
+ // Instance `i`'s `color`.
101
+ export function getInstanceColor(u32, i) {
102
+ return u32[i * INSTANCE_STRIDE_WORDS + 3];
103
+ }
104
+ export function setInstanceColor(u32, i, v) {
105
+ u32[i * INSTANCE_STRIDE_WORDS + 3] = v;
106
+ }
107
+ // Combined `Sampler2D` bindings. Texture unit indices start at 0.
108
+ export const TEXTURES = [
109
+ { textureBinding: 2, samplerBinding: 3, glTextureUnit: 0, glUniformName: 'u_colorRamp', filter: 'linear' },
110
+ ];
@@ -0,0 +1,3 @@
1
+ export declare const RAMP_NONE = 0;
2
+ export declare const RAMP_LINEAR = 1;
3
+ export declare const RAMP_LOG = 2;
@@ -0,0 +1,5 @@
1
+ // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from markColor.slang.
2
+ // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
+ export const RAMP_NONE = 0;
4
+ export const RAMP_LINEAR = 1;
5
+ export const RAMP_LOG = 2;
@@ -1,5 +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 pointDrawsBar_0( spanPx_0 : f32, radiusPx_1 : f32) -> bool\n{\n return spanPx_0 > (radiusPx_1 * 2.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\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_2 : f32, dpr_2 : f32) -> f32\n{\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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 = pointDrawsBar_0(clipLenToPx_0(abs(_S9 - _S8), u_0.viewportWidth_0), u_0.radiusPx_0);\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 if(xZero_0)\n {\n x_1 = min(_S8, _S9);\n }\n else\n {\n x_1 = max(_S8, _S9);\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\nbool pointDrawsBar_0(float spanPx_0, float radiusPx_1)\n{\n\n return spanPx_0 > (radiusPx_1 * 2.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_2, float dpr_2)\n{\n\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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 = pointDrawsBar_0(clipLenToPx_0(abs(endClipX_0 - startClipX_0), u_0.viewportWidth_0), u_0.radiusPx_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\n if(xZero_0)\n {\n\n x_0 = min(startClipX_0, endClipX_0);\n\n }\n else\n {\n\n x_0 = max(startClipX_0, endClipX_0);\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";
1
+ export declare const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) 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;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn 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 symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_1 > 0.0f)\n {\n floorV_0 = domainMin_1;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_1) / range_0, 0.0f, 1.0f);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_0;\n}\n\nfn valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_1 : i32) -> f32\n{\n if(scaleType_1 == i32(1))\n {\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, i32(1), 1.0f)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\nfn 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 pointDrawsBar_0( spanPx_0 : f32, radiusPx_1 : f32) -> bool\n{\n return spanPx_0 > (radiusPx_1 * 2.0f);\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_0 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_0, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\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_2 : f32, dpr_2 : f32) -> f32\n{\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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_1 : 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_1, &(_S7));\n var _S9 : f32 = bpToClipX_0(_S6.x2_0, &(_S7));\n var yPx_1 : f32 = valueToYPxScaled_0(_S6.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var centerClipY_0 : f32 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n var isBar_0 : bool = pointDrawsBar_0(clipLenToPx_0(abs(_S9 - _S8), u_0.viewportWidth_0), u_0.radiusPx_0);\n var o_0 : VsOut_0;\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S6.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n var x_2 : f32;\n if(isBar_0)\n {\n if(xZero_0)\n {\n x_2 = min(_S8, _S9);\n }\n else\n {\n x_2 = max(_S8, _S9);\n }\n o_0.position_0 = vec4<f32>(x_2, 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_2 = 1.60000002384185791f;\n }\n else\n {\n x_2 = 1.0f;\n }\n var halfPx_0 : f32 = u_0.radiusPx_0 * expand_0 * x_2;\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_2 = 2.0f;\n }\n else\n {\n if(_S11)\n {\n x_2 = 1.0f;\n }\n else\n {\n x_2 = 0.0f;\n }\n }\n o_0.shape_0 = x_2;\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;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n};\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\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 symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_1 > 0.0)\n {\n\n floorV_0 = domainMin_1;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_1) / range_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_2, float domainMax_2, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07), 0.0, 1.0)) * h_0;\n}\n\n\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_1, int scaleType_1)\n{\n\n if(scaleType_1 == 1)\n {\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, 1, 1.0)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\n\nfloat 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\nbool pointDrawsBar_0(float spanPx_0, float radiusPx_1)\n{\n\n return spanPx_0 > (radiusPx_1 * 2.0);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\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_2, float dpr_2)\n{\n\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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\nvec4 rampColor_0(float _S6)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S6, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S7, int _S8, float _S9, float _S10)\n{\n\n if(_S8 == 0)\n {\n\n return unpackRGBA_0(_S7);\n }\n\n int scaleType_2;\n\n if(_S8 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S7), _S9, _S10, scaleType_2, 1.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 _S11 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.zero_0, u_0.viewportWidth_0, u_0.radiusPx_0, u_0.devicePixelRatio_0);\n\n float startClipX_0 = bpToClipX_0(a_x, _S11);\n float endClipX_0 = bpToClipX_0(a_x2, _S11);\n float yPx_1 = valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float centerClipY_0 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n\n bool isBar_0 = pointDrawsBar_0(clipLenToPx_0(abs(endClipX_0 - startClipX_0), u_0.viewportWidth_0), u_0.radiusPx_0);\n\n VsOut_0 o_0;\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n\n float x_1;\n if(isBar_0)\n {\n\n if(xZero_0)\n {\n\n x_1 = min(startClipX_0, endClipX_0);\n\n }\n else\n {\n\n x_1 = max(startClipX_0, endClipX_0);\n\n }\n\n\n o_0.position_0 = vec4(x_1, 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 _S12;\n\n if(a_glyph == 0U)\n {\n\n _S12 = (u_0.radiusPx_0 * 2.0) <= 3.0;\n\n }\n else\n {\n\n _S12 = false;\n\n }\n\n if(_S12)\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_1 = 1.60000002384185791;\n\n }\n else\n {\n\n x_1 = 1.0;\n\n }\n float halfPx_0 = u_0.radiusPx_0 * expand_0 * x_1;\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_1 = 2.0;\n\n }\n else\n {\n\n if(a_glyph == 2U)\n {\n\n x_1 = 1.0;\n\n }\n else\n {\n\n x_1 = 0.0;\n\n }\n\n }\n\n o_0.shape_0 = x_1;\n\n }\n\n }\n\n VsOut_0 _S13 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S13.color_0;\n\n v_localPos = _S13.localPos_0;\n\n v_shape = _S13.shape_0;\n\n return;\n}\n\n";
3
+ export declare const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\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
4
  export * from './pointMark.iface.generated.ts';
5
5
  export * from './pointMark.consts.generated.ts';
@@ -1,7 +1,7 @@
1
1
  // AUTO-GENERATED by packages/shader-tools/src/shader-codegen from pointMark.slang.
2
2
  // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
- export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) 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 pointDrawsBar_0( spanPx_0 : f32, radiusPx_1 : f32) -> bool\n{\n return spanPx_0 > (radiusPx_1 * 2.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\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_2 : f32, dpr_2 : f32) -> f32\n{\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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 = pointDrawsBar_0(clipLenToPx_0(abs(_S9 - _S8), u_0.viewportWidth_0), u_0.radiusPx_0);\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 if(xZero_0)\n {\n x_1 = min(_S8, _S9);\n }\n else\n {\n x_1 = max(_S8, _S9);\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\nbool pointDrawsBar_0(float spanPx_0, float radiusPx_1)\n{\n\n return spanPx_0 > (radiusPx_1 * 2.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_2, float dpr_2)\n{\n\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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 = pointDrawsBar_0(clipLenToPx_0(abs(endClipX_0 - startClipX_0), u_0.viewportWidth_0), u_0.radiusPx_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\n if(xZero_0)\n {\n\n x_0 = min(startClipX_0, endClipX_0);\n\n }\n else\n {\n\n x_0 = max(startClipX_0, endClipX_0);\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";
3
+ export const WGSL_SOURCE = "struct Uniforms_std140_0\n{\n @align(16) bpRangeX_0 : vec3<f32>,\n @align(4) canvasHeight_0 : f32,\n @align(16) domainMin_0 : f32,\n @align(4) domainMax_0 : f32,\n @align(8) valueScaleType_0 : i32,\n @align(4) rampMode_0 : i32,\n @align(16) rampMin_0 : f32,\n @align(4) rampMax_0 : f32,\n @align(8) 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;\n@binding(2) @group(0) var colorRamp_texture_0 : texture_2d<f32>;\n\n@binding(3) @group(0) var colorRamp_sampler_0 : sampler;\n\nfn 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 symlogTransform_0( x_0 : f32, c_0 : f32) -> f32\n{\n return f32((i32(sign((x_0))))) * log(1.0f + abs(x_0 / c_0));\n}\n\nfn normalizeScore_0( score_0 : f32, domainMin_1 : f32, domainMax_1 : f32, scaleType_0 : i32, symlogConstant_0 : f32) -> f32\n{\n if(scaleType_0 == i32(2))\n {\n var tMin_0 : f32 = symlogTransform_0(domainMin_1, symlogConstant_0);\n var tRange_0 : f32 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0f, 1.0f);\n }\n if(scaleType_0 == i32(1))\n {\n var floorV_0 : f32;\n if(domainMin_1 > 0.0f)\n {\n floorV_0 = domainMin_1;\n }\n else\n {\n floorV_0 = 1.0f;\n }\n var logMin_0 : f32 = log2(floorV_0);\n var logRange_0 : f32 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0f, 1.0f);\n }\n var range_0 : f32 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0f)\n {\n return 0.0f;\n }\n return clamp((score_0 - domainMin_1) / range_0, 0.0f, 1.0f);\n}\n\nfn valueToYPx_0( value_1 : f32, domainMin_2 : f32, domainMax_2 : f32, h_0 : f32) -> f32\n{\n return (1.0f - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07f), 0.0f, 1.0f)) * h_0;\n}\n\nfn valueToYPxScaled_0( value_2 : f32, domainMin_3 : f32, domainMax_3 : f32, h_1 : f32, scaleType_1 : i32) -> f32\n{\n if(scaleType_1 == i32(1))\n {\n return (1.0f - normalizeScore_0(value_2, domainMin_3, domainMax_3, i32(1), 1.0f)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\nfn 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 pointDrawsBar_0( spanPx_0 : f32, radiusPx_1 : f32) -> bool\n{\n return spanPx_0 > (radiusPx_1 * 2.0f);\n}\n\nfn unpackRGBA_0( c_1 : u32) -> vec4<f32>\n{\n return vec4<f32>(f32((((c_1 >> (u32(0)))) & (u32(255)))), f32((((c_1 >> (u32(8)))) & (u32(255)))), f32((((c_1 >> (u32(16)))) & (u32(255)))), f32((((c_1 >> (u32(24)))) & (u32(255))))) / vec4<f32>(255.0f);\n}\n\nfn rampColor_0( ramp_texture_0 : texture_2d<f32>, ramp_sampler_0 : sampler, t_0 : f32) -> vec4<f32>\n{\n return (textureSampleLevel((ramp_texture_0), (ramp_sampler_0), (vec2<f32>((clamp(t_0, 0.0f, 1.0f) * 255.0f + 0.5f) / 256.0f, 0.5f)), (0.0f)));\n}\n\nfn markInstanceColor_0( ramp_texture_1 : texture_2d<f32>, ramp_sampler_1 : sampler, packed_0 : u32, rampMode_1 : i32, rampMin_1 : f32, rampMax_1 : f32) -> vec4<f32>\n{\n if(rampMode_1 == i32(0))\n {\n return unpackRGBA_0(packed_0);\n }\n var scaleType_2 : i32;\n if(rampMode_1 == i32(2))\n {\n scaleType_2 = i32(1);\n }\n else\n {\n scaleType_2 = i32(0);\n }\n return rampColor_0(ramp_texture_1, ramp_sampler_1, normalizeScore_0((bitcast<f32>((packed_0))), rampMin_1, rampMax_1, scaleType_2, 1.0f));\n}\n\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_2 : f32, dpr_2 : f32) -> f32\n{\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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_1 : 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_1, &(_S7));\n var _S9 : f32 = bpToClipX_0(_S6.x2_0, &(_S7));\n var yPx_1 : f32 = valueToYPxScaled_0(_S6.y_0, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n var centerClipY_0 : f32 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n var isBar_0 : bool = pointDrawsBar_0(clipLenToPx_0(abs(_S9 - _S8), u_0.viewportWidth_0), u_0.radiusPx_0);\n var o_0 : VsOut_0;\n o_0.color_0 = markInstanceColor_0(colorRamp_texture_0, colorRamp_sampler_0, _S6.color_1, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n var x_2 : f32;\n if(isBar_0)\n {\n if(xZero_0)\n {\n x_2 = min(_S8, _S9);\n }\n else\n {\n x_2 = max(_S8, _S9);\n }\n o_0.position_0 = vec4<f32>(x_2, 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_2 = 1.60000002384185791f;\n }\n else\n {\n x_2 = 1.0f;\n }\n var halfPx_0 : f32 = u_0.radiusPx_0 * expand_0 * x_2;\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_2 = 2.0f;\n }\n else\n {\n if(_S11)\n {\n x_2 = 1.0f;\n }\n else\n {\n x_2 = 0.0f;\n }\n }\n o_0.shape_0 = x_2;\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;\nprecision highp sampler2D;\nstruct Uniforms_0\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n};\n\n\n\nlayout(std140) uniform Uniforms\n{\n vec3 bpRangeX_0;\n float canvasHeight_0;\n float domainMin_0;\n float domainMax_0;\n int valueScaleType_0;\n int rampMode_0;\n float rampMin_0;\n float rampMax_0;\n float zero_0;\n float viewportWidth_0;\n float radiusPx_0;\n float devicePixelRatio_0;\n}u_0;\n\nuniform sampler2D u_colorRamp;\n\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 symlogTransform_0(float x_0, float c_0)\n{\n\n return float((int(sign((x_0))))) * log(1.0 + abs(x_0 / c_0));\n}\n\nfloat normalizeScore_0(float score_0, float domainMin_1, float domainMax_1, int scaleType_0, float symlogConstant_0)\n{\n\n if(scaleType_0 == 2)\n {\n\n float tMin_0 = symlogTransform_0(domainMin_1, symlogConstant_0);\n\n float tRange_0 = symlogTransform_0(domainMax_1, symlogConstant_0) - tMin_0;\n if(tRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((symlogTransform_0(score_0, symlogConstant_0) - tMin_0) / tRange_0, 0.0, 1.0);\n }\n if(scaleType_0 == 1)\n {\n\n float floorV_0;\n\n if(domainMin_1 > 0.0)\n {\n\n floorV_0 = domainMin_1;\n\n }\n else\n {\n\n floorV_0 = 1.0;\n\n }\n float logMin_0 = log2(floorV_0);\n\n float logRange_0 = log2(max(domainMax_1, floorV_0)) - logMin_0;\n if(logRange_0 <= 0.0)\n {\n\n return 0.0;\n }\n return clamp((log2(max(score_0, floorV_0)) - logMin_0) / logRange_0, 0.0, 1.0);\n }\n float range_0 = domainMax_1 - domainMin_1;\n if(range_0 <= 0.0)\n {\n\n return 0.0;\n }\n\n return clamp((score_0 - domainMin_1) / range_0, 0.0, 1.0);\n}\n\n\nfloat valueToYPx_0(float value_1, float domainMin_2, float domainMax_2, float h_0)\n{\n\n return (1.0 - clamp((value_1 - domainMin_2) / max(domainMax_2 - domainMin_2, 9.99999997475242708e-07), 0.0, 1.0)) * h_0;\n}\n\n\n\n\nfloat valueToYPxScaled_0(float value_2, float domainMin_3, float domainMax_3, float h_1, int scaleType_1)\n{\n\n if(scaleType_1 == 1)\n {\n\n return (1.0 - normalizeScore_0(value_2, domainMin_3, domainMax_3, 1, 1.0)) * h_1;\n }\n return valueToYPx_0(value_2, domainMin_3, domainMax_3, h_1);\n}\n\n\nfloat 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\nbool pointDrawsBar_0(float spanPx_0, float radiusPx_1)\n{\n\n return spanPx_0 > (radiusPx_1 * 2.0);\n}\n\n\nvec4 unpackRGBA_0(uint c_1)\n{\n\n return vec4(float((c_1 >> 0U) & 255U), float((c_1 >> 8U) & 255U), float((c_1 >> 16U) & 255U), float((c_1 >> 24U) & 255U)) / 255.0;\n}\n\n\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_2, float dpr_2)\n{\n\n return (radiusPx_2 + aaHalfPx_0(dpr_2)) / max(radiusPx_2, 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\nvec4 rampColor_0(float _S6)\n{\n\n return (textureLod((u_colorRamp), (vec2((clamp(_S6, 0.0, 1.0) * 255.0 + 0.5) / 256.0, 0.5)), (0.0)));\n}\n\n\nvec4 markInstanceColor_0(uint _S7, int _S8, float _S9, float _S10)\n{\n\n if(_S8 == 0)\n {\n\n return unpackRGBA_0(_S7);\n }\n\n int scaleType_2;\n\n if(_S8 == 2)\n {\n\n scaleType_2 = 1;\n\n }\n else\n {\n\n scaleType_2 = 0;\n\n }\n return rampColor_0(normalizeScore_0(uintBitsToFloat(_S7), _S9, _S10, scaleType_2, 1.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 _S11 = Uniforms_0(u_0.bpRangeX_0, u_0.canvasHeight_0, u_0.domainMin_0, u_0.domainMax_0, u_0.valueScaleType_0, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0, u_0.zero_0, u_0.viewportWidth_0, u_0.radiusPx_0, u_0.devicePixelRatio_0);\n\n float startClipX_0 = bpToClipX_0(a_x, _S11);\n float endClipX_0 = bpToClipX_0(a_x2, _S11);\n float yPx_1 = valueToYPxScaled_0(a_y, u_0.domainMin_0, u_0.domainMax_0, u_0.canvasHeight_0, u_0.valueScaleType_0);\n float centerClipY_0 = yPxToClipY_0(yPx_1, u_0.canvasHeight_0);\n\n bool isBar_0 = pointDrawsBar_0(clipLenToPx_0(abs(endClipX_0 - startClipX_0), u_0.viewportWidth_0), u_0.radiusPx_0);\n\n VsOut_0 o_0;\n o_0.color_0 = markInstanceColor_0(a_color, u_0.rampMode_0, u_0.rampMin_0, u_0.rampMax_0);\n\n float x_1;\n if(isBar_0)\n {\n\n if(xZero_0)\n {\n\n x_1 = min(startClipX_0, endClipX_0);\n\n }\n else\n {\n\n x_1 = max(startClipX_0, endClipX_0);\n\n }\n\n\n o_0.position_0 = vec4(x_1, 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 _S12;\n\n if(a_glyph == 0U)\n {\n\n _S12 = (u_0.radiusPx_0 * 2.0) <= 3.0;\n\n }\n else\n {\n\n _S12 = false;\n\n }\n\n if(_S12)\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_1 = 1.60000002384185791;\n\n }\n else\n {\n\n x_1 = 1.0;\n\n }\n float halfPx_0 = u_0.radiusPx_0 * expand_0 * x_1;\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_1 = 2.0;\n\n }\n else\n {\n\n if(a_glyph == 2U)\n {\n\n x_1 = 1.0;\n\n }\n else\n {\n\n x_1 = 0.0;\n\n }\n\n }\n\n o_0.shape_0 = x_1;\n\n }\n\n }\n\n VsOut_0 _S13 = o_0;\n\n gl_Position = o_0.position_0;\n\n v_color = _S13.color_0;\n\n v_localPos = _S13.localPos_0;\n\n v_shape = _S13.shape_0;\n\n return;\n}\n\n";
5
+ export const GLSL_FRAGMENT = "#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\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
6
  export * from './pointMark.iface.generated.js';
7
7
  export * from './pointMark.consts.generated.js';
@@ -1,22 +1,32 @@
1
- import type { VertexAttributeLayout, ShaderBinding } from '@jbrowse/render-core/hal';
1
+ import type { VertexAttributeLayout, ShaderBinding, TextureBinding } from '@jbrowse/render-core/hal';
2
2
  export declare const BINDINGS: readonly ShaderBinding[];
3
3
  export declare const VERTS_PER_INSTANCE = 6;
4
- export declare const UNIFORMS_SIZE_BYTES = 48;
4
+ export declare const UNIFORMS_SIZE_BYTES = 64;
5
5
  export declare const UNIFORM_OFFSET_F32: {
6
6
  readonly bpRangeX: 0;
7
7
  readonly canvasHeight: 3;
8
8
  readonly domainMin: 4;
9
9
  readonly domainMax: 5;
10
- readonly zero: 6;
11
- readonly viewportWidth: 7;
12
- readonly radiusPx: 8;
13
- readonly devicePixelRatio: 9;
10
+ readonly rampMin: 8;
11
+ readonly rampMax: 9;
12
+ readonly zero: 10;
13
+ readonly viewportWidth: 11;
14
+ readonly radiusPx: 12;
15
+ readonly devicePixelRatio: 13;
16
+ };
17
+ export declare const UNIFORM_OFFSET_I32: {
18
+ readonly valueScaleType: 6;
19
+ readonly rampMode: 7;
14
20
  };
15
21
  export interface Uniforms {
16
22
  bpRangeX: [number, number, number];
17
23
  canvasHeight: number;
18
24
  domainMin: number;
19
25
  domainMax: number;
26
+ valueScaleType: number;
27
+ rampMode: number;
28
+ rampMin: number;
29
+ rampMax: number;
20
30
  zero: number;
21
31
  viewportWidth: number;
22
32
  radiusPx: number;
@@ -53,3 +63,4 @@ export declare function getInstanceColor(u32: Uint32Array, i: number): number;
53
63
  export declare function setInstanceColor(u32: Uint32Array, i: number, v: number): void;
54
64
  export declare function getInstanceGlyph(u32: Uint32Array, i: number): number;
55
65
  export declare function setInstanceGlyph(u32: Uint32Array, i: number, v: number): void;
66
+ export declare const TEXTURES: readonly [TextureBinding, ...TextureBinding[]];
@@ -2,32 +2,46 @@
2
2
  // Do not edit. Run `pnpm gen:shaders` to regenerate.
3
3
  export const BINDINGS = [
4
4
  { index: 1, kind: 'uniform', name: 'u' },
5
+ { index: 2, kind: 'texture', name: 'colorRamp' },
6
+ { index: 3, kind: 'sampler', name: 'colorRamp' },
5
7
  ];
6
8
  export const VERTS_PER_INSTANCE = 6;
7
- export const UNIFORMS_SIZE_BYTES = 48;
9
+ export const UNIFORMS_SIZE_BYTES = 64;
8
10
  // Word indices into a Float32Array view over the uniform buffer.
9
11
  export const UNIFORM_OFFSET_F32 = {
10
12
  bpRangeX: 0,
11
13
  canvasHeight: 3,
12
14
  domainMin: 4,
13
15
  domainMax: 5,
14
- zero: 6,
15
- viewportWidth: 7,
16
- radiusPx: 8,
17
- devicePixelRatio: 9,
16
+ rampMin: 8,
17
+ rampMax: 9,
18
+ zero: 10,
19
+ viewportWidth: 11,
20
+ radiusPx: 12,
21
+ devicePixelRatio: 13,
22
+ };
23
+ // Word indices into a Int32Array view over the uniform buffer.
24
+ export const UNIFORM_OFFSET_I32 = {
25
+ valueScaleType: 6,
26
+ rampMode: 7,
18
27
  };
19
28
  export function writeUniforms(buf, uniforms) {
20
29
  const f32 = new Float32Array(buf);
30
+ const i32 = new Int32Array(buf);
21
31
  f32[0] = uniforms.bpRangeX[0];
22
32
  f32[1] = uniforms.bpRangeX[1];
23
33
  f32[2] = uniforms.bpRangeX[2];
24
34
  f32[3] = uniforms.canvasHeight;
25
35
  f32[4] = uniforms.domainMin;
26
36
  f32[5] = uniforms.domainMax;
27
- f32[6] = uniforms.zero;
28
- f32[7] = uniforms.viewportWidth;
29
- f32[8] = uniforms.radiusPx;
30
- f32[9] = uniforms.devicePixelRatio;
37
+ i32[6] = uniforms.valueScaleType;
38
+ i32[7] = uniforms.rampMode;
39
+ f32[8] = uniforms.rampMin;
40
+ f32[9] = uniforms.rampMax;
41
+ f32[10] = uniforms.zero;
42
+ f32[11] = uniforms.viewportWidth;
43
+ f32[12] = uniforms.radiusPx;
44
+ f32[13] = uniforms.devicePixelRatio;
31
45
  }
32
46
  export const INSTANCE_STRIDE_BYTES = 20;
33
47
  export const INSTANCE_STRIDE_WORDS = 5;
@@ -98,3 +112,7 @@ export function getInstanceGlyph(u32, i) {
98
112
  export function setInstanceGlyph(u32, i, v) {
99
113
  u32[i * INSTANCE_STRIDE_WORDS + 4] = v;
100
114
  }
115
+ // Combined `Sampler2D` bindings. Texture unit indices start at 0.
116
+ export const TEXTURES = [
117
+ { textureBinding: 2, samplerBinding: 3, glTextureUnit: 0, glUniformName: 'u_colorRamp', filter: 'linear' },
118
+ ];
@@ -1,2 +1,3 @@
1
1
  export declare function valueToYPx(value: number, domainMin: number, domainMax: number, h: number): number;
2
+ export declare function valueToYPxScaled(value: number, domainMin: number, domainMax: number, h: number, scaleType: number): number;
2
3
  export declare function pointDrawsBar(spanPx: number, radiusPx: number): boolean;