   D3D11 Setting shader resource questions
  I am currently implementing a replacement for effect files on my d3d11 engine. I have questions about Setting shader resources. When I call a SetShaderResource call does it effect all slots or just the ones I specify? For example I want to avoid the issue of leaving resources bound to the pipeline because my next shader uses 2 slots when the last used 3. Also does it take more cpu/gpu to set all 128 slots vs say 8?   
  Settings resources only affects the slots you are targeting, all other slots maintain their current state.The time it takes to set slots will grow linearly with the number of resources being set (due to some very minimal validation) plus whatever overhead it costs to call the API in general.  Calling once and setting many resources should provide a only a small gain over setting each slot separately.Leaving resources bound to the pipeline when the next shader doesn't use them isn't an issue.  There's really no point in clearing resource slots except perhaps in some debugging situations.   ;  I have implemented a simple system to remember which slots have been filled by a previous effect, and then the renderer only sets the needed number of extra null pointers for the next effect.  Its little more than a pair of arrays, but you can check out the code from my engine in the link below.   ;  I believe remembering what slots were used is probably the best way to handle it. As to leaving them bound not being an issue, not if I use the resources in slot 3 or 4 as a render target or want to dispose of them. As well that is assuming that the driver doesnt have an issue with it. I prefer to always clean up after myself, it avoids many wierd why doesn't that work moments.   