Blending for Floating Point Texture

I'm confused how does the GL_SRC_ALPHA_SATURATE function effect a 32 bit floating point texture attachment in FBO while blending colors. In the reference the equation is: Here what is the value of kA for a 32-bit(GL_RGBA32F) texture?

According to wiki, when blending a floating point texture, the color value does not get normalized. If so then does min(As, ka - Ad) get divided by the kA?

And lastly, what happens if Ad is negative floating value?

Section "17.3.8 Blending" of the OpenGL spec states:

If the color buffer is fixed-point, the components of the source and destination values and blend factors are each clamped to [0, 1] or [-1, 1] respectively for an unsigned normalized or signed normalized color buffer prior to evaluating the blend equation. If the color buffer is floating-point, no clamping occurs. The resulting four values are sent to the next operation.

So we know that no clamping occurs there. The next section is "17.3.8.1 Blend Equation" and states:

Signed or unsigned normalized fixed-point destination (framebuffer) components are represented as described in section 2.3.4. Constant color components, floating-point destination components, and source (fragment) components are taken to be floating-point values. If source components are represented internally by the GL as fixed-point values, they are also interpreted according to section 2.3.4.

Finally, section "17.3.8.2 Blend Functions" refers to table 17.2 which explains that for GL_SRC_ALPHA_SATURATE:

RGB Blend Factors = (f, f, f)
Alpha Blend Factor = 1

where

$$f = min(A_{s0}, 1 - A_d)$$

So it seems that the reference documentation is misleading for this particular case. However the specification is clear: there is no clamping or conversion for floating-point color buffers.

What if Ad is negative floating value?

My reading of the spec is that nothing special happens if Ad is negative. The min() operation will still produce results, but I don't see how they would be useful.

I've never used GL_SRC_ALPHA_SATURATE myself, but the way I understand it, with GL_FUNC_ADD, it is meant to accumulate color values in the color buffer until the accumulated alpha value equals 1. When the alpha value of the color buffer is 1, no further color contribution from new pixels is allowed. This assumes that you use alpha values between 0 and 1 and use an initial alpha value of 0. Otherwise everything falls apart.

In fact, I think majority of the blending factor mechanisms were designed with alpha values between 0 and 1 in mind and make little sense outside of that range.

• I ran some test, and found that ka is 1 for all blending functions with a floating point texture, not 2^(mc)-1 as in reference page. Floating point values are not clamped and negative values are taken as it is. So you were right :) – codeKhor Dec 9 '17 at 21:31