<p>Oh, okay. And we want to do this for Gallium as well, not GL?</p>
<p>If somebody else acks this, I&#39;ll merge it, but I am not super-up-to-date on FP buffer trickery.</p>
<p>Sending from a mobile, pardon my terseness. ~ C.</p>
<div class="gmail_quote">On Nov 6, 2011 6:21 AM, &quot;Morgan Armand&quot; &lt;<a href="mailto:morgan.devel@gmail.com">morgan.devel@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Unless I&#39;m missing something, no there is no ROPs defined for floating points operands.<br>
The ARB_color_buffer_float specification says:<br>
<br>
36. Should logical operations be disabled for floating-point color buffers?<br>
    RESOLVED:  Yes.  This matches the behavior in the ATI specification.<br>
<br>
Besides that, the result of the blending equation is no longer clamped when dealing<br>
with FP buffers.<br>
<br>
On 11/6/2011 3:08 PM, Corbin Simpson wrote:<br>
&gt; It&#39;s entirely possible that I&#39;m still asleep, but what problem does this solve? Are ROPs not defined for FP operands?<br>
&gt;<br>
&gt; Sending from a mobile, pardon my terseness. ~ C.<br>
&gt;<br>
&gt; On Nov 6, 2011 4:31 AM, &quot;Morgan Armand&quot; &lt;<a href="mailto:morgan.devel@gmail.com">morgan.devel@gmail.com</a> &lt;mailto:<a href="mailto:morgan.devel@gmail.com">morgan.devel@gmail.com</a>&gt;&gt; wrote:<br>

