gpu: implement Device.hasFeature
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
37d8113e24
commit
12a0772654
1 changed files with 8 additions and 2 deletions
|
|
@ -73,8 +73,6 @@ pub const VTable = struct {
|
||||||
createTexture: fn (ptr: *anyopaque, descriptor: *const Texture.Descriptor) Texture,
|
createTexture: fn (ptr: *anyopaque, descriptor: *const Texture.Descriptor) Texture,
|
||||||
destroy: fn (ptr: *anyopaque) void,
|
destroy: fn (ptr: *anyopaque) void,
|
||||||
getQueue: fn (ptr: *anyopaque) Queue,
|
getQueue: fn (ptr: *anyopaque) Queue,
|
||||||
// TODO: should hasFeature be a helper method?
|
|
||||||
// WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeature feature);
|
|
||||||
injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
|
injectError: fn (ptr: *anyopaque, type: ErrorType, message: [*:0]const u8) void,
|
||||||
loseForTesting: fn (ptr: *anyopaque) void,
|
loseForTesting: fn (ptr: *anyopaque) void,
|
||||||
popErrorScope: fn (ptr: *anyopaque, callback: *ErrorCallback) bool,
|
popErrorScope: fn (ptr: *anyopaque, callback: *ErrorCallback) bool,
|
||||||
|
|
@ -93,6 +91,14 @@ pub inline fn release(device: Device) void {
|
||||||
device.vtable.release(device.ptr);
|
device.vtable.release(device.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tests of the device has this feature & was created with it.
|
||||||
|
pub fn hasFeature(device: Device, feature: Feature) bool {
|
||||||
|
for (device.features) |f| {
|
||||||
|
if (f == feature) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pub inline fn getQueue(device: Device) Queue {
|
pub inline fn getQueue(device: Device) Queue {
|
||||||
return device.vtable.getQueue(device.ptr);
|
return device.vtable.getQueue(device.ptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue