
GPU Computing 193
// M od if y t h e l ev e l −0 mipmap of output , e it h er by mapped w ri tes or by
// sta g i ng t e x tu r e s . Then make t h e n e x t c al l t o h av e t he o t h e r l e v e l s
// computed .
if (input.wantAutogeneratedMipmaps)
{
context−>GenerateMips ( output . srView ) ;
}
LISTING 4.40: Pseudocode for telling D3D11 to compute mipmap levels
after the level-0 mipmap is initialized or (later) modified.
Because the generation requires a context, you cannot have them computed
by the device (during the
CreateMyDX11Texture) call. If you really want them
computed at texture creation time, you will need to do so on the CPU at run-
time