summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_print.c')
-rw-r--r--src/compiler/nir/nir_print.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index a5b29093c5b..eb5f57f9534 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -295,30 +295,37 @@ static void
print_constant(nir_constant *c, const struct glsl_type *type, print_state *state)
{
FILE *fp = state->fp;
- unsigned total_elems = glsl_get_components(type);
- unsigned i;
+ const unsigned rows = glsl_get_vector_elements(type);
+ const unsigned cols = glsl_get_matrix_columns(type);
+ unsigned i, j;
switch (glsl_get_base_type(type)) {
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_BOOL:
- for (i = 0; i < total_elems; i++) {
- if (i > 0) fprintf(fp, ", ");
- fprintf(fp, "0x%08x", c->value.u[i]);
+ for (i = 0; i < cols; i++) {
+ for (j = 0; j < rows; j++) {
+ if (i + j > 0) fprintf(fp, ", ");
+ fprintf(fp, "0x%08x", c->values[i].u32[j]);
+ }
}
break;
case GLSL_TYPE_FLOAT:
- for (i = 0; i < total_elems; i++) {
- if (i > 0) fprintf(fp, ", ");
- fprintf(fp, "%f", c->value.f[i]);
+ for (i = 0; i < cols; i++) {
+ for (j = 0; j < rows; j++) {
+ if (i + j > 0) fprintf(fp, ", ");
+ fprintf(fp, "%f", c->values[i].f32[j]);
+ }
}
break;
case GLSL_TYPE_DOUBLE:
- for (i = 0; i < total_elems; i++) {
- if (i > 0) fprintf(fp, ", ");
- fprintf(fp, "%f", c->value.d[i]);
+ for (i = 0; i < cols; i++) {
+ for (j = 0; j < rows; j++) {
+ if (i + j > 0) fprintf(fp, ", ");
+ fprintf(fp, "%f", c->values[i].f64[j]);
+ }
}
break;