blending in shaders

Of course it needs “only” framebuffer sampling. I realize problems than would occure in parallel processing but … Any progress in this direction?


This can already be done with multiple passes. You render to a texture, then render that texture to the framebuffer on a single quad, doing blending on each pixel in a shader.

For a single-pass implementation, it would need to be done later in the pipeline, well after all pixel shaders have completed. So we would need an entirely new type of shader program in OpenGL. I’ll leave the guess as to whether that will happen up to others.


If you read though the Issues section of GLSlang spec you will find this

  1. Should the fragment shader be allowed to read the current location in the frame buffer?
    DISCUSSION: It may be difficult to specify this properly while taking into account multisampling. It
    also may be quite difficult for hardware implementors to implement this capability, at least with
    reasonable performance. But this was one of the top two requested items after the original release of
    the shading language white paper. ISVs continue to tell us that they need this capability, and that it
    must be high performance.
    RESOLUTION: Yes. This is allowed, with strong cautions as to performance impacts.
    REOPENED on December 10, 2002. There is too much concern about impact to performance and
    impracticallity of implementation.
    CLOSED on December 10, 2002.

Allthough they say it’s closed, it might be conciderd for the next version of GLSlang.