loc = buf;
}
- fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding,
+ /* For shader I/O vars that have been split to components or packed,
+ * print the fractional location within the input/output.
+ */
+ unsigned int num_components =
+ glsl_get_components(glsl_without_array(var->type));
+ const char *components = NULL;
+ char components_local[6] = {'.' /* the rest is 0-filled */};
+ switch (var->data.mode) {
+ case nir_var_shader_in:
+ case nir_var_shader_out:
+ 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];
+
+ components = components_local;
+ }
+ break;
+ default:
+ break;
+ }
+
+ fprintf(fp, " (%s%s, %u, %u)%s", loc,
+ components ? components : "",
+ var->data.driver_location, var->data.binding,
var->data.compact ? " compact" : "");
}