st/mesa: add ARB_blend_func_extended support to state tracker.
authorDave Airlie <airlied@redhat.com>
Sat, 24 Mar 2012 13:36:17 +0000 (13:36 +0000)
committerDave Airlie <airlied@redhat.com>
Fri, 13 Apr 2012 16:19:02 +0000 (17:19 +0100)
This adds the blend mode mapping, it also uses the var->index in the
glsl to tgsi convertor - this is the other half of my using 4 in the GLSL
compiler.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_atom_blend.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 1ffc2f1b73ff506e0456d380a96936328c130267..dea50af678dab4d3ac8c9a5cd8fc4d12c8732b70 100644 (file)
@@ -78,10 +78,10 @@ translate_blend(GLenum blend)
       return PIPE_BLENDFACTOR_CONST_COLOR;
    case GL_CONSTANT_ALPHA:
       return PIPE_BLENDFACTOR_CONST_ALPHA;
-      /*
+   case GL_SRC1_COLOR:
       return PIPE_BLENDFACTOR_SRC1_COLOR;
+   case GL_SRC1_ALPHA:
       return PIPE_BLENDFACTOR_SRC1_ALPHA;
-      */
    case GL_ZERO:
       return PIPE_BLENDFACTOR_ZERO;
    case GL_ONE_MINUS_SRC_COLOR:
@@ -96,10 +96,10 @@ translate_blend(GLenum blend)
       return PIPE_BLENDFACTOR_INV_CONST_COLOR;
    case GL_ONE_MINUS_CONSTANT_ALPHA:
       return PIPE_BLENDFACTOR_INV_CONST_ALPHA;
-      /*
+   case GL_ONE_MINUS_SRC1_COLOR:
       return PIPE_BLENDFACTOR_INV_SRC1_COLOR;
+   case GL_ONE_MINUS_SRC1_ALPHA:
       return PIPE_BLENDFACTOR_INV_SRC1_ALPHA;
-      */
    default:
       assert("invalid GL token in translate_blend()" == NULL);
       return 0;
index afea0ea4f5f7873997066d5c2e31dcbd055590ab..34e0329be2fd08ae42baca2d9d9a7ca9a037c863 100644 (file)
@@ -120,6 +120,10 @@ void st_init_limits(struct st_context *st)
       = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
               1, MAX_DRAW_BUFFERS);
 
+   c->MaxDualSourceDrawBuffers
+      = _clamp(screen->get_param(screen, PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS),
+              0, MAX_DRAW_BUFFERS);
+
    c->MaxLineWidth
       = _maxf(1.0f, screen->get_paramf(screen,
                                        PIPE_CAPF_MAX_LINE_WIDTH));
@@ -629,4 +633,7 @@ void st_init_extensions(struct st_context *st)
          break;
       }
    }
+
+   if (ctx->Const.MaxDualSourceDrawBuffers > 0)
+      ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
 }
index ae8533e185dc3be59d52dfcae711dbfa098d88bf..9e68deb3471724874dbf6ffb55809237ae92afd1 100644 (file)
@@ -1925,7 +1925,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
          assert(var->location != -1);
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_OUTPUT,
-                                               var->location);
+                                               var->location + var->index);
          break;
       case ir_var_system_value:
          entry = new(mem_ctx) variable_storage(var,