PDA

View Full Version : Reading from & writing to a texture at once? (FBO)



Leadwerks
08-16-2008, 09:58 AM
I have a pretty complex set of deferred rendering steps. Is it okay to bind a texture and read from it in a shader, while writing to the same texture, which is bound to an FBO? It seems to work on my GEForce 8, but am I breaking any rules doing this?

babis
08-16-2008, 11:16 AM
From the spec :



(44) What should happen if a texture that is currently bound to the
context is also used as an image attached to the
currently bound framebuffer? In other words, what happens if a
texture is used as both a source for texturing and a
destination for rendering?

RESOLUTION: resolved, (b2) - results are undefined because
the framebuffer is not "framebuffer complete".
...


Even if it works with your card & your current drivers, depending on this fact seems a bad idea.

Leadwerks
08-16-2008, 11:18 AM
Danke.