gpu: remove Queue.WorkDownCallback lifetime footgun
The previous implementation required the specific Queue struct that submit() was called on to be valid when the callback is triggered. By storing a pointer instead, the Queue does not need to be valid, only the callback itself.
This commit is contained in:
parent
7bb877bd55
commit
134c2019b1
2 changed files with 5 additions and 2 deletions
|
|
@ -902,7 +902,7 @@ const queue_vtable = Queue.VTable{
|
|||
wgpu_queue,
|
||||
signal_value,
|
||||
cCallback,
|
||||
&queue.on_submitted_work_done,
|
||||
queue.on_submitted_work_done,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ const Texture = @import("Texture.zig");
|
|||
|
||||
const Queue = @This();
|
||||
|
||||
on_submitted_work_done: ?WorkDoneCallback = null,
|
||||
/// Callback to executed when all work has been done
|
||||
/// This field must be set before calling `submit()` on the commands the callback waits for.
|
||||
/// Note that the address stored must be valid when the callback is executed.
|
||||
on_submitted_work_done: ?*WorkDoneCallback = null,
|
||||
|
||||
/// The type erased pointer to the Queue implementation
|
||||
/// Equal to c.WGPUQueue for NativeInstance.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue