print_src(&instr->src[src].src, state);
bool print_swizzle = false;
+ unsigned used_channels = 0;
+
for (unsigned i = 0; i < 4; i++) {
if (!nir_alu_instr_channel_used(instr, src, i))
continue;
+ used_channels++;
+
if (instr->src[src].swizzle[i] != i) {
print_swizzle = true;
break;
}
}
- if (print_swizzle) {
+ unsigned live_channels = instr->src[src].src.is_ssa
+ ? instr->src[src].src.ssa->num_components
+ : instr->src[src].src.reg.reg->num_components;
+
+ if (print_swizzle || used_channels != live_channels) {
fprintf(fp, ".");
for (unsigned i = 0; i < 4; i++) {
if (!nir_alu_instr_channel_used(instr, src, i))
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;
const char *const inv = (var->data.invariant) ? "invariant " : "";
fprintf(fp, "%s%s%s%s%s %s ",
cent, samp, patch, inv, get_variable_mode_str(var->data.mode),
- glsl_interp_qualifier_name(var->data.interpolation));
+ glsl_interp_mode_name(var->data.interpolation));
const char *const coher = (var->data.image.coherent) ? "coherent " : "";
const char *const volat = (var->data.image._volatile) ? "volatile " : "";
const char *const wonly = (var->data.image.write_only) ? "writeonly " : "";
fprintf(fp, "%s%s%s%s%s", coher, volat, restr, ronly, wonly);
- glsl_print_type(var->type, fp);
-
- fprintf(fp, " %s", get_var_name(var, state));
+ fprintf(fp, "%s %s", glsl_get_type_name(var->type),
+ get_var_name(var, state));
if (var->data.mode == nir_var_shader_in ||
var->data.mode == nir_var_shader_out ||
loc = buf;
}
- fprintf(fp, " (%s, %u)", loc, var->data.driver_location);
+ fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding,
+ var->data.compact ? " compact" : "");
}
if (var->constant_initializer) {
print_arg(nir_variable *var, print_state *state)
{
FILE *fp = state->fp;
- glsl_print_type(var->type, fp);
- fprintf(fp, " %s", get_var_name(var, state));
+ fprintf(fp, "%s %s", glsl_get_type_name(var->type),
+ get_var_name(var, state));
}
static void
[NIR_INTRINSIC_RANGE] = "range",
[NIR_INTRINSIC_DESC_SET] = "desc-set",
[NIR_INTRINSIC_BINDING] = "binding",
+ [NIR_INTRINSIC_COMPONENT] = "component",
+ [NIR_INTRINSIC_INTERP_MODE] = "interp_mode",
};
for (unsigned idx = 1; idx < NIR_INTRINSIC_NUM_INDEX_FLAGS; idx++) {
if (!info->index_map[idx])
nir_foreach_variable(var, var_list) {
if ((var->data.driver_location == nir_intrinsic_base(instr)) &&
+ (instr->intrinsic == nir_intrinsic_load_uniform ||
+ var->data.location_frac == nir_intrinsic_component(instr)) &&
var->name) {
fprintf(fp, "\t/* %s */", var->name);
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)");
case nir_tex_src_sampler_offset:
fprintf(fp, "(sampler_offset)");
break;
+ case nir_tex_src_plane:
+ fprintf(fp, "(plane)");
+ break;
default:
unreachable("Invalid texture source type");
unreachable("Invalid parameter type");
}
- glsl_print_type(function->params[i].type, fp);
+ fprintf(fp, "%s", glsl_get_type_name(function->params[i].type));
}
if (function->return_type != NULL) {
if (function->num_params != 0)
fprintf(fp, ", ");
- fprintf(fp, "returning ");
- glsl_print_type(function->return_type, fp);
+ fprintf(fp, "returning %s", glsl_get_type_name(function->return_type));
}
fprintf(fp, "\n");
fprintf(fp, "shader: %s\n", gl_shader_stage_name(shader->stage));
- if (shader->info.name)
- fprintf(fp, "name: %s\n", shader->info.name);
+ if (shader->info->name)
+ fprintf(fp, "name: %s\n", shader->info->name);
+
+ if (shader->info->label)
+ fprintf(fp, "label: %s\n", shader->info->label);
- 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);