diff options
author | Jason Ekstrand <[email protected]> | 2017-08-23 17:43:36 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-11-07 10:41:24 -0800 |
commit | df81b81fb91f45e6da0c504ee672d45829c41d06 (patch) | |
tree | 08909c9aa8ca1db66ab43a3fd184157645e845aa | |
parent | ad77775809555bc215f468424215e8dddc7083bf (diff) |
compiler/nir_types: Handle vectors in glsl_get_array_element
Most of NIR doesn't allow doing array indexing on a vector (though it
does on a matrix). However, nir_lower_io handles it just fine and this
behavior is needed for shared variables in Vulkan. This commit makes
glsl_get_array_element do something sensible for vector types and makes
nir_validate happy with them.
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
-rw-r--r-- | src/compiler/nir_types.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index b1b17ebd831..c66cfff8be1 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -39,6 +39,8 @@ glsl_get_array_element(const glsl_type* type) { if (type->is_matrix()) return type->column_type(); + else if (type->is_vector()) + return type->get_scalar_type(); return type->fields.array; } |