Jump to content

  • Log In with Google      Sign In   
  • Create Account

Quick question on DEVICE_OMSETRENDERTARGETS_HAZARD


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Zaoshi Kaba   Crossbones+   -  Reputation: 4351

Like
0Likes
Like

Posted 11 March 2013 - 01:53 AM

Hello,

 

D3D11 spews these warnings at me:

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

 

I know what they mean and why it happens, I just want to know whether should I simply ignore these warnings, or it's better to set (all?) shader resources to NULL before reusing same texture?

 

Thank you in advance.



Sponsor:

#2 Yourself   Crossbones+   -  Reputation: 1133

Like
0Likes
Like

Posted 11 March 2013 - 02:16 AM

it is always best to have no warnings so just set the shader resources to zero (and bind then agian if needed) before switching render targets.



#3 Tasche   Members   -  Reputation: 222

Like
1Likes
Like

Posted 11 March 2013 - 03:04 AM

it is always best to have no warnings so just set the shader resources to zero (and bind then agian if needed) before switching render targets.

yes, though i've never ever seen it happen, some drivers supposedly treat these warnings as errors, so set to NULL. it's almost no performance cost if no actual memory is moved/mapped to cache during SetRenderTargets. also, PIX may act up if you have warnings in the code (provided you are using PIX).

 

EDIT: i usually only unbind the slots in question, not all of them, but it can be done in a single call, so unbinding more may be useful (e.g. you need them unbound later maybe). don't unbind them if not necessary, cause you might need them, binding is rather expensive. as always, do it correct first, then worry about doing it fast. smile.png


Edited by Tasche, 11 March 2013 - 04:07 PM.


#4 Jason Z   Crossbones+   -  Reputation: 5062

Like
1Likes
Like

Posted 11 March 2013 - 05:26 AM

it is always best to have no warnings so just set the shader resources to zero (and bind then agian if needed) before switching render targets.

yes, though i've never ever seen it happen, some drivers supposedly treat these warnings as errors, so set to NULL. it's almost no performance cost if no actual memory is moved/mapped to cache during SetRenderTargets. also, PIX may act up if you have warnings in the code (provided you are using PIX).

I have actually seen a significant performance penalty with this warning.  It depends on how many times this happens, as well as if the render targets are going to be used immediately afterward.  As the others mentioned above, it is always better to have no warnings floating around if you don't need them!



#5 Zaoshi Kaba   Crossbones+   -  Reputation: 4351

Like
0Likes
Like

Posted 11 March 2013 - 06:25 AM

Seems everyone agrees I should fix this warning, will do so. Thank you!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS