i965/nir/vec4: Add setup of input variables in NIR->vec4 pass

This implementation sets up a map of input variable offsets to source registers
that are already initialized with the corresponding register offset.

This map will then be queried when processing load_input intrinsic operations,
to obtain the correct register source from which the input data will be loaded.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
Eduardo Lima Mitev 2015-06-16 13:50:43 +02:00 committed by Jason Ekstrand
parent 78e7ce2b73
commit b929acb6a8
2 changed files with 12 additions and 1 deletions

View file

@ -410,6 +410,8 @@ public:
virtual void nir_emit_jump(nir_jump_instr *instr);
virtual void nir_emit_texture(nir_tex_instr *instr);
src_reg *nir_inputs;
protected:
void emit_vertex();
void lower_attributes_to_hw_regs(const int *attribute_map,

View file

@ -68,7 +68,16 @@ vec4_visitor::nir_setup_system_values(nir_shader *shader)
void
vec4_visitor::nir_setup_inputs(nir_shader *shader)
{
/* @TODO: Not yet implemented */
nir_inputs = ralloc_array(mem_ctx, src_reg, shader->num_inputs);
foreach_list_typed(nir_variable, var, node, &shader->inputs) {
int offset = var->data.driver_location;
unsigned size = type_size(var->type);
for (unsigned i = 0; i < size; i++) {
src_reg src = src_reg(ATTR, var->data.location + i, var->type);
nir_inputs[offset + i] = src;
}
}
}
void