Samplers

The sampler, as specified before, determines how the texture is supposed to return a color based on a position.

Most of the properties specified in the function are beyond the scope of this article. However, this should be a good preset in the general case.

result = renderer->device->lpVtbl->CreateSamplerState (
    renderer->device,
    &(D3D11_SAMPLER_DESC){
        .Filter        = D3D11_FILTER_ANISOTROPIC,
        .AddressU      = D3D11_TEXTURE_ADDRESS_WRAP,
        .AddressV      = D3D11_TEXTURE_ADDRESS_WRAP,
        .AddressW      = D3D11_TEXTURE_ADDRESS_WRAP,
        .MaxAnisotropy = 16,
        .MaxLOD        = FLT_MAX
    },
    &renderer->sampler
);
if ( !SUCCEEDED ( result ) )
    RETURN_ERROR(-1, "CreateSamplerState failed (0x%08X)", result );