One of the major changes I have encountered between Direct3D 9 and Direct3D 11 is the new API for setting up texture sampling. In D3D9, it was sufficient to simply set a given value of a given property to a given sampler index and safely assume that state would remain (and be unaffected by other state changes) for as long as was needed by the application.
direct3Ddevice->SetSamplerState(samplerIndex, D3DSAMP_MAXANISOTROPY, value);
However, in D3D11, the process is a little more involved. First you create and populate an object of type
D3D11_SAMPLER_DESC, then from that object create an
ID3D11SamplerState, then apply that to a sampler index.
D3D11_SAMPLER_DESC desc = CD3D11_SAMPLER_DESC(CD3D11_DEFAULT()); desc.MaxAnisotropy = value; ID3D11SamplerState * state = 0; direct3Ddevice->CreateSamplerState(&desc,&state); direct3Dcontext->PSSetSamplers(samplerIndex, 1, &state);
I understand that this is designed to minimise the number of queued requests per frame by batching potentially a whole bunch of state changes into one object... However, if the developer wanted to, say, put a global anisotropic filtering setting in their game's options screen, they'd need to keep copies of the sampler descriptions of every sampler they use for every shader (to ensure that no other parameters would get lost), then iterate through all of those copies to apply the new filtering level, and recreate all those state objects.
Surely there must be a simpler way to apply a single sampler setting globally for an application?