llvmpipe: try to be sensible about whether to branch after mask updates
[mesa.git] / src / gallium / drivers / llvmpipe / lp_bld_alpha.c
index 8514030cde45bc962b89462b6f07c6645e61a462..e50643790c8aa4c3f6eef0a48e31ada6c118deab 100644 (file)
 
 void
 lp_build_alpha_test(LLVMBuilderRef builder,
-                    const struct pipe_alpha_state *state,
+                    unsigned func,
                     struct lp_type type,
                     struct lp_build_mask_context *mask,
                     LLVMValueRef alpha,
-                    LLVMValueRef ref)
+                    LLVMValueRef ref,
+                    boolean do_branch)
 {
    struct lp_build_context bld;
+   LLVMValueRef test;
 
    lp_build_context_init(&bld, builder, type);
 
-   if(state->enabled) {
-      LLVMValueRef test = lp_build_cmp(&bld, state->func, alpha, ref);
+   test = lp_build_cmp(&bld, func, alpha, ref);
 
-      lp_build_name(test, "alpha_mask");
+   lp_build_name(test, "alpha_mask");
 
-      lp_build_mask_update(mask, test);
-   }
+   lp_build_mask_update(mask, test);
+
+   if (do_branch)
+      lp_build_mask_check(mask);
 }