Question: When we sample a texture resource through an SSO in HLSL, how is the mip level selected for sampling; assuming the texture resource contains mips?

The SSO has parameters that seem to be concerned with the sampling method, but I can't find any documentation anywhere that states how to actually select a mip level.

Or is it done automatically as a function of the NDC depth value?

Thanks.

Answer: 
You can use `SampleLevel` to manually select the mip level. The 3rd parameter specifies the mip level.

[Documentation here](http://msdn.microsoft.com/en-gb/library/windows/desktop/bb509699(v=vs.85).aspx).
This answer is for selecting a mip level in Direct3D 9 and beyond.

Direct3D 11 has a lot to offer in selecting the mip level. 

However, in Direct3D9, which a lot of us still use due to the wide range of platforms it is supported, the trick was to use the 

```
SetSamplerState(Index, D3DSAMP_MIPMAPLODBIAS, PCardinal(@Value)^);

```

and

```
SetSamplerState(Index, D3DSAMP_MAXMIPLEVEL, PCardinal(@Value)^); 

```

(the above is in Delphi/Object Pascal notation, but is easy to see how it would be in C++)

Say for example you want to use only the 3rd mip level. You should execute:

```
SetSamplerState(Index, D3DSAMP_MAXMIPLEVEL, 3); 

SetSamplerState(Index, D3DSAMP_MIPMAPLODBIAS, -1000);

```

The above forces the max mip level to 3 (instead of 0), and then forces the bias to -1000 so that level 3 is always selected.