X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Ffreedreno%2Fa2xx%2Ffd2_blend.c;h=223eec9f592b421bc416d9249a1ccbffd0ece969;hb=ee61790daf46d83d64288b99fb02f17070acb3dc;hp=f063ebed66aac98df21db1624b77200f639f59ab;hpb=fcba3046e1b90ecec6f5f4ad5397cd36e0c740ac;p=mesa.git diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_blend.c b/src/gallium/drivers/freedreno/a2xx/fd2_blend.c index f063ebed66a..223eec9f592 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_blend.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_blend.c @@ -1,5 +1,3 @@ -/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ - /* * Copyright (C) 2012-2013 Rob Clark * @@ -27,6 +25,7 @@ */ #include "pipe/p_state.h" +#include "util/u_blend.h" #include "util/u_string.h" #include "util/u_memory.h" @@ -61,11 +60,10 @@ fd2_blend_state_create(struct pipe_context *pctx, { const struct pipe_rt_blend_state *rt = &cso->rt[0]; struct fd2_blend_stateobj *so; + unsigned rop = PIPE_LOGICOP_COPY; - if (cso->logicop_enable) { - DBG("Unsupported! logicop"); - return NULL; - } + if (cso->logicop_enable) + rop = cso->logicop_func; /* 1:1 mapping with hw */ if (cso->independent_blend_enable) { DBG("Unsupported! independent blend state"); @@ -78,16 +76,23 @@ fd2_blend_state_create(struct pipe_context *pctx, so->base = *cso; - so->rb_colorcontrol = A2XX_RB_COLORCONTROL_ROP_CODE(12); + so->rb_colorcontrol = A2XX_RB_COLORCONTROL_ROP_CODE(rop); - so->rb_blendcontrol = + so->rb_blendcontrol_rgb = A2XX_RB_BLEND_CONTROL_COLOR_SRCBLEND(fd_blend_factor(rt->rgb_src_factor)) | A2XX_RB_BLEND_CONTROL_COLOR_COMB_FCN(blend_func(rt->rgb_func)) | - A2XX_RB_BLEND_CONTROL_COLOR_DESTBLEND(fd_blend_factor(rt->rgb_dst_factor)) | + A2XX_RB_BLEND_CONTROL_COLOR_DESTBLEND(fd_blend_factor(rt->rgb_dst_factor)); + + so->rb_blendcontrol_alpha = A2XX_RB_BLEND_CONTROL_ALPHA_SRCBLEND(fd_blend_factor(rt->alpha_src_factor)) | A2XX_RB_BLEND_CONTROL_ALPHA_COMB_FCN(blend_func(rt->alpha_func)) | A2XX_RB_BLEND_CONTROL_ALPHA_DESTBLEND(fd_blend_factor(rt->alpha_dst_factor)); + so->rb_blendcontrol_no_alpha_rgb = + A2XX_RB_BLEND_CONTROL_COLOR_SRCBLEND(fd_blend_factor(util_blend_dst_alpha_to_one(rt->rgb_src_factor))) | + A2XX_RB_BLEND_CONTROL_COLOR_COMB_FCN(blend_func(rt->rgb_func)) | + A2XX_RB_BLEND_CONTROL_COLOR_DESTBLEND(fd_blend_factor(util_blend_dst_alpha_to_one(rt->rgb_dst_factor))); + if (rt->colormask & PIPE_MASK_R) so->rb_colormask |= A2XX_RB_COLOR_MASK_WRITE_RED; if (rt->colormask & PIPE_MASK_G)