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);
}
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);
}
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) {
{
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;