gpu: document implementation initialization

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-30 22:19:21 -07:00 committed by Stephen Gutekanst
parent 34c2590d18
commit 96221fa13e
2 changed files with 4 additions and 0 deletions

View file

@ -8,6 +8,8 @@ const c = @cImport({
var procs: c.DawnProcTable = undefined;
/// A Dawn implementation of the gpu.Interface, which merely directs calls to the Dawn proc table.
///
/// Before use, it must be `.init()`ialized in order to set the global proc table.
pub const Interface = gpu.Interface(struct {
pub fn init() @This() {
procs = c.machDawnGetProcTable();

View file

@ -2,6 +2,8 @@ const gpu = @import("main.zig");
/// The gpu.Interface implementation that is used by the entire program. Only one may exist, since
/// it is resolved fully at comptime with no vtable indirection, etc.
///
/// Depending on the implementation, it may need to be `.init()`ialized before use.
pub const Impl = blk: {
if (@import("builtin").is_test) {
break :blk StubInterface;