~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/llvmpipe/lp_bld_blend.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
/**
43
43
 * Is (a OP b) == (b OP a)?
44
44
 */
45
 
boolean
 
45
bool
46
46
lp_build_blend_func_commutative(enum pipe_blend_func func)
47
47
{
48
48
   switch (func) {
49
49
   case PIPE_BLEND_ADD:
50
50
   case PIPE_BLEND_MIN:
51
51
   case PIPE_BLEND_MAX:
52
 
      return TRUE;
 
52
      return true;
53
53
   case PIPE_BLEND_SUBTRACT:
54
54
   case PIPE_BLEND_REVERSE_SUBTRACT:
55
 
      return FALSE;
 
55
      return false;
56
56
   default:
57
57
      assert(0);
58
 
      return TRUE;
 
58
      return true;
59
59
   }
60
60
}
61
61
 
63
63
/**
64
64
 * Whether the blending functions are the reverse of each other.
65
65
 */
66
 
boolean
 
66
bool
67
67
lp_build_blend_func_reverse(enum pipe_blend_func rgb_func,
68
68
                            enum pipe_blend_func alpha_func)
69
69
{
70
70
   if (rgb_func == alpha_func)
71
 
      return FALSE;
 
71
      return false;
72
72
   if (rgb_func == PIPE_BLEND_SUBTRACT && alpha_func == PIPE_BLEND_REVERSE_SUBTRACT)
73
 
      return TRUE;
 
73
      return true;
74
74
   if (rgb_func == PIPE_BLEND_REVERSE_SUBTRACT && alpha_func == PIPE_BLEND_SUBTRACT)
75
 
      return TRUE;
76
 
   return FALSE;
 
75
      return true;
 
76
   return false;
77
77
}
78
78
 
79
79
 
80
80
/**
81
81
 * Whether the blending factors are complementary of each other.
82
82
 */
83
 
static inline boolean
 
83
static inline bool
84
84
lp_build_blend_factor_complementary(unsigned src_factor, unsigned dst_factor)
85
85
{
86
86
   STATIC_ASSERT((PIPE_BLENDFACTOR_ZERO ^ 0x10) == PIPE_BLENDFACTOR_ONE);
93
93
/**
94
94
 * Whether this is a inverse blend factor
95
95
 */
96
 
static inline boolean
 
96
static inline bool
97
97
is_inverse_factor(unsigned factor)
98
98
{
99
99
   STATIC_ASSERT(PIPE_BLENDFACTOR_ZERO == 0x11);
109
109
lp_build_mul_norm_expand(struct lp_build_context *bld,
110
110
                         LLVMValueRef a, LLVMValueRef b,
111
111
                         LLVMValueRef *resl, LLVMValueRef *resh,
112
 
                         boolean signedness_differs)
 
112
                         bool signedness_differs)
113
113
{
114
114
   const struct lp_type type = bld->type;
115
115
   struct lp_type wide_type = lp_wider_type(type);
197
197
               LLVMValueRef dst,
198
198
               LLVMValueRef src_factor,
199
199
               LLVMValueRef dst_factor,
200
 
               boolean not_alpha_dependent,
201
 
               boolean optimise_only)
 
200
               bool not_alpha_dependent,
 
201
               bool optimise_only)
202
202
{
203
203
   LLVMValueRef result, src_term, dst_term;
204
204
 
296
296
      }
297
297
 
298
298
      lp_build_mul_norm_expand(bld, src, src_factor, &src_terml, &src_termh,
299
 
                               is_inverse_factor(factor_src) ? TRUE : FALSE);
 
299
                               is_inverse_factor(factor_src) ? true : false);
300
300
      lp_build_mul_norm_expand(bld, dst, dst_factor, &dst_terml, &dst_termh,
301
 
                               is_inverse_factor(factor_dst) ? TRUE : FALSE);
 
301
                               is_inverse_factor(factor_dst) ? true : false);
302
302
      resl = lp_build_blend_func(&bldw, func, src_terml, dst_terml);
303
303
      resh = lp_build_blend_func(&bldw, func, src_termh, dst_termh);
304
304
 
321
321
                           struct lp_type type,
322
322
                           struct lp_build_mask_context *mask,
323
323
                           LLVMValueRef alpha,
324
 
                           boolean do_branch)
 
324
                           bool do_branch)
325
325
{
326
326
   struct lp_build_context bld;
327
327
   LLVMValueRef test;