问题
I'm stuck with my program rendering all the particles, but only updating 1 particle on 3. Here's what I've done to test it. I made a vbo with 10 of my particles, put them all aligned veticaly and set the compute shader to modify their x position every update (pos.x+=0.1). Here's the result after about 1-2 seconds (image is 1:5 scale) :
I use local_size_x = 1, local_size_y = 1 and local_size_z = 1, then DispatchCompute(10,1,1) . Am I doing something wrong with the invocation ids?
Update
Playing around with the struct definition in the shader by adding padding made it skip only one data every update. This means it's a padding problem, but I can't find any good explanation on how to properly pad. Also, is it possible not to pad? What if I don't want all this extra, useless data?
来源:https://stackoverflow.com/questions/25755562/compute-shader-only-updates-part-of-data