gpu: README: explain internalized types

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-30 00:18:15 -07:00 committed by Stephen Gutekanst
parent ceb6c2b41b
commit fa96792168

View file

@ -106,9 +106,9 @@ When updating, every single change is verified against [the WebGPU spec itself](
The rules for translating `webgpu.h` are as follows: The rules for translating `webgpu.h` are as follows:
* `WGPUBuffer` -> `gpu.Buffer`: * `WGPUBuffer` -> `gpu.Buffer`:
* Handles like these become a `pub const Buffer = *opaque {_}` to ensure they are still pointers compatible with the C ABI, while still allowing us to declare methods on them. * Opaque pointers like these become a `pub const Buffer = opaque {_}` to ensure they are still pointers compatible with the C ABI, while still allowing us to declare methods on them.
* As a result, `null`able `Buffer` is represented simply as `?Buffer` * As a result, a `null`able `Buffer` is represented simply as `?*Buffer`, and any function that would normally take `WGPUBuffer` now takes `*Buffer` as a parameter.
* `WGPUBufferBindingType` -> `gpu.BufferBindingType` (purely because it's prefix matches an opaque pointer type, it thus goes into the `buffer.zig` file.) * `WGPUBufferBindingType` -> `gpu.Buffer.BindingType` (purely because it's prefix matches an opaque pointer type, it thus goes into the `Buffer` opaque type.)
* Reserved Zig keywords are translated as follows: * Reserved Zig keywords are translated as follows:
* `undefined` -> `undef` * `undefined` -> `undef`
* `null` -> `nul` * `null` -> `nul`