-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Has there been a position stated about where the webgpu.h should be expected wrt. include paths?
The reason I ask is with regards to the generation/specification of extension headers and in particular the way they should include webgpu.h, as well as questions that arise when sharing code without imposing a build systems (e.g., in Dear ImGui's wgpu backend).
Some elements I could find in practice:
- Currently, our generator adds
#include "webgpu.h"when generating extensions, which implies that eithermy_webgpu_extension.hsits in the very same directory aswebgpu.hor this directory is in the include paths. But this has not been tested much and is probably still open to evolution? - Dawn places its generated header in
webgpu/webgpu.hand tends to#include <webgpu/webgpu.h>in examples. - Same for emscripten
- The question came up in
wgpu-native, especially because its is the only implementation that already adopted the dual header scheme (i.e. a separate file for implem-specific extensions), and there was no strong opinion, but it settled for some convenience reason on using#include "webgpu.h"inwgpu.hand placing it in the very same directory aswebgpu.h. Both are in a directory called "webgpu" as well. - After some thought about it in early its developments, I adopted
#include <webgpu/webgpu.h>for my programming guide and the associated code because it felt compatible with most examples I could find (and I liked thewebgpu/prefix to regroup potential extensions like c++ wrapper, etc.).
Since all implementation indeed distribute webgpu.h in a directory called "webgpu", should we (a) explicitly state that the preferred way to include the WebGPU native header is through webgpu/webgpu.h and (b) have extension header use #include <webgpu/webgpu.h> in case they are distributed through a different directory?
For some reason my intuition tells me that (a) is a yes and (b) is a no, but feel free to prove me wrong :D
Some other examples:
gpu.cppuses#include "webgpu/webgpu.h"- Another example uses
#include "webgpu.h"