gfx-rs / wgpu-rs

Rust bindings to wgpu native library
https://wgpu.rs
Mozilla Public License 2.0
1.69k stars 186 forks source link

Validation warnings should say which shader they were triggered by #903

Closed fintelia closed 3 years ago

fintelia commented 3 years ago

Currently shader validation warnings don't actually say which shader caused them. For instance, running terra currently produces the following output:

[2021-05-08T01:39:24Z ERROR wgpu_core::validation] Unexpected varying type: Array { base: [5], size: Constant([15]), stride: 4 }
[2021-05-08T01:39:27Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedCapability(Float64)
[2021-05-08T01:39:27Z WARN  wgpu_core::device]  Proceeding unsafely without validation
[2021-05-08T01:39:27Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, ControlBarrier)
[2021-05-08T01:39:27Z WARN  wgpu_core::device]  Proceeding unsafely without validation
[2021-05-08T01:39:28Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, ControlBarrier)
[2021-05-08T01:39:28Z WARN  wgpu_core::device]  Proceeding unsafely without validation
[2021-05-08T01:40:17Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, ControlBarrier)
[2021-05-08T01:40:17Z WARN  wgpu_core::device]  Proceeding unsafely without validation

All of these warnings are expected, but if they weren't it would be rather annoying to actually figure out where they were coming from...

kvark commented 3 years ago

It's actually fairly easy, I think. Just drop the "cross" dependency, and all these warnings become hard errors.

fintelia commented 3 years ago

Well, specifically disable the "cross" dependency and request shader validation, but yes. Just made a PR with a possible resolution that just prints the label in the warn/error message.