Jump to content
  • Advertisement
Sign in to follow this  
mrbig

Shader Question

This topic is 4532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The fragment shader runs once for every pixel, but what if I need a value generated at the previous time the shader ran for the next time it runs?

Share this post


Link to post
Share on other sites
Advertisement
Then you're screwed.

[EDIT] I suppose an explanation is in order. The graphics card doesn't process pixels one at a time. It does them in blocks; i.e. if you have 12 pixel pipelines, 12 are computed at a time, in no particular order. So there is no concept of "previous" or "next" pixel.

Share this post


Link to post
Share on other sites
You can use multiple passes and let the first pass render into a different render target, which you then use as lookup texture in the next pass.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Then you're screwed.

[EDIT] I suppose an explanation is in order. The graphics card doesn't process pixels one at a time. It does them in blocks; i.e. if you have 12 pixel pipelines, 12 are computed at a time, in no particular order. So there is no concept of "previous" or "next" pixel.


That seriously sucks!
I wanted to optimize my box blur, so that instead of doing 2r texture reads per pixel, I would only have do 1 texture read and add it to the previous value (because neighbour pixels share almost the same neighbourhood of pixels, and it's a waste to read and add 2r pixels and than subtract 2r - 1 of them).
That would make the blur resolution independant and sOooOoO much faster...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!