gpu: convert *opaque -> opaque for Adapter
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
41fe42e366
commit
eb646e6f43
3 changed files with 35 additions and 35 deletions
|
|
@ -7,37 +7,37 @@ const SupportedLimits = @import("types.zig").SupportedLimits;
|
|||
const RequestDeviceStatus = @import("types.zig").RequestDeviceStatus;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
pub const Adapter = *opaque {
|
||||
pub inline fn createDevice(adapter: Adapter, descriptor: ?*const DeviceDescriptor) ?Device {
|
||||
return Impl.createDevice(adapter, descriptor);
|
||||
pub const Adapter = opaque {
|
||||
pub inline fn createDevice(adapter: *Adapter, descriptor: ?*const DeviceDescriptor) ?Device {
|
||||
return Impl.adapterCreateDevice(adapter, descriptor);
|
||||
}
|
||||
|
||||
/// Call once with null to determine the array length, and again to fetch the feature list.
|
||||
pub inline fn enumerateFeatures(adapter: Adapter, features: ?[*]FeatureName) usize {
|
||||
pub inline fn enumerateFeatures(adapter: *Adapter, features: ?[*]FeatureName) usize {
|
||||
return Impl.adapterEnumerateFeatures(adapter, features);
|
||||
}
|
||||
|
||||
pub inline fn getLimits(adapter: Adapter, limits: *SupportedLimits) bool {
|
||||
pub inline fn getLimits(adapter: *Adapter, limits: *SupportedLimits) bool {
|
||||
return Impl.adapterGetLimits(adapter, limits);
|
||||
}
|
||||
|
||||
pub inline fn getProperties(adapter: Adapter, properties: *AdapterProperties) void {
|
||||
pub inline fn getProperties(adapter: *Adapter, properties: *AdapterProperties) void {
|
||||
Impl.adapterGetProperties(adapter, properties);
|
||||
}
|
||||
|
||||
pub inline fn hasFeature(adapter: Adapter, feature: FeatureName) bool {
|
||||
pub inline fn hasFeature(adapter: *Adapter, feature: FeatureName) bool {
|
||||
return Impl.adapterHasFeature(adapter, feature);
|
||||
}
|
||||
|
||||
pub inline fn requestDevice(adapter: Adapter, descriptor: ?*const DeviceDescriptor, callback: RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
pub inline fn requestDevice(adapter: *Adapter, descriptor: ?*const DeviceDescriptor, callback: RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
Impl.adapterRequestDevice(adapter, descriptor, callback, userdata);
|
||||
}
|
||||
|
||||
pub inline fn reference(adapter: Adapter) void {
|
||||
pub inline fn reference(adapter: *Adapter) void {
|
||||
Impl.adapterReference(adapter);
|
||||
}
|
||||
|
||||
pub inline fn release(adapter: Adapter) void {
|
||||
pub inline fn release(adapter: *Adapter) void {
|
||||
Impl.adapterRelease(adapter);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub const Instance = *opaque {
|
|||
|
||||
pub const RequestAdapterCallback = fn (
|
||||
status: RequestAdapterStatus,
|
||||
adapter: Adapter,
|
||||
adapter: *Adapter,
|
||||
message: ?[*:0]const u8,
|
||||
userdata: *anyopaque,
|
||||
) callconv(.C) void;
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ pub const Impl = blk: {
|
|||
pub fn Interface(comptime T: type) type {
|
||||
assertDecl(T, "createInstance", fn (descriptor: ?*const InstanceDescriptor) callconv(.Inline) ?Instance);
|
||||
assertDecl(T, "getProcAddress", fn (device: gpu.Device, proc_name: [*:0]const u8) callconv(.Inline) ?gpu.Proc);
|
||||
assertDecl(T, "adapterCreateDevice", fn (adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) callconv(.Inline) ?gpu.Device);
|
||||
assertDecl(T, "adapterEnumerateFeatures", fn (adapter: gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
||||
assertDecl(T, "adapterGetLimits", fn (adapter: gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) bool);
|
||||
assertDecl(T, "adapterGetProperties", fn (adapter: gpu.Adapter, properties: *gpu.AdapterProperties) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterHasFeature", fn (adapter: gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) bool);
|
||||
assertDecl(T, "adapterRequestDevice", fn (adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterReference", fn (adapter: gpu.Adapter) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterRelease", fn (adapter: gpu.Adapter) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterCreateDevice", fn (adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) callconv(.Inline) ?gpu.Device);
|
||||
assertDecl(T, "adapterEnumerateFeatures", fn (adapter: *gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
||||
assertDecl(T, "adapterGetLimits", fn (adapter: *gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) bool);
|
||||
assertDecl(T, "adapterGetProperties", fn (adapter: *gpu.Adapter, properties: *gpu.AdapterProperties) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterHasFeature", fn (adapter: *gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) bool);
|
||||
assertDecl(T, "adapterRequestDevice", fn (adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterReference", fn (adapter: *gpu.Adapter) callconv(.Inline) void);
|
||||
assertDecl(T, "adapterRelease", fn (adapter: *gpu.Adapter) callconv(.Inline) void);
|
||||
assertDecl(T, "bindGroupSetLabel", fn (bind_group: gpu.BindGroup, label: [*:0]const u8) callconv(.Inline) void);
|
||||
assertDecl(T, "bindGroupReference", fn (bind_group: gpu.BindGroup) callconv(.Inline) void);
|
||||
assertDecl(T, "bindGroupRelease", fn (bind_group: gpu.BindGroup) callconv(.Inline) void);
|
||||
|
|
@ -238,43 +238,43 @@ pub fn Export(comptime T: type) type {
|
|||
}
|
||||
|
||||
// WGPU_EXPORT WGPUDevice wgpuAdapterCreateDevice(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor /* nullable */);
|
||||
export fn wgpuAdapterCreateDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) ?gpu.Device {
|
||||
export fn wgpuAdapterCreateDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) ?gpu.Device {
|
||||
return T.adapterCreateDevice(adapter, descriptor);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features);
|
||||
export fn wgpuAdapterEnumerateFeatures(adapter: gpu.Adapter, features: ?[*]gpu.FeatureName) usize {
|
||||
export fn wgpuAdapterEnumerateFeatures(adapter: *gpu.Adapter, features: ?[*]gpu.FeatureName) usize {
|
||||
return T.adapterEnumerateFeatures(adapter, features);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits);
|
||||
export fn wgpuAdapterGetLimits(adapter: gpu.Adapter, limits: *gpu.SupportedLimits) bool {
|
||||
export fn wgpuAdapterGetLimits(adapter: *gpu.Adapter, limits: *gpu.SupportedLimits) bool {
|
||||
return T.adapterGetLimits(adapter, limits);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties);
|
||||
export fn wgpuAdapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||
export fn wgpuAdapterGetProperties(adapter: *gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||
return T.adapterGetProperties(adapter, properties);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return T.adapterHasFeature(adapter, feature);
|
||||
}
|
||||
|
||||
// NOTE: descriptor is nullable, see https://bugs.chromium.org/p/dawn/issues/detail?id=1502
|
||||
// WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata);
|
||||
export fn wgpuAdapterRequestDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
export fn wgpuAdapterRequestDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
T.adapterRequestDevice(adapter, descriptor, callback, userdata);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter);
|
||||
export fn wgpuAdapterReference(adapter: gpu.Adapter) void {
|
||||
export fn wgpuAdapterReference(adapter: *gpu.Adapter) void {
|
||||
T.adapterReference(adapter);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter);
|
||||
export fn wgpuAdapterRelease(adapter: gpu.Adapter) void {
|
||||
export fn wgpuAdapterRelease(adapter: *gpu.Adapter) void {
|
||||
T.adapterRelease(adapter);
|
||||
}
|
||||
|
||||
|
|
@ -1232,37 +1232,37 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterCreateDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) ?gpu.Device {
|
||||
pub inline fn adapterCreateDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) ?gpu.Device {
|
||||
_ = adapter;
|
||||
_ = descriptor;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterEnumerateFeatures(adapter: gpu.Adapter, features: ?[*]gpu.FeatureName) usize {
|
||||
pub inline fn adapterEnumerateFeatures(adapter: *gpu.Adapter, features: ?[*]gpu.FeatureName) usize {
|
||||
_ = adapter;
|
||||
_ = features;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterGetLimits(adapter: gpu.Adapter, limits: *gpu.SupportedLimits) bool {
|
||||
pub inline fn adapterGetLimits(adapter: *gpu.Adapter, limits: *gpu.SupportedLimits) bool {
|
||||
_ = adapter;
|
||||
_ = limits;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterGetProperties(adapter: gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||
pub inline fn adapterGetProperties(adapter: *gpu.Adapter, properties: *gpu.AdapterProperties) void {
|
||||
_ = adapter;
|
||||
_ = properties;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterHasFeature(adapter: gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||
pub inline fn adapterHasFeature(adapter: *gpu.Adapter, feature: gpu.FeatureName) bool {
|
||||
_ = adapter;
|
||||
_ = feature;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterRequestDevice(adapter: gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
pub inline fn adapterRequestDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor, callback: gpu.RequestDeviceCallback, userdata: *anyopaque) void {
|
||||
_ = adapter;
|
||||
_ = descriptor;
|
||||
_ = callback;
|
||||
|
|
@ -1270,12 +1270,12 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterReference(adapter: gpu.Adapter) void {
|
||||
pub inline fn adapterReference(adapter: *gpu.Adapter) void {
|
||||
_ = adapter;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn adapterRelease(adapter: gpu.Adapter) void {
|
||||
pub inline fn adapterRelease(adapter: *gpu.Adapter) void {
|
||||
_ = adapter;
|
||||
unreachable;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue