diff options
author | Jason Ekstrand <[email protected]> | 2014-11-25 21:36:25 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:19:02 -0800 |
commit | 829aa98320fcd529407d16991b476b71af017479 (patch) | |
tree | 5ff603507c7cded684a6ee460126b64c1e02f112 /src/glsl/nir/glsl_to_nir.cpp | |
parent | 4f8230e247a222314ab124e348482628adb5af32 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/glsl/nir/glsl_to_nir.cpp')
-rw-r--r-- | src/glsl/nir/glsl_to_nir.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp index 6b90da5481c..19bc664961c 100644 --- a/src/glsl/nir/glsl_to_nir.cpp +++ b/src/glsl/nir/glsl_to_nir.cpp @@ -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; |