diff --git a/gpu/TODO-webgpu.h b/gpu/TODO-webgpu.h index 12b7730c..efde2264 100644 --- a/gpu/TODO-webgpu.h +++ b/gpu/TODO-webgpu.h @@ -10,10 +10,6 @@ typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPU typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata); // 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); export fn wgpuAdapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool { assertDecl(Impl, "adapterHasFeature", fn (adapter: gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) bool); diff --git a/gpu/src/adapter.zig b/gpu/src/adapter.zig index 55edadae..683b17dc 100644 --- a/gpu/src/adapter.zig +++ b/gpu/src/adapter.zig @@ -19,6 +19,10 @@ pub const Adapter = *opaque { pub inline fn getLimits(adapter: Adapter, limits: *SupportedLimits) bool { return impl.adapterGetLimits(adapter, limits); } + + pub inline fn getProperties(adapter: Adapter, properties: *AdapterProperties) void { + impl.adapterGetProperties(adapter, properties); + } }; pub const AdapterType = enum(u32) { diff --git a/gpu/src/interface.zig b/gpu/src/interface.zig index c4f6f9d5..71dde5e5 100644 --- a/gpu/src/interface.zig +++ b/gpu/src/interface.zig @@ -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, "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, "adapterGetProperties", fn (adapter: gpu.Adapter, properties: *gpu.AdapterProperties) callconv(.Inline) void); return Impl; } @@ -59,6 +60,11 @@ pub fn Export(comptime Impl: type) type { export fn wgpuAdapterGetLimits(adapter: gpu.Adapter, limits: *gpu.SupportedLimits) bool { 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; return false; } + pub inline fn adapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void { + _ = adapter; + _ = properties; + } }); test "null" {