Search code examples
webgpuwgpu-rs

WGPU - Rust or С/C++?


Please explain about the Wgpu library:https://github.com/gfx-rs/wgpu

The page says:

To use wgpu in C/C++, you need wgpu-native.

wgpu-native:https://github.com/gfx-rs/wgpu-native

I go to the wgpu-native github page, so it says that:

This is a native WebGPU implementation in Rust, based on wgpu-core.

Something I got confused - they write about C/C ++, and when you go to the page - they write again about Rust.


Solution

  • wgpu itself is written in Rust and can be used as a rust crate / library.

    However there are C / C++ - Bindings to wgpu, which are published as wgpu-native. wgpu-native itself is also written in rust, but it exposes a C interface which allows this library to be integrated in a variety of other programming languages using FFI.

    Additional information about how a rust library can expose C-Bindings is for example given in this article.