View Full Version : shader: same texture as source and destination

04-20-2009, 08:23 AM
I need to implement a kind of accumulation buffer,
which means reading from the buffer, perform some
shader ops on it, and write the data back to the
same buffer. Is it possible to set this up without
having to make a separate copy of the buffer?


04-20-2009, 08:45 AM
Nope, only if your operations can be done through blending.

Otherwise use ping-pong RTT.


04-20-2009, 08:55 PM
Thanks Jan!

04-21-2009, 05:20 AM
By the way, rexguo, if you are targeting nVidia hardware, you can use the same texture for input and output (but it's kinda hack). It is unpredictable result following the spec, but reality shows, that if you are reading from the same texel, where you are going to write modified value - it works. But you must be very careful, because that option is no way legal, and this approach may not work on future chipsets (for example).