From 277d768d10d8a98a7cae8b709ff78bb8d1f695f1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Sep 2010 14:59:11 +0100 Subject: llvmpipe: Don't store display the alpha ref value in the key. It's never used. --- src/gallium/drivers/llvmpipe/lp_bld_alpha.c | 11 +++++------ src/gallium/drivers/llvmpipe/lp_bld_alpha.h | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 6 ++---- src/gallium/drivers/llvmpipe/lp_state_fs.h | 6 +++++- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c index 8514030cde4..e28efe778f9 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c @@ -44,21 +44,20 @@ 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); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h index 0f99fec65ed..44603b418c0 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h @@ -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, diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index e17bfb490c2..3a6011c7842 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -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) { diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index f3364f5cf35..2914e7d7efd 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -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; -- cgit v1.2.3