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 Context: type,
|
||||||
comptime callback: fn (
|
comptime callback: fn (
|
||||||
status: CreatePipelineAsyncStatus,
|
status: CreatePipelineAsyncStatus,
|
||||||
compute_pipeline: *ComputePipeline,'
|
compute_pipeline: *ComputePipeline,
|
||||||
message: [*:0]const u8,
|
message: [*:0]const u8,
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
) callconv(.Inline) void,
|
) callconv(.Inline) void,
|
||||||
|
|
@ -130,10 +130,31 @@ pub const Device = opaque {
|
||||||
pub inline fn createRenderPipelineAsync(
|
pub inline fn createRenderPipelineAsync(
|
||||||
device: *Device,
|
device: *Device,
|
||||||
descriptor: *const RenderPipeline.Descriptor,
|
descriptor: *const RenderPipeline.Descriptor,
|
||||||
callback: CreateRenderPipelineAsyncCallback,
|
comptime Context: type,
|
||||||
userdata: ?*anyopaque,
|
comptime callback: fn (
|
||||||
|
status: CreatePipelineAsyncStatus,
|
||||||
|
pipeline: *RenderPipeline,
|
||||||
|
message: [*:0]const u8,
|
||||||
|
ctx: Context,
|
||||||
|
) callconv(.Inline) void,
|
||||||
|
context: Context,
|
||||||
) void {
|
) 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 {
|
pub inline fn createSampler(device: *Device, descriptor: ?*const Sampler.Descriptor) *Sampler {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue