Learning wgpu-hal

Are there any good tutorial for wgpu-hal? Any triangle code as an example or something like learn-wgpu for hal.

Why are you interested in using wgpu-hal (the Hardware Abstraction Layer), specifically?

Most users prefer the wgpu crate which sits at a higher level of abstraction, has a safe interface, performs validation (as in Vulkan Validation Layers) and most of the ecosystem integrates with it.

If you really want to use the HAL, the examples are in the repo: wgpu/wgpu-hal/examples at trunk · gfx-rs/wgpu

Because I need to use it. Also those examples aren't helpful for learning.

You asked for triangle code as an example.

HAL is not well documented because it's "oriented towards WebGPU implementation goals" [1]. It is modelled after Vulkan, so concepts from the Vulkan Tutorial apply. Instances, devices, queues, swap chains, command buffers... It's all there.


  1. Directly quoted from the documentation. ↩︎