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