gpu: rename NullInterface -> StubInterface

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-25 22:47:14 -07:00 committed by Stephen Gutekanst
parent 0b63b6a41b
commit 898963619b

View file

@ -6,7 +6,7 @@ const gpu = @import("main.zig");
/// it is resolved fully at comptime with no vtable indirection, etc. /// it is resolved fully at comptime with no vtable indirection, etc.
pub const impl = blk: { pub const impl = blk: {
if (@import("builtin").is_test) { if (@import("builtin").is_test) {
break :blk NullInterface{}; break :blk StubInterface{};
} else { } else {
const root = @import("root"); const root = @import("root");
if (!@hasField(root, "gpu_interface")) @compileError("expected to find `pub const gpu_interface: gpu.Interface(T) = T{};` in root file"); if (!@hasField(root, "gpu_interface")) @compileError("expected to find `pub const gpu_interface: gpu.Interface(T) = T{};` in root file");
@ -1048,8 +1048,8 @@ pub fn Export(comptime Impl: type) type {
}; };
} }
/// A no-operation gpu.Interface implementation. /// A stub gpu.Interface in which every function is implemented by `unreachable;`
pub const NullInterface = Interface(struct { pub const StubInterface = Interface(struct {
pub inline fn createInstance(descriptor: *const InstanceDescriptor) ?Instance { pub inline fn createInstance(descriptor: *const InstanceDescriptor) ?Instance {
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -2291,6 +2291,6 @@ pub const NullInterface = Interface(struct {
} }
}); });
test "null" { test "stub" {
_ = Export(NullInterface); _ = Export(StubInterface);
} }