-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I am working with @raphlinus on piet-gpu and we're considering replacing our internal HAL with wgpu-hal but we would like to retain the ability to use precompiled shaders to reduce both binary size and startup cost.
After some investigation, it seems the least invasive solution would be to add variants to ShaderInput
for MSL source (or potentially a MTLLibrary
instance) and DXIL and feed those through to pipeline creation in the same way that SpirV
works for Vulkan today. This would require the user to assign bindings that are compatible with those generated by wgpu-hal during pipeline layout creation. For our purposes, this would be an acceptable constraint.
Alternatively, we've also considered a more sophisticated approach that would allow the user to provide a bind mapping during shader module creation. This seems to require deferring native resource binding until the whole pipeline state is known so that discrepancies between the pipeline layout and the expected binding slots for the entry point can be reconciled.
My understanding is that the project is amenable to such a change, and we're willing to do the work, but wanted to provide an opportunity for other potential users who are interested in this feature to weigh in and develop a consensus on the best path forward.