&gt;<br>
&gt;     ---<br>
&gt;      src/gallium/drivers/softpipe/sp_quad_blend.c |   78 ++++++++++++++++++-------<br>
&gt;      1 files changed, 56 insertions(+), 22 deletions(-)<br>
&gt;<br>
&gt;     diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c<br>
&gt;     index 598df26..4813ada 100644<br>
&gt;     --- a/src/gallium/drivers/softpipe/sp_quad_blend.c<br>
&gt;     +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c<br>
&gt;     @@ -702,19 +702,19 @@ blend_quad(struct quad_stage *qs,<br>
&gt;         */<br>
&gt;        switch (softpipe-&gt;blend-&gt;rt[blend_index].rgb_func) {<br>
&gt;        case PIPE_BLEND_ADD:<br>
&gt;     -      VEC4_ADD_SAT(quadColor[0], source[0], blend_dest[0]); /* R */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[1], source[1], blend_dest[1]); /* G */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[2], source[2], blend_dest[2]); /* B */<br>
&gt;     +      VEC4_ADD(quadColor[0], source[0], blend_dest[0]); /* R */<br>
&gt;     +      VEC4_ADD(quadColor[1], source[1], blend_dest[1]); /* G */<br>
&gt;     +      VEC4_ADD(quadColor[2], source[2], blend_dest[2]); /* B */<br>
&gt;           break;<br>
&gt;        case PIPE_BLEND_SUBTRACT:<br>
&gt;     -      VEC4_SUB_SAT(quadColor[0], source[0], blend_dest[0]); /* R */<br>
&gt;     -      VEC4_SUB_SAT(quadColor[1], source[1], blend_dest[1]); /* G */<br>
&gt;     -      VEC4_SUB_SAT(quadColor[2], source[2], blend_dest[2]); /* B */<br>
&gt;     +      VEC4_SUB(quadColor[0], source[0], blend_dest[0]); /* R */<br>
&gt;     +      VEC4_SUB(quadColor[1], source[1], blend_dest[1]); /* G */<br>
&gt;     +      VEC4_SUB(quadColor[2], source[2], blend_dest[2]); /* B */<br>
&gt;           break;<br>
&gt;        case PIPE_BLEND_REVERSE_SUBTRACT:<br>
&gt;     -      VEC4_SUB_SAT(quadColor[0], blend_dest[0], source[0]); /* R */<br>
&gt;     -      VEC4_SUB_SAT(quadColor[1], blend_dest[1], source[1]); /* G */<br>
&gt;     -      VEC4_SUB_SAT(quadColor[2], blend_dest[2], source[2]); /* B */<br>
&gt;     +      VEC4_SUB(quadColor[0], blend_dest[0], source[0]); /* R */<br>
&gt;     +      VEC4_SUB(quadColor[1], blend_dest[1], source[1]); /* G */<br>
&gt;     +      VEC4_SUB(quadColor[2], blend_dest[2], source[2]); /* B */<br>
&gt;           break;<br>
&gt;        case PIPE_BLEND_MIN:<br>
&gt;           VEC4_MIN(quadColor[0], source[0], blend_dest[0]); /* R */<br>
&gt;     @@ -735,13 +735,13 @@ blend_quad(struct quad_stage *qs,<br>
&gt;         */<br>
&gt;        switch (softpipe-&gt;blend-&gt;rt[blend_index].alpha_func) {<br>
&gt;        case PIPE_BLEND_ADD:<br>
&gt;     -      VEC4_ADD_SAT(quadColor[3], source[3], blend_dest[3]); /* A */<br>
&gt;     +      VEC4_ADD(quadColor[3], source[3], blend_dest[3]); /* A */<br>
&gt;           break;<br>
&gt;        case PIPE_BLEND_SUBTRACT:<br>
&gt;     -      VEC4_SUB_SAT(quadColor[3], source[3], blend_dest[3]); /* A */<br>
&gt;     +      VEC4_SUB(quadColor[3], source[3], blend_dest[3]); /* A */<br>
&gt;           break;<br>
&gt;        case PIPE_BLEND_REVERSE_SUBTRACT:<br>
&gt;     -      VEC4_SUB_SAT(quadColor[3], blend_dest[3], source[3]); /* A */<br>
&gt;     +      VEC4_SUB(quadColor[3], blend_dest[3], source[3]); /* A */<br>
&gt;           break;<br>
&gt;        case PIPE_BLEND_MIN:<br>
&gt;           VEC4_MIN(quadColor[3], source[3], blend_dest[3]); /* A */<br>
&gt;     @@ -856,6 +856,10 @@ blend_fallback(struct quad_stage *qs,<br>
&gt;<br>
&gt;        for (cbuf = 0; cbuf &lt; softpipe-&gt;framebuffer.nr_cbufs; cbuf++)<br>
&gt;        {<br>
&gt;     +      const enum pipe_format format =<br>
&gt;     +         softpipe-&gt;framebuffer.cbufs[cbuf]-&gt;format;<br>
&gt;     +      const struct util_format_description *desc =<br>
&gt;     +         util_format_description(format);<br>
&gt;           /* which blend/mask state index to use: */<br>
&gt;           const uint blend_buf = blend-&gt;independent_blend_enable ? cbuf : 0;<br>
&gt;           float dest[4][QUAD_SIZE];<br>
&gt;     @@ -909,10 +913,19 @@ blend_fallback(struct quad_stage *qs,<br>
&gt;<br>
&gt;<br>
&gt;              if (blend-&gt;logicop_enable) {<br>
&gt;     -            logicop_quad( qs, quadColor, dest );<br>
&gt;     +            if (desc-&gt;channel[0].type != UTIL_FORMAT_TYPE_FLOAT) {<br>
&gt;     +               logicop_quad( qs, quadColor, dest );<br>
&gt;     +            }<br>
&gt;              }<br>
&gt;              else if (blend-&gt;rt[blend_buf].blend_enable) {<br>
&gt;                 blend_quad(qs, quadColor, dest, blend_color, blend_buf);<br>
&gt;     +<br>
&gt;     +            /* If fixed-point dest color buffer, need to clamp the outgoing<br>
&gt;     +             * fragment colors now.<br>
&gt;     +             */<br>
&gt;     +            if (clamp) {<br>
&gt;     +               clamp_colors(quadColor);<br>
&gt;     +            }<br>
&gt;              }<br>
&gt;<br>
&gt;              rebase_colors(bqs-&gt;base_format[cbuf], quadColor);<br>
&gt;     @@ -969,6 +982,13 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs,<br>
&gt;              }<br>
&gt;           }<br>
&gt;<br>
&gt;     +      /* If fixed-point dest color buffer, need to clamp the incoming<br>
&gt;     +       * fragment colors now.<br>
&gt;     +       */<br>
&gt;     +      if (bqs-&gt;clamp[0]) {<br>
&gt;     +         clamp_colors(quadColor);<br>
&gt;     +      }<br>
&gt;     +<br>
&gt;           VEC4_MUL(source[0], quadColor[0], alpha); /* R */<br>
&gt;           VEC4_MUL(source[1], quadColor[1], alpha); /* G */<br>
&gt;           VEC4_MUL(source[2], quadColor[2], alpha); /* B */<br>
&gt;     @@ -978,12 +998,19 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs,<br>
&gt;           VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */<br>
&gt;           VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */<br>
&gt;           VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */<br>
&gt;     -      VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* B */<br>
&gt;     +      VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* A */<br>
&gt;<br>
&gt;     -      VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */<br>
&gt;     +      VEC4_ADD(quadColor[0], source[0], dest[0]); /* R */<br>
&gt;     +      VEC4_ADD(quadColor[1], source[1], dest[1]); /* G */<br>
&gt;     +      VEC4_ADD(quadColor[2], source[2], dest[2]); /* B */<br>
&gt;     +      VEC4_ADD(quadColor[3], source[3], dest[3]); /* A */<br>
&gt;     +<br>
&gt;     +      /* If fixed-point dest color buffer, need to clamp the outgoing<br>
&gt;     +       * fragment colors now.<br>
&gt;     +       */<br>
&gt;     +      if (bqs-&gt;clamp[0]) {<br>
&gt;     +         clamp_colors(quadColor);<br>
&gt;     +      }<br>
&gt;<br>
&gt;           rebase_colors(bqs-&gt;base_format[0], quadColor);<br>
&gt;<br>
&gt;     @@ -1035,10 +1062,17 @@ blend_single_add_one_one(struct quad_stage *qs,<br>
&gt;              clamp_colors(quadColor);<br>
&gt;           }<br>
&gt;<br>
&gt;     -      VEC4_ADD_SAT(quadColor[0], quadColor[0], dest[0]); /* R */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[1], quadColor[1], dest[1]); /* G */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[2], quadColor[2], dest[2]); /* B */<br>
&gt;     -      VEC4_ADD_SAT(quadColor[3], quadColor[3], dest[3]); /* A */<br>
&gt;     +      VEC4_ADD(quadColor[0], quadColor[0], dest[0]); /* R */<br>
&gt;     +      VEC4_ADD(quadColor[1], quadColor[1], dest[1]); /* G */<br>
&gt;     +      VEC4_ADD(quadColor[2], quadColor[2], dest[2]); /* B */<br>
&gt;     +      VEC4_ADD(quadColor[3], quadColor[3], dest[3]); /* A */<br>
&gt;     +<br>
&gt;     +      /* If fixed-point dest color buffer, need to clamp the outgoing<br>
&gt;     +       * fragment colors now.<br>
&gt;     +       */<br>
&gt;     +      if (bqs-&gt;clamp[0]) {<br>
&gt;     +         clamp_colors(quadColor);<br>
&gt;     +      }<br>
&gt;<br>
&gt;           rebase_colors(bqs-&gt;base_format[0], quadColor);<br>
&gt;<br>
&gt;     --<br>
&gt;     1.7.7.1.msysgit.0<br>
&gt;<br>
&gt;     _______________________________________________<br>
&gt;     mesa-dev mailing list<br>
&gt;     <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a> &lt;mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>&gt;<br>
&gt;     <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
&gt;<br>
<br>
</blockquote></div>