gpu: add Adapter.hasFeature
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
c3af237271
commit
c9914d6d94
3 changed files with 17 additions and 5 deletions
|
|
@ -1,9 +1,5 @@
|
|||
// WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature);
|
||||
export fn wgpuAdapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||
|
||||
// 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 {
|
||||
|
||||
// WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter);
|
||||
export fn wgpuAdapterReference(adapter: gpu.Adapter) void {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ pub const Adapter = *opaque {
|
|||
pub inline fn getProperties(adapter: Adapter, properties: *AdapterProperties) void {
|
||||
impl.adapterGetProperties(adapter, properties);
|
||||
}
|
||||
|
||||
pub inline fn hasFeature(adapter: Adapter, feature: FeatureName) bool {
|
||||
return impl.adapterHasFeature(adapter, feature);
|
||||
}
|
||||
};
|
||||
|
||||
pub const RequestDeviceCallback = fn (
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub fn Interface(comptime Impl: type) type {
|
|||
assertDecl(Impl, "adapterEnumerateFeatures", fn (adapter: gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
||||
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, "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, "adapterReference", fn (adapter: gpu.Adapter) callconv(.Inline) void);
|
||||
// assertDecl(Impl, "adapterRelease", fn (adapter: gpu.Adapter) callconv(.Inline) void);
|
||||
|
|
@ -260,6 +260,11 @@ pub fn Export(comptime Impl: type) type {
|
|||
export fn wgpuAdapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||
return Impl.adapterGetProperties(adapter, properties);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature);
|
||||
export fn wgpuAdapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||
return Impl.adapterHasFeature(adapter, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -293,10 +298,17 @@ pub const NullInterface = Interface(struct {
|
|||
_ = limits;
|
||||
return false;
|
||||
}
|
||||
|
||||
pub inline fn adapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||
_ = adapter;
|
||||
_ = properties;
|
||||
}
|
||||
|
||||
pub inline fn adapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||
_ = adapter;
|
||||
_ = feature;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
test "null" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue