--- src/mesa/program/sampler.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp index 34eee6d..0017328 100644 --- a/src/mesa/program/sampler.cpp +++ b/src/mesa/program/sampler.cpp @@ -87,7 +87,17 @@ public: if (ir->type->without_array()->is_record()) { this->name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i); } else { - offset = i; + if (ir->type->is_array()) { + unsigned current_dim = 1; + const glsl_type *type = ir->type; + while (type->fields.array->is_array()) { + current_dim++; + type = type->fields.array; + } + offset += pow(ir->type->length, current_dim) * i; + } else { + offset += i; + } } return visit_continue; } -- 2.1.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev