Detach Shader Resources

If you want to decouple a shader resource in directx11, all the code I found is doing something along these lines:

ID3D10ShaderResourceView* nullSRV[1] = {nullptr};
context->PSSetShaderResources(0, 1, &nullSRV);

      

Why not just use this?

context->PSSetShaderResources(0, 0, nullptr);

      

Seems to be supported by the docs ( https://msdn.microsoft.com/en-us/library/windows/desktop/ff476473%28v=vs.85%29.aspx ), is there really any difference between the two?

+3


source to share


1 answer


In the first case, you disable one SRV starting at zero. In the second case, you don't disable anything because it NumViews

is zero. If you want to untie in the second case you will have to use:

context->PSSetShaderResources(0, 1, nullptr);

      

However, this will crash at runtime:



D3D11 CORRUPTION: ID3D11DeviceContext::PSSetShaderResources: Third parameter corrupt or unexpectedly NULL. [ MISCELLANEOUS CORRUPTION #15: CORRUPTED_PARAMETER3]

      

This is why the first form is used.

+1


source







All Articles