gpu: add Adapter.getProperties
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
2b7241be0a
commit
6ea76e770f
3 changed files with 14 additions and 4 deletions
|
|
@ -10,10 +10,6 @@ typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPU
|
||||||
typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata);
|
typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata);
|
||||||
|
|
||||||
// Methods of Adapter
|
// Methods of Adapter
|
||||||
// WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties);
|
|
||||||
export fn wgpuAdapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
|
||||||
assertDecl(Impl, "adapterGetProperties", fn (adapter: gpu.Adapter, properties: *gpu.AdapterProperties) callconv(.Inline) void);
|
|
||||||
|
|
||||||
// WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature);
|
// WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature);
|
||||||
export fn wgpuAdapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
export fn wgpuAdapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||||
assertDecl(Impl, "adapterHasFeature", fn (adapter: gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) bool);
|
assertDecl(Impl, "adapterHasFeature", fn (adapter: gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) bool);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ pub const Adapter = *opaque {
|
||||||
pub inline fn getLimits(adapter: Adapter, limits: *SupportedLimits) bool {
|
pub inline fn getLimits(adapter: Adapter, limits: *SupportedLimits) bool {
|
||||||
return impl.adapterGetLimits(adapter, limits);
|
return impl.adapterGetLimits(adapter, limits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub inline fn getProperties(adapter: Adapter, properties: *AdapterProperties) void {
|
||||||
|
impl.adapterGetProperties(adapter, properties);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AdapterType = enum(u32) {
|
pub const AdapterType = enum(u32) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ pub fn Interface(comptime Impl: type) type {
|
||||||
assertDecl(Impl, "adapterCreateDevice", fn (adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) callconv(.Inline) ?gpu.Device);
|
assertDecl(Impl, "adapterCreateDevice", fn (adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) callconv(.Inline) ?gpu.Device);
|
||||||
assertDecl(Impl, "adapterEnumerateFeatures", fn (adapter: gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
assertDecl(Impl, "adapterEnumerateFeatures", fn (adapter: gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
||||||
assertDecl(Impl, "adapterGetLimits", fn (adapter: gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) bool);
|
assertDecl(Impl, "adapterGetLimits", fn (adapter: gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) bool);
|
||||||
|
assertDecl(Impl, "adapterGetProperties", fn (adapter: gpu.Adapter, properties: *gpu.AdapterProperties) callconv(.Inline) void);
|
||||||
return Impl;
|
return Impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,6 +60,11 @@ pub fn Export(comptime Impl: type) type {
|
||||||
export fn wgpuAdapterGetLimits(adapter: gpu.Adapter, limits: *gpu.SupportedLimits) bool {
|
export fn wgpuAdapterGetLimits(adapter: gpu.Adapter, limits: *gpu.SupportedLimits) bool {
|
||||||
return Impl.adapterGetLimits(adapter, limits);
|
return Impl.adapterGetLimits(adapter, limits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties);
|
||||||
|
export fn wgpuAdapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||||
|
return Impl.adapterGetProperties(adapter, properties);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,6 +98,10 @@ pub const NullInterface = Interface(struct {
|
||||||
_ = limits;
|
_ = limits;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
pub inline fn adapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||||
|
_ = adapter;
|
||||||
|
_ = properties;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test "null" {
|
test "null" {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue