llvmpipe: Don't store display the alpha ref value in the key.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 10 Sep 2010 13:59:11 +0000 (14:59 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 11 Sep 2010 12:30:14 +0000 (13:30 +0100)
It's never used.

src/gallium/drivers/llvmpipe/lp_bld_alpha.c
src/gallium/drivers/llvmpipe/lp_bld_alpha.h
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_fs.h

index 8514030..e28efe7 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)
 {
    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);
 }
index 0f99fec..44603b4 100644 (file)
@@ -44,7 +44,7 @@ struct lp_build_mask_context;
 
 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,
index e17bfb4..3a6011c 100644 (file)
@@ -332,14 +332,13 @@ generate_fs(struct llvmpipe_context *lp,
                   lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
 
                   /* Alpha test */
-                  /* XXX: should the alpha reference value be passed separately? */
                  /* XXX: should only test the final assignment to alpha */
-                  if(cbuf == 0 && chan == 3) {
+                  if (cbuf == 0 && chan == 3 && key->alpha.enabled) {
                      LLVMValueRef alpha = out;
                      LLVMValueRef alpha_ref_value;
                      alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr);
                      alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value);
-                     lp_build_alpha_test(builder, &key->alpha, type,
+                     lp_build_alpha_test(builder, key->alpha.func, type,
                                          &mask, alpha, alpha_ref_value);
                   }
 
@@ -750,7 +749,6 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key)
 
    if (key->alpha.enabled) {
       debug_printf("alpha.func = %s\n", util_dump_func(key->alpha.func, TRUE));
-      debug_printf("alpha.ref_value = %f\n", key->alpha.ref_value);
    }
 
    if (key->blend.logicop_enable) {
index f3364f5..2914e7d 100644 (file)
@@ -49,9 +49,13 @@ struct lp_fragment_shader_variant_key
 {
    struct pipe_depth_state depth;
    struct pipe_stencil_state stencil[2];
-   struct pipe_alpha_state alpha;
    struct pipe_blend_state blend;
 
+   struct {
+      unsigned enabled:1;
+      unsigned func:3;
+   } alpha;
+
    unsigned nr_cbufs:8;
    unsigned nr_samplers:8;     /* actually derivable from just the shader */
    unsigned flatshade:1;