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++) {
+ /* Only float base types can be matrices. */
+ assert(cols == 1);
+
+ for (i = 0; i < rows; i++) {
if (i > 0) fprintf(fp, ", ");
- fprintf(fp, "0x%08x", c->value.u[i]);
+ fprintf(fp, "0x%08x", c->values[0].u32[i]);
}
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++) {
+ 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;
+
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
+ /* Only float base types can be matrices. */
+ assert(cols == 1);
+
+ for (i = 0; i < cols; i++) {
if (i > 0) fprintf(fp, ", ");
- fprintf(fp, "%f", c->value.d[i]);
+ fprintf(fp, "0x%08" PRIx64, c->values[0].u64[i]);
}
break;
case nir_tex_src_projector:
fprintf(fp, "(projector)");
break;
- case nir_tex_src_comparitor:
- fprintf(fp, "(comparitor)");
+ case nir_tex_src_comparator:
+ fprintf(fp, "(comparator)");
break;
case nir_tex_src_offset:
fprintf(fp, "(offset)");
if (shader->info->label)
fprintf(fp, "label: %s\n", shader->info->label);
+ switch (shader->stage) {
+ case MESA_SHADER_COMPUTE:
+ fprintf(fp, "local-size: %u, %u, %u%s\n",
+ shader->info->cs.local_size[0],
+ shader->info->cs.local_size[1],
+ shader->info->cs.local_size[2],
+ shader->info->cs.local_size_variable ? " (variable)" : "");
+ fprintf(fp, "shared-size: %u\n", shader->info->cs.shared_size);
+ break;
+ default:
+ break;
+ }
+
fprintf(fp, "inputs: %u\n", shader->num_inputs);
fprintf(fp, "outputs: %u\n", shader->num_outputs);
fprintf(fp, "uniforms: %u\n", shader->num_uniforms);