diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-13 04:40:19 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-13 05:01:51 +0200 |
| commit | dbd68ff1396bf498eb97f095810b78d2bddd0011 (patch) | |
| tree | f1d555425899ff1ecb969a94dc1ea5d9b84868f7 /rust/crates/masks/src/shaders | |
| parent | 0d0d7375635733435922a697d91601206cc38b68 (diff) | |
| download | opencut-dbd68ff1396bf498eb97f095810b78d2bddd0011.tar.gz | |
refactor: gpu webgl fallback and batched command encoding
Made-with: Cursor
Diffstat (limited to 'rust/crates/masks/src/shaders')
| -rw-r--r-- | rust/crates/masks/src/shaders/jfa_init.wgsl | 5 | ||||
| -rw-r--r-- | rust/crates/masks/src/shaders/jfa_step.wgsl | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/rust/crates/masks/src/shaders/jfa_init.wgsl b/rust/crates/masks/src/shaders/jfa_init.wgsl index 29aa38c7..e224db3d 100644 --- a/rust/crates/masks/src/shaders/jfa_init.wgsl +++ b/rust/crates/masks/src/shaders/jfa_init.wgsl @@ -24,7 +24,10 @@ fn encode_seed(seed: vec2f) -> vec4f { @fragment fn fragment_main(input: VertexOutput) -> @location(0) vec4f { let mask = textureSample(input_texture, input_sampler, input.tex_coord).r; - let is_seed = select(mask > 0.5, mask < 0.5, uniforms.invert > 0.5); + let above = mask > 0.5; + let below = mask < 0.5; + let inverted = uniforms.invert > 0.5; + let is_seed = select(above, below, inverted); if (is_seed) { let pixel_coord = floor(input.tex_coord * uniforms.resolution); diff --git a/rust/crates/masks/src/shaders/jfa_step.wgsl b/rust/crates/masks/src/shaders/jfa_step.wgsl index e20d7fb0..bf348217 100644 --- a/rust/crates/masks/src/shaders/jfa_step.wgsl +++ b/rust/crates/masks/src/shaders/jfa_step.wgsl @@ -53,7 +53,7 @@ fn fragment_main(input: VertexOutput) -> @location(0) vec4f { continue; } - let encoded = textureSample(input_texture, input_sampler, sample_uv); + let encoded = textureSampleLevel(input_texture, input_sampler, sample_uv, 0.0); if (is_no_seed(encoded)) { continue; } |
