1b8e80941Smrg#ifndef U_BLEND_H
2b8e80941Smrg#define U_BLEND_H
3b8e80941Smrg
4b8e80941Smrg#include "pipe/p_state.h"
5b8e80941Smrg
6b8e80941Smrg/**
7b8e80941Smrg * When faking RGBX render target formats with RGBA ones, the blender is still
8b8e80941Smrg * supposed to treat the destination's alpha channel as 1 instead of the
9b8e80941Smrg * garbage that's there. Return a blend factor that will take that into
10b8e80941Smrg * account.
11b8e80941Smrg */
12b8e80941Smrgstatic inline int
13b8e80941Smrgutil_blend_dst_alpha_to_one(int factor)
14b8e80941Smrg{
15b8e80941Smrg   switch (factor) {
16b8e80941Smrg   case PIPE_BLENDFACTOR_DST_ALPHA:
17b8e80941Smrg      return PIPE_BLENDFACTOR_ONE;
18b8e80941Smrg   case PIPE_BLENDFACTOR_INV_DST_ALPHA:
19b8e80941Smrg      return PIPE_BLENDFACTOR_ZERO;
20b8e80941Smrg   default:
21b8e80941Smrg      return factor;
22b8e80941Smrg   }
23b8e80941Smrg}
24b8e80941Smrg
25b8e80941Smrg#endif /* U_BLEND_H */
26