GraphicsStream.Write not writing as expected
I have a method where I write a 2d array into a texture. It is used for running some ordinary calculations on the gpu.
private
void writeToInputTexture(Vector4[,] inputData,Texture inputTexture){
GraphicsStream graphicsStream = inputTexture.LockRectangle(0,LockFlags.None);unsafe{
Vector4* textureData = (Vector4*)graphicsStream.InternalDataPointer;for (int y = 0; y < dataHeight; y++)for (int x = 0; x < dataWidth; x++)textureData[x + y * dataWidth] = inputData[x, y];
}
inputTexture.UnlockRectangle(0);
}
That works as expected. However, if i try to use the graphics sctream write as below, it does not do as expected. The input is not written corrently into the array. I can not debug the pixel shader right now, so all I can see is that input is not passed the same way as the unsafe version.
privatevoid writeToInputTexture(Vector4[,] inputData,Texture inputTexture)
{
GraphicsStream graphicsStream = inputTexture.LockRectangle(0,LockFlags.None);graphicsStream.Write(inputData);
inputTexture.UnlockRectangle(0);
}
What am I doing wrong here?
As a side question, is the begin write and end write methods of the stream dma? Will the cpu rest peacefully while the write is running asynchronously, or will it still be bussy showlelling data to the gpu?

