aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_blend.h
blob: 2485c34d418300f11efbc305c1f88aea0f47b354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef U_BLEND_H
#define U_BLEND_H

#include "pipe/p_state.h"

/**
 * When faking RGBX render target formats with RGBA ones, the blender is still
 * supposed to treat the destination's alpha channel as 1 instead of the
 * garbage that's there. Return a blend factor that will take that into
 * account.
 */
static INLINE int
util_blend_dst_alpha_to_one(int factor)
{
   switch (factor) {
   case PIPE_BLENDFACTOR_DST_ALPHA:
      return PIPE_BLENDFACTOR_ONE;
   case PIPE_BLENDFACTOR_INV_DST_ALPHA:
      return PIPE_BLENDFACTOR_ZERO;
   default:
      return factor;
   }
}

#endif /* U_BLEND_H */