I am currently trying to re-implement a project i have created form CPU side to GPU side.
I am trying to use Directx11 Compute Shader.
I am trying to calculate the center of mass of a model using the vertex list.
Currently i have an input buffer that holds all the vertices. and an output buffer, that should hold the center of mass position.
Currently i am using a test vector that has 4 vertices.(for testing).
I dispatch one group in each direction. Dispatch(1,1,1)
In each group i have numthreds[4,1,1] .
Basically i am trying to calculate the sum of all vertex positions, and store in in single float3 variable.
I am running into a problem: race condition, as i understand this is due to the code being parallel , and trying to write into the same variable at the same time, which might cause miscalculations.
Thank you all!
Edited by AlexRus, 15 July 2014 - 09:15 AM.