Logicalshift / flo_draw

2D rendering libraries for Rust and FlowBetween
Apache License 2.0
101 stars 6 forks source link

`clip` example crashes with WGPU #6

Closed ales-tsurko closed 9 months ago

ales-tsurko commented 9 months ago

cargo run --example clip --features "render-wgpu"

produces this error:

wgpu error: Validation Error

Caused by:
    In Device::create_bind_group
      note: label = `create_clip_mask_bind_group_no_texture`
    Number of bindings in bind group descriptor (0) does not match the number of bindings defined in the bind group layout (1)

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After debugging, I found that it produces WgpuShader::Simple with StandardShaderVariant::ClippingMask, but the clip_texture is None, so it uses clip_mask_layout as there would be a clip_texture, but there is no actually.

Logicalshift commented 9 months ago

Should be fixed as of b555d1c84e858c9c6388517cfd17bda6d6729bc5 - problem was it just wasn't updating the clip mask in the state, and the shader wasn't using the right coordinates.