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
|
|
@ -155,6 +155,7 @@ The slice helpers are:
|
||||||
* `Buffer.getConstMappedRange`
|
* `Buffer.getConstMappedRange`
|
||||||
* `Buffer.getMappedRange`
|
* `Buffer.getMappedRange`
|
||||||
* `CommandEncoder.writeBuffer`
|
* `CommandEncoder.writeBuffer`
|
||||||
|
* `Device.enumerateFeaturesOwned`
|
||||||
* `Queue.writeTexture`
|
* `Queue.writeTexture`
|
||||||
* `Queue.writeBuffer`
|
* `Queue.writeBuffer`
|
||||||
* `RenderPassEncoder.executeBundles`
|
* `RenderPassEncoder.executeBundles`
|
||||||
|
|
@ -220,7 +221,6 @@ There may be other opportunities for helpers, to improve the existing APIs, or a
|
||||||
The following are definitive candidates for helpers we haven't implemented yet:
|
The following are definitive candidates for helpers we haven't implemented yet:
|
||||||
|
|
||||||
* `gpu.ComputePassEncoder.setBindGroup` (slice param)
|
* `gpu.ComputePassEncoder.setBindGroup` (slice param)
|
||||||
* `gpu.Device.enumerateFeatures` (owned slice)
|
|
||||||
* `gpu.RenderBundleEncoder.setBindGroup` (slice param)
|
* `gpu.RenderBundleEncoder.setBindGroup` (slice param)
|
||||||
* `gpu.RenderPassEncoder.setBindGroup` (slice param)
|
* `gpu.RenderPassEncoder.setBindGroup` (slice param)
|
||||||
* Other `next_in_chain` extensions (look at dawn.json after the bug to get this documented was fixed)
|
* Other `next_in_chain` extensions (look at dawn.json after the bug to get this documented was fixed)
|
||||||
|
|
|
||||||
|
|
@ -181,10 +181,22 @@ pub const Device = opaque {
|
||||||
Impl.deviceDestroy(device);
|
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 {
|
pub inline fn enumerateFeatures(device: *Device, features: [*]FeatureName) usize {
|
||||||
return Impl.deviceEnumerateFeatures(device, features);
|
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 {
|
pub inline fn getLimits(device: *Device, limits: *SupportedLimits) bool {
|
||||||
return Impl.deviceGetLimits(device, limits);
|
return Impl.deviceGetLimits(device, limits);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue