In my engine i load images from file into memory manually, so i have image data and all of its mipmap levels for all surfaces in the file(if it is a cubemap or tex array) located in separate buffers. The question is how to supply this data to dx10. I see there is a Map method in textures interfaces which allows to map a required part of a resource, but Map cannot be used with D3D10_USAGE_DEFAULT flag. In OpenGL with glTexImage you can supply which data do you load into a given mip level, is there anything like this in dx10?
I can fill dynamic and staging textures via map/unmap, and for default textures i can use a dynamic temporary texture which after filling will be copied into a default texture via CopyResource, but this approach cannot be applied to immutable textures.
On the other hand i could use D3D10_SUBRESOURCE_DATA if i knew how to properly layout a texture with all it`s surfaces and mipmaps . For example if i have an arrray of 2 textures with 2 mipmaps per image should i upload data to gpu like this:
D3D10_SUBRESOURCE_DATA data[4];
data[0].pSysMem=image(0).mipmap(0);
data[1].pSysMem=image(0).mipmap(1);
data[2].pSysMem=image(1).mipmap(0);
data[3].pSysMem=image(1).mipmap(1);
The next question is how to arrange cubemap faces into an array of D3D10_SUBRESOURCE_DATA