#compute shader bind group to pass settings to gpu

11 messages · Page 1 of 1 (latest)

fading wren
#

hi! i'm struggling pretty hard here to send a struct to the gpu via a compute shader. what i've tried

  1. i got the compute shader game of life example working
  2. i tried following this tutorial https://www.youtube.com/watch?v=bUH4EF9y3O8 to pass the game timer to the gpu. it's outdated so i couldn't follow it though
  3. i tried comparing to the post processing shader example but that is too different from what i am trying to do since it uses post processing pipeline.
  4. i tried searching on github for an example of someone using a compute shader and passing data to it through a custom bind group. no luck

it seems this part of the codebase has been changing often and i'm really in need of a single example that sends custom data via a bind group to the gpu. the post-processing example has a settings struct which is my goal but i'm not able to follow that for a main pipleline example. i think my best path here is to follow this as closeley as i can and rewrite it for the main pipeline instead of post processing, but i just don't know what i'm doing.

if anyone has an example to point me to where someone is using a wgsl compute shader and sending a custom settings bind group too it that anyone knows about please let me know. this is too complicated without documentation for me to figure out. i'm not sure why i'm having so much trouble finding anyone on github doing this, it seems like it should be a very common need. appreciated

fluid harness
#

What do you have so far? The post processing example is basically what you want to do, just using a compute pipeline instead of a render pipeline, and not needing ViewTarget::post_process_write().

fading wren
#

thanks, i tried converting the post processing example a second time, but it's just too high over my head. there too much of "normally you'd do x, but since this is post processing you do y" for me to follow. i'll take a look at the ssao file, thank you.

maybe once i figure this out i can pr the compute example, this is eating a lot of time for me and a single example of it would be so helpful

#

goal: bevy game of life compute example, but with an additional binding of a settings struct similar to post processing example

fading wren
#

@fluid harness i got it working on the third try thank you :D

#

for anyone else: 1) copy code from post processing example for the settings struct. 2) from the compute example, follow any time the texture binding is updated. add a second bind group in the same way the texture is added, instead of single(), change it to sequential().

fluid harness
#

@olive lava Maybe we should change the post processing example to use more than 1 binding lol

olive lava
fluid harness
#

Oh sorry yeah 😅