Search code examples
directxshaderdirect3dhlsl

Can I use a bias value outside [0, 1] for SampleBias in HLSL?


The doucment SampleBias said that Bias is a floating-point number between 0.0 and 1.0 inclusive. However I have done a little experiment and Bias values outside [0, 1] work fine.

Is Bias value outside [0, 1] guaranteed to work? Or this just depends on hardware?


Solution

  • I'm don't think that the HLSL docs are correct. For DirectX 11, the range for MipLODBias in D3D11_SAMPLE_DESC is -16 to 16--since the maximum possible number of levels in a 16k x 16k texture would be 16.

    #define D3D11_MIP_LOD_BIAS_MAX  ( 15.99f )
    #define D3D11_MIP_LOD_BIAS_MIN  ( -16.0f )