gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
11.76k stars 868 forks source link

[msl-out] Decide whether we're going to handle `MathFunction::Inverse` for matrices #4330

Open expenses opened 3 years ago

expenses commented 3 years ago

MSL doesn't natively have any functions for computing matrix inversions. spirv-cross handles this by adding functions that compute the inverse and calling those: https://github.com/KhronosGroup/SPIRV-Cross/blob/72a2ec4c1b56ce233e0da97a36f87af98927256c/spirv_msl.cpp#L4941-L5079.

The code for these functions is quite long, and I think it's worth thinking about whether we even want to handle this case in the first place.

kvark commented 3 years ago

Yeah, I think we need to. Any code going through SPIRV -> Metal would require this (i.e. within gfx-portability). Also, similar code would be needed for WGSL-out.

Xaeroxe commented 1 year ago

I'm running into this issue. Personally I'd have preferred it if the MSL output included the needed function definition.

panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `horizon_pipeline`
    Internal error in VERTEX shader: MSL: UnsupportedCall("Inverse")