1

In Direct 3D 11 one can create an empty texture using ID3D11DeviceContext::CreateTexture2D and update the texel data using ID3D11DeviceContext::UpdateSubresource method, specifying the required mip level to change in the D3D11_BOX structure. While this is possible, is it possible to change the number of mip levels of a 2D texture after it's creation in Direct 3D?

I know this question begs a "Why would you do that?!" response, but due to some porting/testing requirements, I'm constrained to do so.

legends2k
  • 31,634
  • 25
  • 118
  • 222
  • Optionally, one can set 0 to MipLevels params in D3D11_TEXTURE2D_DESC during creation so that based on the width and height D3D will set the mip levels to maximum (also pass nullptr for SUB_RESOURCE_DATA ptr), then later populate the mipmap levels via UpdateSubresource. – legends2k Sep 08 '12 at 19:21

1 Answers1

3

No, you can't change the number of mipmaps after the texture is created. You could only create another texture and using ID3D11DeviceContext::CopySubresourceRegion to copy the required mipmaps (though It would be better to work directly on the texture with the correct mipmap levels...).

xoofx
  • 3,682
  • 1
  • 17
  • 32