[Mesa-dev] [PATCH 2/2] st/mesa: fix i/j indexing mix-up for blend equations

Brian Paul brianp at vmware.com
Tue Apr 28 17:19:16 PDT 2015


This doesn't actually change behavior, but it matches the surrounding
code and makes more sense.

If independent blend mode is supported (GL_ARB_draw_buffers_blend) i==j
so there's no difference.  If independent blend mode is not supported,
Blend[i].EquationRGB/A will never be GL_MIN/MAX if i>0.
---
 src/mesa/state_tracker/st_atom_blend.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 6337e1c..2d0420e 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -235,8 +235,8 @@ update_blend( struct st_context *st )
          blend->rt[i].rgb_func =
             translate_blend(ctx->Color.Blend[j].EquationRGB, baseFormat);
 
-         if (ctx->Color.Blend[i].EquationRGB == GL_MIN ||
-             ctx->Color.Blend[i].EquationRGB == GL_MAX) {
+         if (ctx->Color.Blend[j].EquationRGB == GL_MIN ||
+             ctx->Color.Blend[j].EquationRGB == GL_MAX) {
             /* Min/max are special */
             blend->rt[i].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
             blend->rt[i].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
@@ -251,8 +251,8 @@ update_blend( struct st_context *st )
          blend->rt[i].alpha_func =
             translate_blend(ctx->Color.Blend[j].EquationA, baseFormat);
 
-         if (ctx->Color.Blend[i].EquationA == GL_MIN ||
-             ctx->Color.Blend[i].EquationA == GL_MAX) {
+         if (ctx->Color.Blend[j].EquationA == GL_MIN ||
+             ctx->Color.Blend[j].EquationA == GL_MAX) {
             /* Min/max are special */
             blend->rt[i].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
             blend->rt[i].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
-- 
1.9.1



More information about the mesa-dev mailing list