I need to communicate some constantly changing data to my pixel shader. I have a texture2d that I am passing to my pixel shader via a texture parameter. Before I call the shader I need to update the data in the texture.
emittingPositions.SetData(emittingPositionsBuffer); //Set the data on the texture
animationEffect.Parameters["emittersMap"].SetValue(emittingPositions); //Tell the shader about the texture data
//go on to do the actual drawing calls to use the pixel shader
The problem is that when I do this I get an exception:
"You may not call SetData on a resource while it is actively set on the GraphicsDevice. Unset it from the device before calling SetData."
How do I "unset it from the device"? Or should I be taking a different approach here?