summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a2xx/fd2_blend.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-05-21 16:51:12 -0400
committerRob Clark <[email protected]>2014-05-21 17:29:13 -0400
commita4d229b0992806f759ab4c71fc5712e8ab2e1c9d (patch)
treea65b45859ad9a57435bf2978b87f737edea6160b /src/gallium/drivers/freedreno/a2xx/fd2_blend.c
parent5a40a0008961ff3172f78d1a61bf3516680100e1 (diff)
freedreno/a3xx: fix blend opcode
Seems the opcodes are slightly different from a2xx. Resync headers and move blend_func() helper into hw generation specific code. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a2xx/fd2_blend.c')
-rw-r--r--src/gallium/drivers/freedreno/a2xx/fd2_blend.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_blend.c b/src/gallium/drivers/freedreno/a2xx/fd2_blend.c
index d0b324d7fe3..b3cb23977b1 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_blend.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_blend.c
@@ -34,6 +34,27 @@
#include "fd2_context.h"
#include "fd2_util.h"
+
+static enum a2xx_rb_blend_opcode
+blend_func(unsigned func)
+{
+ switch (func) {
+ case PIPE_BLEND_ADD:
+ return BLEND_DST_PLUS_SRC;
+ case PIPE_BLEND_MIN:
+ return BLEND_MIN_DST_SRC;
+ case PIPE_BLEND_MAX:
+ return BLEND_MAX_DST_SRC;
+ case PIPE_BLEND_SUBTRACT:
+ return BLEND_SRC_MINUS_DST;
+ case PIPE_BLEND_REVERSE_SUBTRACT:
+ return BLEND_DST_MINUS_SRC;
+ default:
+ DBG("invalid blend func: %x", func);
+ return 0;
+ }
+}
+
void *
fd2_blend_state_create(struct pipe_context *pctx,
const struct pipe_blend_state *cso)
@@ -61,10 +82,10 @@ fd2_blend_state_create(struct pipe_context *pctx,
so->rb_blendcontrol =
A2XX_RB_BLEND_CONTROL_COLOR_SRCBLEND(fd_blend_factor(rt->rgb_src_factor)) |
- A2XX_RB_BLEND_CONTROL_COLOR_COMB_FCN(fd_blend_func(rt->rgb_func)) |
+ 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_ALPHA_SRCBLEND(fd_blend_factor(rt->alpha_src_factor)) |
- A2XX_RB_BLEND_CONTROL_ALPHA_COMB_FCN(fd_blend_func(rt->alpha_func)) |
+ 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));
if (rt->colormask & PIPE_MASK_R)