Citation :
7) Is alpha blending programmable?
Fragment shaders can read the contents of the frame buffer at the current location using the built-in
variables gl_FBColor, gl_FBDepth, gl_FBStencil, and gl_FBDatan. Using these facilities,
applications can implement custom algorithms for blending, stencil testing, and the like. However,
these frame buffer read operations may result in a significant reduction in performance, so
applications are strongly encouraged to use the fixed functionality of OpenGL for these operations if
at all possible. The hardware to implement fragment shaders (and vertex shaders) is made a lot
simpler and faster if each fragment can be processed independently both in space and in time. By
allowing read-modify-write operations such as is needed with alpha blending to be done as part of the
fragment processing we have introduced both spatial and temporal relationships. These complicate
the design because of the extremely deep pipelining, caching and memory arbitration necessary for
performance. Methods such as render to texture, copy frame buffer to texture, aux data buffers and
accumulation buffers can do most, if not all, what programmable alpha blending can do. Also the
need for multiple passes has been reduced (or at least abstracted) by the high-level shading language
and the automatic resource management.
RESOLVED on October 12, 2001: Yes, applications can do alpha blending, albeit with possible
performance penalties over using the fixed functionality blending operations.
REOPENED on July 9, 2002: This issue is related to Issue (23) which remains open, so this issue
should also remain open.
Another possibility would be to create an extension that allows more flexibility than the current alpha
blending allows, but would still be considered fixed functionality.
RESOLUTION: Issue 23) is resolved as allowing frame buffer reads, so this is once again resolved
allowing alpha blending, with the caveats listed above.
REOPENED on December 10, 2002. Issue 23 is re-resolved to disallow frame buffer reads.
RESOLUTION: No, applications cannot do alpha blending, because they cannot read alpha.
CLOSED on December 10, 2002.
23) 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.
|