hecrj / wgpu_glyph

A fast text renderer for wgpu (https://github.com/gfx-rs/wgpu)
https://docs.rs/wgpu_glyph
MIT License
441 stars 77 forks source link

Latest release fails with validation error using wgpu 0.11.1 #81

Closed hannobraun closed 2 years ago

hannobraun commented 2 years ago

After upgrading to wgpu 0.11.1, I'm getting the following error:

thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
    error matching FRAGMENT shader requirements against the pipeline
    unable to filter the texture (ResourceBinding { group: 0, binding: 2 }) by the sampler (ResourceBinding { group: 0, binding: 1 })
    non-filterable float texture

', /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.1/src/backend/direct.rs:2195:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: std::panicking::begin_panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:460:5
   2: wgpu::backend::direct::default_error_handler
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.1/src/backend/direct.rs:2195:5
   3: core::ops::function::Fn::call
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:70:5
   4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/alloc/src/boxed.rs:1650:9
   5: wgpu::backend::direct::ErrorSinkRaw::handle_error
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.1/src/backend/direct.rs:2183:9
   6: wgpu::backend::direct::Context::handle_error
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.1/src/backend/direct.rs:184:9
   7: <wgpu::backend::direct::Context as wgpu::Context>::device_create_render_pipeline
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.1/src/backend/direct.rs:1276:13
   8: wgpu::Device::create_render_pipeline
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.1/src/lib.rs:1770:17
   9: wgpu_glyph::pipeline::build
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu_glyph-0.15.1/src/pipeline.rs:290:15
  10: wgpu_glyph::pipeline::Pipeline<()>::new
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu_glyph-0.15.1/src/pipeline.rs:34:9
  11: wgpu_glyph::GlyphBrush<(),F,H>::new
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu_glyph-0.15.1/src/lib.rs:221:23
  12: wgpu_glyph::builder::GlyphBrushBuilder<(),F,H>::build
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu_glyph-0.15.1/src/builder.rs:113:9
  13: fj_host::graphics::config_ui::ConfigUi::new
             at ./src/graphics/config_ui.rs:22:13
  14: fj_host::graphics::renderer::Renderer::new::{{closure}}
             at ./src/graphics/renderer.rs:121:25
  15: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
  16: futures_executor::local_pool::block_on::{{closure}}
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.18/src/local_pool.rs:315:23
  17: futures_executor::local_pool::run_executor::{{closure}}
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.18/src/local_pool.rs:90:37
  18: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  19: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  20: futures_executor::local_pool::run_executor
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.18/src/local_pool.rs:86:5
  21: futures_executor::local_pool::block_on
             at /home/hanno/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.18/src/local_pool.rs:315:5
  22: fj_host::main
             at ./src/main.rs:177:24
  23: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

The error seems to originate from this call: https://github.com/hecrj/wgpu_glyph/blob/0.15.1/src/pipeline.rs#L290-L335

And this is the relevant bit of configuration, I believe: https://github.com/hecrj/wgpu_glyph/blob/0.15.1/src/pipeline.rs#L236-L256

Based on some digging I did in the wgpu validation code, I think the problem is the mismatch between filtering: true and filterable: false.

This problem has been fixed on master (thank you, @Bobo1239!), but that fix hasn't made it into a release yet. I figured it's worth opening this issue despite the fix existing, to provide information to those searching the internet for that error message, and to document that the latest releases of wgpu_glyph and wgpu don't work with one another.

hecrj commented 2 years ago

The fix has been released in 0.15.2 🎉

hannobraun commented 2 years ago

Thank you!