shader: same texture as source and destination

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?
TIA!

.rex

Nope, only if your operations can be done through blending.

Otherwise use ping-pong RTT.

Jan.

Thanks Jan!

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).