summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_print.c
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2017-10-27 18:15:46 -0700
committerMatt Turner <[email protected]>2017-11-08 13:22:26 -0800
commit77a63d190a9bd6bcb6d6d8eb9bc734c0b18ee0e3 (patch)
treefbc898e588f98e7bf340391963377ec6b7f367eb /src/compiler/nir/nir_print.c
parent34593e978c9331ad09ab10e8fcafa3809615e63d (diff)
nir: Don't print swizzles when there are more than 4 components
... as can happen with various types like mat4, or else we'll smash the stack writing past the end of components_local[]. Fixes: 5a0d3e1129b7 ("nir: Print the components referenced for split or packed shader in/outs.") Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_print.c')
-rw-r--r--src/compiler/nir/nir_print.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 4b7ad5c6ba2..fcc8025346e 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -457,7 +457,7 @@ print_var_decl(nir_variable *var, print_state *state)
switch (var->data.mode) {
case nir_var_shader_in:
case nir_var_shader_out:
- if (num_components != 4 && num_components != 0) {
+ if (num_components < 4 && num_components != 0) {
const char *xyzw = "xyzw";
for (int i = 0; i < num_components; i++)
components_local[i + 1] = xyzw[i + var->data.location_frac];