Thanks. I got everything working now.
It's a shame that I really didn't see people use the "Pitch" property. I guess they are mostly dealing textures that have the Pitch same as Source width.
/// <summary>
/// Copies content into destinationBuffer.
/// </summary>
/// <param name="texture">actual texture </param>
/// <param name="contentToCopy">source bfufer</param>
/// <param name="sourcePitch">source stride</param>
private static void CopyToTexture(Texture texture, byte[] contentToCopy, int sourcePitch)
{
var data = texture.LockRectangle(0, LockFlags.Discard);
var y = 0;
for (var scanLineStart = 0; scanLineStart < contentToCopy.Length; scanLineStart += sourcePitch, y++)
{
data.Data.WriteRange(contentToCopy, scanLineStart, sourcePitch);
data.Data.Seek((y + 1)*data.Pitch, SeekOrigin.Begin);
}
texture.UnlockRectangle(0);
}
And if anyone is interested, then I ended up using this for my YUV->RGB shader:
http://subversion.assembla.com/svn/AvP/branches/workbranch/trunk/shaders/fmvPixel.psh
though I am thinking about writing my own shader that could use only one sampler2D, so I could pass packed YUV formats directly into the GPU. Though I am not sure where to begin. Is that even a good idea? The texture is defintely gonna be huge as hell though.