I have a piece of code that loads several textures into the layers of a texture array (which was created with a usage flag of D3D11_USAGE_STAGING). Right now, I call:
D3D11DeviceContext->Map(Texture2DResource, 0, D3D11_MAP_WRITE, 0, &mappedResource)
Then I do a memcpy to the mappedResource.pData, with an offset based on the layer of the texture I want to load. Then I Unmap. (Every layer has the same dimensions and depth of course).
The problem is, I only see the last texture I loaded. I had thought that since I wasn't using D3D11_MAP_WRITE_DISCARD, it would leave the untouched contents of the texture resource alone.
Is there a way to do what I want? Or do I have to rework my architecture. I understand that it would be faster and more efficient to have all my data at one time, Map once, and copy it all... but I'm still wondering if it's possible to load the layers individually.