gpu: correct sending of pointer to a local var to a callback function (#271)
This commit is contained in:
parent
a1daf399a3
commit
5a2aebb14b
2 changed files with 10 additions and 6 deletions
|
|
@ -879,10 +879,10 @@ const queue_vtable = Queue.VTable{
|
||||||
}
|
}
|
||||||
}).release,
|
}).release,
|
||||||
.submit = (struct {
|
.submit = (struct {
|
||||||
pub fn submit(queue: Queue, cmds: []const CommandBuffer) void {
|
pub fn submit(queue: *Queue, cmds: []const CommandBuffer) void {
|
||||||
const wgpu_queue = @ptrCast(c.WGPUQueue, queue.ptr);
|
const wgpu_queue = @ptrCast(c.WGPUQueue, queue.ptr);
|
||||||
|
|
||||||
if (queue.on_submitted_work_done) |on_submitted_work_done| {
|
if (queue.on_submitted_work_done) |_| {
|
||||||
// Note: signalValue is not available in the web API, and it's usage is undocumented
|
// Note: signalValue is not available in the web API, and it's usage is undocumented
|
||||||
// kainino says "It's basically reserved for future use, though it's been suggested
|
// kainino says "It's basically reserved for future use, though it's been suggested
|
||||||
// to remove it instead"
|
// to remove it instead"
|
||||||
|
|
@ -898,8 +898,12 @@ const queue_vtable = Queue.VTable{
|
||||||
}
|
}
|
||||||
}).cCallback;
|
}).cCallback;
|
||||||
|
|
||||||
var mut_on_submitted_work_done = on_submitted_work_done;
|
c.wgpuQueueOnSubmittedWorkDone(
|
||||||
c.wgpuQueueOnSubmittedWorkDone(wgpu_queue, signal_value, cCallback, &mut_on_submitted_work_done);
|
wgpu_queue,
|
||||||
|
signal_value,
|
||||||
|
cCallback,
|
||||||
|
&queue.on_submitted_work_done,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var few_commands: [16]c.WGPUCommandBuffer = undefined;
|
var few_commands: [16]c.WGPUCommandBuffer = undefined;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ pub const VTable = struct {
|
||||||
release: fn (ptr: *anyopaque) void,
|
release: fn (ptr: *anyopaque) void,
|
||||||
// TODO: dawn specific?
|
// TODO: dawn specific?
|
||||||
// copyTextureForBrowser: fn (ptr: *anyopaque, source: *const ImageCopyTexture, destination: *const ImageCopyTexture, copy_size: *const Extent3D, options: *const CopyTextureForBrowserOptions) void,
|
// copyTextureForBrowser: fn (ptr: *anyopaque, source: *const ImageCopyTexture, destination: *const ImageCopyTexture, copy_size: *const Extent3D, options: *const CopyTextureForBrowserOptions) void,
|
||||||
submit: fn (queue: Queue, commands: []const CommandBuffer) void,
|
submit: fn (queue: *Queue, commands: []const CommandBuffer) void,
|
||||||
writeBuffer: fn (
|
writeBuffer: fn (
|
||||||
ptr: *anyopaque,
|
ptr: *anyopaque,
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
|
|
@ -46,7 +46,7 @@ pub inline fn release(queue: Queue) void {
|
||||||
queue.vtable.release(queue.ptr);
|
queue.vtable.release(queue.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn submit(queue: Queue, commands: []const CommandBuffer) void {
|
pub inline fn submit(queue: *Queue, commands: []const CommandBuffer) void {
|
||||||
queue.vtable.submit(queue, commands);
|
queue.vtable.submit(queue, commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue