If I am running DirectX 11 in debug mode (D3D11_CREATE_DEVICE_DEBUG), I am constantly getting these warnings:

D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM DepthStencil is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 6 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]

It is because I am setting a resource as a render target while it is currently bound to the PS. However, my rendering flow is set up such as it relies on the api to force the resource slot to null, and it works.

Is there any reason I should be bothered with these warnings or I can rely on the api to enforce this every time? I only tested on 2 GPU-s: Intel HD 3000 and Nvidia GT525m.

  • \$\begingroup\$ DirectX display most of warnings in output when you pass D3D11_CREATE_DEVICE_DEBUG flag to D3D11CreateDeviceAndSwapChain(...) - you can use 0 to discard them. But it's usually a good idea to keep the warnings. You are aware of them now and you know that they don't cause error. But maybe in future, after changing something in code, you will get an error because of that approach. In that case they will focus you on the problem. After all, purpose of warnings is to focus attention on places that are likely to cause problems now or in future (which does not mean they will). \$\endgroup\$ – PolGraphic Dec 8 '14 at 19:07

Ideally you should have no warnings, but depending on your application you may find a number of warnings tolerable or even desirable. In that case, you might consider suppressing the particular warning so you don't end up with noise in the output causing you to miss other warnings.

See Direct3D SDK Debug Layer Tricks for how to do this.

Note that you should never suppress CORRUPTION or ERROR output and just fix them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.