gpu: make Device.createRenderPipelineAsync friendlier
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
a452d03589
commit
2e611565b4
1 changed files with 25 additions and 4 deletions
|
|
@ -75,7 +75,7 @@ pub const Device = opaque {
|
|||
comptime Context: type,
|
||||
comptime callback: fn (
|
||||
status: CreatePipelineAsyncStatus,
|
||||
compute_pipeline: *ComputePipeline,'
|
||||
compute_pipeline: *ComputePipeline,
|
||||
message: [*:0]const u8,
|
||||
ctx: Context,
|
||||
) callconv(.Inline) void,
|
||||
|
|
@ -130,10 +130,31 @@ pub const Device = opaque {
|
|||
pub inline fn createRenderPipelineAsync(
|
||||
device: *Device,
|
||||
descriptor: *const RenderPipeline.Descriptor,
|
||||
callback: CreateRenderPipelineAsyncCallback,
|
||||
userdata: ?*anyopaque,
|
||||
comptime Context: type,
|
||||
comptime callback: fn (
|
||||
status: CreatePipelineAsyncStatus,
|
||||
pipeline: *RenderPipeline,
|
||||
message: [*:0]const u8,
|
||||
ctx: Context,
|
||||
) callconv(.Inline) void,
|
||||
context: Context,
|
||||
) void {
|
||||
Impl.deviceCreateRenderPipelineAsync(device, descriptor, callback, userdata);
|
||||
const Helper = struct {
|
||||
pub fn callback(
|
||||
status: CreatePipelineAsyncStatus,
|
||||
pipeline: *RenderPipeline,
|
||||
message: [*:0]const u8,
|
||||
userdata: ?*anyopaque,
|
||||
) callconv(.C) void {
|
||||
callback(
|
||||
status,
|
||||
pipeline,
|
||||
message,
|
||||
if (Context == void) {} else @ptrCast(Context, userdata),
|
||||
);
|
||||
}
|
||||
};
|
||||
Impl.deviceCreateRenderPipelineAsync(device, descriptor, Helper.callback, if (Context == void) null else context);
|
||||
}
|
||||
|
||||
pub inline fn createSampler(device: *Device, descriptor: ?*const Sampler.Descriptor) *Sampler {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue