int one_reg = spe_allocate_available_register(f);
int tmp_reg = spe_allocate_available_register(f);
+ boolean one_reg_set = false; /* avoid setting one_reg more than once */
+
ASSERT(blend->blend_enable);
/* Unpack/convert framebuffer colors from four 32-bit packed colors
int mask_reg = spe_allocate_available_register(f);
/* mask = {0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff} */
- spe_fsmbi(f, mask_reg, 0x1111);
+ spe_load_int(f, mask_reg, 0xff);
/* XXX there may be more clever ways to implement the following code */
switch (color_format) {
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
/* one = {1.0, 1.0, 1.0, 1.0} */
- spe_load_float(f, one_reg, 1.0f);
+ if (!one_reg_set) {
+ spe_load_float(f, one_reg, 1.0f);
+ one_reg_set = true;
+ }
/* tmp = one - fragA */
spe_fs(f, tmp_reg, one_reg, fragA_reg);
/* term = fb * tmp */
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
/* one = {1.0, 1.0, 1.0, 1.0} */
- spe_load_float(f, one_reg, 1.0f);
+ if (!one_reg_set) {
+ spe_load_float(f, one_reg, 1.0f);
+ one_reg_set = true;
+ }
/* tmp = one - fragA */
spe_fs(f, tmp_reg, one_reg, fragA_reg);
/* termA = fbA * tmp */