How would you create compute shader tasks that are not dispatched from render_graph::Node? Is this a good idea?
#21872
Unanswered
l-monninger
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I've been struggling to set up a GPU compute task pipeline which I would prefer to manage outside of the render graph. Namely, I'm running to:
ComputePipelinestatus is foreverQueued.add_compute_render_graph_node, or if this was merely used for this particular example.Ideally, this would allow for a high-level request-response, form to the pipeline runs.
Note
I've taken a look at the GOL and GPU Readback examples. Both seem to be a bit more tightly coupled with the render graph than I was initially hoping.
My failed approach
Roughly what I wanted to do is be able to call a
dispatchmethod on a pipeline imperatively like the below, handling when to dispatch and when to read read back myself and mostly outside of then Bevy scheduler.To do this, I wrote systems to queue the pipelines and then to fill a resource
MarchingCubesPipelineswith the neededComputePipelineswhen they are ready.At the type-level, this checks out. But, I've tried several variations of the setup scheduling and my pipelines are always
Queued.What I may do next
Even though it would be nice to really understand what is keeping the pipelines
Queuedand try to work towards my initial goal. I'm about to go for a pattern wherein I try to copy the example pattern withrender_graph::Nodeand enqueue requests to the pipeline on the world object.I think I'm going to have do something like this wherein I despawn the resource constituting a request on the GPU readback, thus completing the request for the task:
commands .spawn(Readback::buffer(buffer.clone())) .observe(|event: On<ReadbackComplete>| { // This matches the type which was used to create the `ShaderStorageBuffer` above, // and is a convenient way to interpret the data. let data: Vec<u32> = event.to_shader_type(); info!("Buffer {:?}", data); // despawn resource constituting "request" for GPU pipeline run or something similar });To me it seems like this would be overkill for a lot of compute tasks that don't need to be synchronized in some way with the frame rendering. But, perhaps, GPU exclusivity is bearing here.
Questions
ComputePipelinesbe whenever I try to access them?render_graph::Nodefundamentally unsafe?Beta Was this translation helpful? Give feedback.
All reactions