gpu: implement Adapter.features, Adapter.limits
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
12a0772654
commit
667539c255
1 changed files with 8 additions and 8 deletions
|
|
@ -47,6 +47,7 @@ const IndexFormat = @import("enums.zig").IndexFormat;
|
||||||
const ErrorType = @import("enums.zig").ErrorType;
|
const ErrorType = @import("enums.zig").ErrorType;
|
||||||
const ErrorFilter = @import("enums.zig").ErrorFilter;
|
const ErrorFilter = @import("enums.zig").ErrorFilter;
|
||||||
const LoggingType = @import("enums.zig").LoggingType;
|
const LoggingType = @import("enums.zig").LoggingType;
|
||||||
|
const Feature = @import("enums.zig").Feature;
|
||||||
|
|
||||||
const ImageCopyBuffer = @import("structs.zig").ImageCopyBuffer;
|
const ImageCopyBuffer = @import("structs.zig").ImageCopyBuffer;
|
||||||
const ImageCopyTexture = @import("structs.zig").ImageCopyTexture;
|
const ImageCopyTexture = @import("structs.zig").ImageCopyTexture;
|
||||||
|
|
@ -224,16 +225,15 @@ fn wrapAdapter(adapter: c.WGPUAdapter) Adapter {
|
||||||
.backend_type = @intToEnum(Adapter.BackendType, c_props.backendType),
|
.backend_type = @intToEnum(Adapter.BackendType, c_props.backendType),
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: implement Adapter interface:
|
var features: [std.enums.values(Feature).len]c.WGPUFeatureName = undefined;
|
||||||
// WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeature * features);
|
const features_len = c.wgpuAdapterEnumerateFeatures(adapter.?, &features[0]);
|
||||||
// WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeature feature);
|
|
||||||
// WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits);
|
var supported_limits: c.WGPUSupportedLimits = undefined;
|
||||||
|
if (!c.wgpuAdapterGetLimits(adapter.?, &supported_limits)) @panic("failed to get adapter 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,
|
|
||||||
.properties = properties,
|
.properties = properties,
|
||||||
|
|
||||||
// TODO: why is fallback not queryable on Dawn?
|
// TODO: why is fallback not queryable on Dawn?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue