gpu: implement Device.features, Device.limits
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
667539c255
commit
653c528441
1 changed files with 7 additions and 7 deletions
|
|
@ -303,15 +303,15 @@ const adapter_vtable = Adapter.VTable{
|
||||||
};
|
};
|
||||||
|
|
||||||
fn wrapDevice(device: c.WGPUDevice) Device {
|
fn wrapDevice(device: c.WGPUDevice) Device {
|
||||||
// TODO: implement Device interface
|
var features: [std.enums.values(Feature).len]c.WGPUFeatureName = undefined;
|
||||||
// WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeature * features);
|
const features_len = c.wgpuDeviceEnumerateFeatures(device.?, &features[0]);
|
||||||
// WGPU_EXPORT bool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits);
|
|
||||||
|
var supported_limits: c.WGPUSupportedLimits = undefined;
|
||||||
|
if (!c.wgpuDeviceGetLimits(device.?, &supported_limits)) @panic("failed to get device limits (this is a bug in mach/gpu)");
|
||||||
|
|
||||||
return .{
|
return .{
|
||||||
// TODO:
|
.features = @bitCast([]Feature, features[0..features_len]),
|
||||||
.features = undefined,
|
.limits = @bitCast(Limits, supported_limits.limits),
|
||||||
// TODO:
|
|
||||||
.limits = undefined,
|
|
||||||
.ptr = device.?,
|
.ptr = device.?,
|
||||||
.vtable = &device_vtable,
|
.vtable = &device_vtable,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue