gpu: add Device.enumerateFeaturesOwned helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
94568052f5
commit
b369635193
2 changed files with 13 additions and 1 deletions
|
|
@ -181,10 +181,22 @@ pub const Device = opaque {
|
|||
Impl.deviceDestroy(device);
|
||||
}
|
||||
|
||||
/// Call once with null to determine the array length, and again to fetch the feature list.
|
||||
///
|
||||
/// Consider using the enumerateFeaturesOwned helper.
|
||||
pub inline fn enumerateFeatures(device: *Device, features: [*]FeatureName) usize {
|
||||
return Impl.deviceEnumerateFeatures(device, features);
|
||||
}
|
||||
|
||||
/// Enumerates the adapter features, storing the result in an allocated slice which is owned by
|
||||
/// the caller.
|
||||
pub inline fn enumerateFeaturesOwned(device: *Device, allocator: std.mem.Allocator) ![]FeatureName {
|
||||
const count = device.enumerateFeatures(null);
|
||||
var data = try allocator.alloc(FeatureName, count);
|
||||
_ = device.enumerateFeatures(data.ptr);
|
||||
return data;
|
||||
}
|
||||
|
||||
pub inline fn getLimits(device: *Device, limits: *SupportedLimits) bool {
|
||||
return Impl.deviceGetLimits(device, limits);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue