summaryrefslogtreecommitdiff
path: root/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-12-12 14:32:19 -0600
committerJason Ekstrand <jason@jlekstrand.net>2019-01-08 00:38:29 +0000
commit6cebeb4f71918aded1ddade5727f79fae83780fd (patch)
tree9de5dba8aa2944b15f516d541abe8ad7f62c54c1 /src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
parent7f70b3e55514f1744e9aab6d2145e855603bd1dc (diff)
glsl_type: Add support for explicitly laid out matrices and arrays
SPIR-V allows for matrix and array types to be decorated with explicit byte stride decorations and matrix types to be decorated row- or column-major. This commit adds support to glsl_type to encode this information. Because this doesn't work nicely with std430 and std140 alignments, we add asserts to ensure that we don't use any of the std430 or std140 layout functions with explicitly laid out types. In SPIR-V, the layout information for matrices is applied to the parent struct member instead of to the matrix type itself. However, this is gets rather clumsy when you're walking derefs trying to compute offsets because, the moment you hit a matrix, you have to crawl back the deref chain and find the struct. Instead, we take the same path here as we've taken in spirv_to_nir and put the decorations on the matrix type itself. This also subtly adds support for strided vector types. These don't come up in SPIR-V directly but you can get one as the result of taking a column from a row-major matrix or a row from a column-major matrix. Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Diffstat (limited to 'src/compiler/nir/nir_lower_clip_cull_distance_arrays.c')
-rw-r--r--src/compiler/nir/nir_lower_clip_cull_distance_arrays.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
index 2afbf9285c0..6e1557ef40d 100644
--- a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
+++ b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
@@ -62,10 +62,10 @@ get_unwrapped_array_length(nir_shader *nir, nir_variable *var)
static void
update_type(nir_variable *var, gl_shader_stage stage, unsigned length)
{
- const struct glsl_type *type = glsl_array_type(glsl_float_type(), length);
+ const struct glsl_type *type = glsl_array_type(glsl_float_type(), length, 0);
if (nir_is_per_vertex_io(var, stage))
- type = glsl_array_type(type, glsl_get_length(var->type));
+ type = glsl_array_type(type, glsl_get_length(var->type), 0);
var->type = type;
}