I'm making a 2D game in which I create some textures dynamically for displaying as simple 2D quads. To achieve this, I call ID3D11Device::CreateTexture2D that requires a D3D11_TEXTURE2D_DESC.
typedef struct D3D11_TEXTURE2D_DESC { UINT Width; UINT Height; UINT MipLevels; UINT ArraySize; DXGI_FORMAT Format; DXGI_SAMPLE_DESC SampleDesc; D3D11_USAGE Usage; UINT BindFlags; UINT CPUAccessFlags; UINT MiscFlags; } D3D11_TEXTURE2D_DESC; One of the fields is MipLevels. What I understand about this is that mipmaps consist of a collection of the same texture downscaled for better representation and performance of them when they are far away from the view camera.
Since what I'm making is a 2D game, I don't need this feature and I want to disable it. Is there any way to do so? At first, I thought I could just set miplevels parameter to 0, but then I read this:
MipLevels Type: UINT The maximum number of mipmap levels in the texture. See the remarks in D3D11_TEX1D_SRV. Use 1 for a multisampled texture; or 0 to generate a full set of subtextures.
and:
pInitialData [in] Type: const D3D11_SUBRESOURCE_DATA* A pointer to an array of D3D11_SUBRESOURCE_DATA structures that describe subresources for the 2D texture resource. Applications cannot specify NULL for pInitialData when creating IMMUTABLE resources (see D3D11_USAGE). If the resource is multisampled, pInitialData must be NULL because multisampled resources cannot be initialized with data when they are created.
This is what confuses me. I want to create an IMMUTABLE 2D texture (once it's dynamically generated at runtime it's not going to change anymore) plus I don't want any mipmap levels. How am I supposed to do this?