Compute shader only updates part of data

不问归期 提交于 2019-12-11 22:52:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!