nir: Use an integer index for specifying structure fields

Previously, we used a string name.  It was nice for translating out of GLSL
IR (which also does that) but cumbersome the rest of the time.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
Jason Ekstrand
2014-11-25 21:36:25 -08:00
parent 4f8230e247
commit 829aa98320
9 changed files with 74 additions and 82 deletions

View File

@@ -1753,7 +1753,10 @@ nir_visitor::visit(ir_dereference_record *ir)
{
ir->record->accept(this);
nir_deref_struct *deref = nir_deref_struct_create(this->shader, ir->field);
int field_index = this->deref_tail->type->field_index(ir->field);
assert(field_index >= 0);
nir_deref_struct *deref = nir_deref_struct_create(this->shader, field_index);
deref->deref.type = ir->type;
this->deref_tail->child = &deref->deref;
this->deref_tail = &deref->deref;