summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_alpha.c11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_alpha.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.h6
4 files changed, 13 insertions, 12 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
index 8514030cde..e28efe778f 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 0f99fec65e..44603b418c 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 e17bfb490c..3a6011c784 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 f3364f5cf3..2914e7d7ef 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;