gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 548 forks source link

Shader compile times #3389

Open kvark opened 3 years ago

kvark commented 3 years ago

Using spirv-cross appears to be showing up in profiles. We are doing a bit of heap allocation and copying on the way to it and from it today, but also the logic itself may be slow. Hopefully, we can address it by moving to https://github.com/gfx-rs/naga

Here is some input I gathered from a Dota2 run: dota-metal-shader-times.txt

All times are in micro-seconds. Here are some observations:

mkeeter commented 3 years ago

It turns out there was accidentally exponential behavior in SPIRV-Cross – not sure if this was being hit, but it's a possibility!

The spirv_cross crate has updated to the latest upstream in 0.23.0. Depending on when naga will be ready, maybe it's worth bumping the spirv_cross dependency for a point release? I'd be happy to make a PR and see if anything breaks, though I don't have a full set of cross-platform hardware for testing.

(I'm biased, because I'm running into this behavior in an app using wgpu-native, so I'm trying to push the fix all the way downstream 😄)

grovesNL commented 3 years ago

Accidentally closed