Timeline for Send an array of struct to compute shader
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 16 at 17:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jan 3 at 21:05 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Aug 30, 2023 at 18:03 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Apr 19, 2023 at 4:10 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 27, 2022 at 21:07 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 2, 2022 at 16:42 | comment | added | PepeOjeda | Hey, for some reason this popped up in my head while doing dishes today and I realized that I lied to you. Using two buffers (what you were initially doing) is actually correct. Using a single buffer causes a race condition, as you are reading a value that might or might not already have been modified by another thread. In fairness, this is not too important for something like Boids, as changes from one frame to the next are going to be small, but it is still wrong. Sorry! | |
Jun 27, 2022 at 20:34 | answer | added | Aaron Z | timeline score: 0 | |
Jun 27, 2022 at 20:31 | comment | added | Aaron Z | @PepeOjeda Thank you, that makes a lot of sense. I didn't realize I could just iterate over the array buffer. | |
Jun 26, 2022 at 19:10 | comment | added | PepeOjeda |
As far as I can tell, your code is already sending the array correctly in the buffer.SetData(_flockAI) line. Could you elaborate as to what specific problem you are having? Also, I am curious as to why you are putting the same data into two separate buffers. That is, you could just iterate over the dataBuffer inside of the compute shader, as long as you are only writing into a single position from each thread.
|
|
Jun 26, 2022 at 4:12 | history | asked | Aaron Z | CC BY-SA 4.0 |