nir_print_shader(nir, stderr);
}
- nir_convert_from_ssa(nir, true);
+ nir_convert_from_ssa(nir, is_scalar);
nir_validate_shader(nir);
/* This is the last pass we run before we start emitting stuff. It
const glsl_type *type) = 0;
dst_reg *nir_locals;
+ dst_reg *nir_ssa_values;
src_reg *nir_inputs;
unsigned *nir_uniform_driver_location;
dst_reg *nir_system_values;
nir_locals[reg->index] = dst_reg(GRF, alloc.allocate(array_elems));
}
+ nir_ssa_values = ralloc_array(mem_ctx, dst_reg, impl->ssa_alloc);
+
nir_emit_cf_list(&impl->body);
}
void
vec4_visitor::nir_emit_load_const(nir_load_const_instr *instr)
{
- /* @TODO: Not yet implemented */
+ dst_reg reg = dst_reg(GRF, alloc.allocate(1));
+ reg.type = BRW_REGISTER_TYPE_F;
+
+ /* @FIXME: consider emitting vector operations to save some MOVs in
+ * cases where the components are representable in 8 bits.
+ * By now, we emit a MOV for each component.
+ */
+ for (unsigned i = 0; i < instr->def.num_components; ++i) {
+ reg.writemask = 1 << i;
+ emit(MOV(reg, src_reg(instr->value.f[i])));
+ }
+
+ /* Set final writemask */
+ reg.writemask = brw_writemask_for_size(instr->def.num_components);
+
+ nir_ssa_values[instr->def.index] = reg;
}
void