I have a problem with setting shader resource which was previously bound as a render target. Typical way to handle this case would be:
unbind that resource from being a render target
set it as a resource for another pass
Well unfortunalley it does not work in this case. Let me show you some pseudo code:
Set resource "texture 1"
Set "switch" variable to false
Set render target to "texture 2"
Apply and draw
Clear all render targets
//------------------------
Set resource "texture 2"
Set "switch" variable to true
Apply and draw
//------------------------
HLSL pass which is the same for both draw calls
if(switch == true) sample texture 2
else sample texture 1
I've checked in PIX that before second draw call there is no render targets bound. When I do a second draw call I get information that my resource "texture 2" was nullified because it is still bound to an output. How can it be? Could someone explain what is going on here?
[color=#fafafa !important]
[color=#fafafa !important]