gpu: internalize ComputePipeline types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
85fbe41a86
commit
b5bf0da50d
3 changed files with 15 additions and 16 deletions
|
|
@ -5,6 +5,13 @@ const BindGroupLayout = @import("bind_group_layout.zig").BindGroupLayout;
|
|||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
pub const ComputePipeline = opaque {
|
||||
pub const Descriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
layout: ?*PipelineLayout,
|
||||
compute: ProgrammableStageDescriptor,
|
||||
};
|
||||
|
||||
pub inline fn getBindGroupLayout(compute_pipeline: *ComputePipeline, group_index: u32) *BindGroupLayout {
|
||||
return Impl.computePipelineGetBindGroupLayout(compute_pipeline, group_index);
|
||||
}
|
||||
|
|
@ -21,10 +28,3 @@ pub const ComputePipeline = opaque {
|
|||
Impl.computePipelineRelease(compute_pipeline);
|
||||
}
|
||||
};
|
||||
|
||||
pub const ComputePipelineDescriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
layout: ?*PipelineLayout,
|
||||
compute: ProgrammableStageDescriptor,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ const BindGroupLayout = @import("bind_group_layout.zig").BindGroupLayout;
|
|||
const Buffer = @import("buffer.zig").Buffer;
|
||||
const CommandEncoder = @import("command_encoder.zig").CommandEncoder;
|
||||
const ComputePipeline = @import("compute_pipeline.zig").ComputePipeline;
|
||||
const ComputePipelineDescriptor = @import("compute_pipeline.zig").ComputePipelineDescriptor;
|
||||
const ExternalTexture = @import("external_texture.zig").ExternalTexture;
|
||||
const ExternalTextureDescriptor = @import("external_texture.zig").ExternalTextureDescriptor;
|
||||
const PipelineLayout = @import("pipeline_layout.zig").PipelineLayout;
|
||||
|
|
@ -54,11 +53,11 @@ pub const Device = opaque {
|
|||
return Impl.deviceCreateCommandEncoder(device, descriptor);
|
||||
}
|
||||
|
||||
pub inline fn createComputePipeline(device: *Device, descriptor: *const ComputePipelineDescriptor) *ComputePipeline {
|
||||
pub inline fn createComputePipeline(device: *Device, descriptor: *const ComputePipeline.Descriptor) *ComputePipeline {
|
||||
return Impl.deviceCreateComputePipeline(device, descriptor);
|
||||
}
|
||||
|
||||
pub inline fn createComputePipelineAsync(device: *Device, descriptor: *const ComputePipelineDescriptor, callback: CreateComputePipelineAsyncCallback, userdata: *anyopaque) void {
|
||||
pub inline fn createComputePipelineAsync(device: *Device, descriptor: *const ComputePipeline.Descriptor, callback: CreateComputePipelineAsyncCallback, userdata: *anyopaque) void {
|
||||
Impl.deviceCreateComputePipelineAsync(device, descriptor, callback, userdata);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ pub fn Interface(comptime T: type) type {
|
|||
assertDecl(T, "deviceCreateBindGroupLayout", fn (device: *gpu.Device, descriptor: *const gpu.BindGroupLayout.Descriptor) callconv(.Inline) *gpu.BindGroupLayout);
|
||||
assertDecl(T, "deviceCreateBuffer", fn (device: *gpu.Device, descriptor: *const gpu.Buffer.Descriptor) callconv(.Inline) *gpu.Buffer);
|
||||
assertDecl(T, "deviceCreateCommandEncoder", fn (device: *gpu.Device, descriptor: ?*const gpu.CommandEncoder.Descriptor) callconv(.Inline) *gpu.CommandEncoder);
|
||||
assertDecl(T, "deviceCreateComputePipeline", fn (device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) callconv(.Inline) *gpu.ComputePipeline);
|
||||
assertDecl(T, "deviceCreateComputePipelineAsync", fn (device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "deviceCreateComputePipeline", fn (device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor) callconv(.Inline) *gpu.ComputePipeline);
|
||||
assertDecl(T, "deviceCreateComputePipelineAsync", fn (device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "deviceCreateErrorBuffer", fn (device: *gpu.Device) callconv(.Inline) *gpu.Buffer);
|
||||
assertDecl(T, "deviceCreateErrorExternalTexture", fn (device: *gpu.Device) callconv(.Inline) *gpu.ExternalTexture);
|
||||
assertDecl(T, "deviceCreateExternalTexture", fn (device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTextureDescriptor) callconv(.Inline) *gpu.ExternalTexture);
|
||||
|
|
@ -569,12 +569,12 @@ pub fn Export(comptime T: type) type {
|
|||
}
|
||||
|
||||
// WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor);
|
||||
export fn wgpuDeviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) *gpu.ComputePipeline {
|
||||
export fn wgpuDeviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor) *gpu.ComputePipeline {
|
||||
return T.deviceCreateComputePipeline(device, descriptor);
|
||||
}
|
||||
|
||||
// WGPU_EXPORT void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata);
|
||||
export fn wgpuDeviceCreateComputePipelineAsync(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) void {
|
||||
export fn wgpuDeviceCreateComputePipelineAsync(device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) void {
|
||||
T.deviceCreateComputePipelineAsync(device, descriptor, callback, userdata);
|
||||
}
|
||||
|
||||
|
|
@ -1641,13 +1641,13 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn deviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) *gpu.ComputePipeline {
|
||||
pub inline fn deviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor) *gpu.ComputePipeline {
|
||||
_ = device;
|
||||
_ = descriptor;
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn deviceCreateComputePipelineAsync(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) void {
|
||||
pub inline fn deviceCreateComputePipelineAsync(device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) void {
|
||||
_ = device;
|
||||
_ = descriptor;
|
||||
_ = callback;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue