/* Generic builder for system values. */
static inline nir_ssa_def *
nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index,
- unsigned bit_size)
+ unsigned num_components, unsigned bit_size)
{
nir_intrinsic_instr *load = nir_intrinsic_instr_create(build->shader, op);
+ if (nir_intrinsic_infos[op].dest_components > 0)
+ assert(num_components == nir_intrinsic_infos[op].dest_components);
+ else
+ load->num_components = num_components;
load->const_index[0] = index;
+
nir_ssa_dest_init(&load->instr, &load->dest,
- nir_intrinsic_infos[op].dest_components, bit_size, NULL);
+ num_components, bit_size, NULL);
nir_builder_instr_insert(build, &load->instr);
return &load->dest.ssa;
}
res = ''
if opcode.indices:
res += ', unsigned ' + opcode.indices[0].lower()
+ if opcode.dest_components == 0:
+ res += ', unsigned num_components'
if len(opcode.bit_sizes) != 1:
res += ', unsigned bit_size'
return res
else:
args.append('0')
+ if opcode.dest_components == 0:
+ args.append('num_components')
+ else:
+ args.append(str(opcode.dest_components))
+
if len(opcode.bit_sizes) == 1:
bit_size = opcode.bit_sizes[0]
args.append(str(bit_size))
nir_intrinsic_op sysval_op =
nir_intrinsic_from_system_value(var->data.location);
return nir_load_system_value(b, sysval_op, 0,
+ intrin->dest.ssa.num_components,
intrin->dest.ssa.bit_size);
}
return nir_load_system_value(b,
nir_intrinsic_load_blend_const_color_r_float +
channel,
- 0, 32);
+ 0, 1, 32);
case PIPE_BLENDFACTOR_CONST_ALPHA:
return nir_load_blend_const_color_a_float(b);
case PIPE_BLENDFACTOR_ZERO:
nir_load_system_value(b,
nir_intrinsic_load_blend_const_color_r_float +
channel,
- 0, 32));
+ 0, 1, 32));
case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
return nir_fsub(b, nir_imm_float(b, 1.0),
nir_load_blend_const_color_a_float(b));