DX11 Render texture to self?[SOLVED]

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 114

DX11 Render texture to self?[SOLVED]

Post by mkultra333 »

Updating project from DX9 to DX11. Using RTT a lot, and doing deferred shading.

In DX9, it was fine if I rendered a texture to itself. For instance, I could do a diffuse render of the scene onto my diffuse fullscreen texture. Then I could add an effect, say an outline, by rendering to the diffuse texture again with the diffuse texture itself as an input. However when I do this in DX11, the sampler seems to read the diffuse texture as black.

Do I have to do something special in DX11 to render a texture to itself, or is it just not allowed?
Last edited by mkultra333 on Fri May 06, 2016 7:21 am, edited 1 time in total.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: DX11 Render texture to self?

Post by dark_sylinc »

It wasn't allowed in D3D9 either. If you turned on the Debug Layer, it would've complained to you.

D3D11 forces the texture to NULL if it detects it's already set as a RenderTarget. There is no solution to that other than perform a copy (or use vendor-specific hacks)
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 114

Re: DX11 Render texture to self?

Post by mkultra333 »

Ah, ok, thanks. Interesting, even if forbidden it's been working in DX9 for years, never had a problem. I don't know much about the DX debug layer, I never use it. Guess I should probably look into it.

I'm finding DX11 is a lot fussier than DX9. For instance, DX11 had problems with a lot of my shaders because the vertex inputs didn't exactly match the vertex definitions, whereas DX9 didn't mind.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
Post Reply