I have been trying to use texture 2d arrays as render targets, but only the first layer turns out correct. Attached are some code snippits from a test application I created to work out the problem, I could not figure out how to attach the entire program as a zip file.

What I was expecting is to see a red triangle in the first layer, and a green one in the second layer. The red triangle appears correct, but the second layer is empty, as if it is being cleared but the triangle is not being drawn.

Does anyone have experience using these are render targets and can point out where I went wrong?