/// <summary>
		/// Setups vertex (stream) output.
		/// </summary>
		/// <param name="vertexBuffers">Vertex buffer to write data.</param>
		/// <param name="offset">Offset where to start writing data. -1 means append.</param>
		public void SetupVertexOutput ( VertexBuffer[] vertexBuffers, int[] offsets )
		{
			if (vertexBuffers==null || offsets==null ) {
				lock (deviceContext) {
					deviceContext.StreamOutput.SetTargets( null );
				}
				return;
			}

			if (vertexBuffers.Length>4) {
				throw new ArgumentException("Length of 'vertexBuffers' must be less or equal 4");
			}

			if (vertexBuffers.Length!=offsets.Length) {
				throw new ArgumentException("Lengths of 'vertexBuffers' and 'offsets' must be the same.");
			}

			if ( !offsets.All( e => (e<0) || (e%4==0) ) ) {
				throw new ArgumentException("SetupVertexOutput: Offsets must be multiple of 4.");
			}

			if ( !vertexBuffers.All( vb => vb.Options==VertexBufferOptions.VertexOutput) ) {
				throw new GraphicsException("SetupVertexOutput: Vertex buffer must be created with enabled vertex output.");
			}

			var outputBinding		=	vertexBuffers.Zip( offsets, (vb,offset) => new StreamOutputBufferBinding( vb.Buffer, offset ) ).ToArray();

			lock (deviceContext) {
				deviceContext.StreamOutput.SetTargets( outputBinding );
			}
		}