gpu: add Adapter.requestDevice
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
f152d9983a
commit
6d954555fb
3 changed files with 18 additions and 16 deletions
|
|
@ -1,18 +1,3 @@
|
|||
// NOTE: descriptor is nullable, see https://bugs.chromium.org/p/dawn/issues/detail?id=1502
|
||||
// WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata);
|
||||
export fn wgpuAdapterRequestDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
impl.adapterRequestDevice(adapter, descriptor, callback, userdata);
|
||||
}
|
||||
pub inline fn adapterRequestDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
_ = adapter;
|
||||
_ = descriptor;
|
||||
_ = callback;
|
||||
_ = userdata;
|
||||
}
|
||||
pub inline fn requestDevice(adapter: Adapter, descriptor: ?*const DeviceDescriptor, callback: RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
impl.adapterRequestDevice(adapter, descriptor, callback, userdata);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter);
|
||||
export fn wgpuAdapterReference(adapter: gpu.Adapter) void {
|
||||
impl.adapterReference(adapter);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ pub const Adapter = *opaque {
|
|||
pub inline fn hasFeature(adapter: Adapter, feature: FeatureName) bool {
|
||||
return impl.adapterHasFeature(adapter, feature);
|
||||
}
|
||||
|
||||
pub inline fn requestDevice(adapter: Adapter, descriptor: ?*const DeviceDescriptor, callback: RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
impl.adapterRequestDevice(adapter, descriptor, callback, userdata);
|
||||
}
|
||||
};
|
||||
|
||||
pub const RequestDeviceCallback = fn (
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn Interface(comptime Impl: type) type {
|
|||
assertDecl(Impl, "adapterGetLimits", fn (adapter: gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) bool);
|
||||
assertDecl(Impl, "adapterGetProperties", fn (adapter: gpu.Adapter, properties: *gpu.AdapterProperties) callconv(.Inline) void);
|
||||
assertDecl(Impl, "adapterHasFeature", fn (adapter: gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) bool);
|
||||
// assertDecl(Impl, "adapterRequestDevice", fn (adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(Impl, "adapterRequestDevice", fn (adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
// assertDecl(Impl, "adapterReference", fn (adapter: gpu.Adapter) callconv(.Inline) void);
|
||||
// assertDecl(Impl, "adapterRelease", fn (adapter: gpu.Adapter) callconv(.Inline) void);
|
||||
// assertDecl(Impl, "bindGroupSetLabel", fn (bind_group: gpu.BindGroup, label: [*:0]const u8) callconv(.Inline) void);
|
||||
|
|
@ -265,6 +265,12 @@ pub fn Export(comptime Impl: type) type {
|
|||
export fn wgpuAdapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||
return Impl.adapterHasFeature(adapter, feature);
|
||||
}
|
||||
|
||||
// NOTE: descriptor is nullable, see https://bugs.chromium.org/p/dawn/issues/detail?id=1502
|
||||
// WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata);
|
||||
export fn wgpuAdapterRequestDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
Impl.adapterRequestDevice(adapter, descriptor, callback, userdata);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -309,6 +315,13 @@ pub const NullInterface = Interface(struct {
|
|||
_ = feature;
|
||||
return false;
|
||||
}
|
||||
|
||||
pub inline fn adapterRequestDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
_ = adapter;
|
||||
_ = descriptor;
|
||||
_ = callback;
|
||||
_ = userdata;
|
||||
}
|
||||
});
|
||||
|
||||
test "null" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue