nir/print: Use //
for comments
Makes it easier to copy snippets of shaders into code or test comments without worrying about conflict with `/* */`. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23564>
This commit is contained in:
@@ -1047,19 +1047,18 @@ print_deref_instr(nir_deref_instr *instr, print_state *state)
|
|||||||
}
|
}
|
||||||
fprintf(fp, " %s)", glsl_get_type_name(instr->type));
|
fprintf(fp, " %s)", glsl_get_type_name(instr->type));
|
||||||
|
|
||||||
if (instr->deref_type != nir_deref_type_var &&
|
|
||||||
instr->deref_type != nir_deref_type_cast) {
|
|
||||||
/* Print the entire chain as a comment */
|
|
||||||
fprintf(fp, " /* &");
|
|
||||||
print_deref_link(instr, true, state);
|
|
||||||
fprintf(fp, " */");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instr->deref_type == nir_deref_type_cast) {
|
if (instr->deref_type == nir_deref_type_cast) {
|
||||||
fprintf(fp, " (ptr_stride=%u, align_mul=%u, align_offset=%u)",
|
fprintf(fp, " (ptr_stride=%u, align_mul=%u, align_offset=%u)",
|
||||||
instr->cast.ptr_stride,
|
instr->cast.ptr_stride,
|
||||||
instr->cast.align_mul, instr->cast.align_offset);
|
instr->cast.align_mul, instr->cast.align_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (instr->deref_type != nir_deref_type_var &&
|
||||||
|
instr->deref_type != nir_deref_type_cast) {
|
||||||
|
/* Print the entire chain as a comment */
|
||||||
|
fprintf(fp, " // &");
|
||||||
|
print_deref_link(instr, true, state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
@@ -1476,7 +1475,7 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
|
|||||||
nir_intrinsic_component(instr) <
|
nir_intrinsic_component(instr) <
|
||||||
(var->data.location_frac + glsl_get_components(var->type)))) &&
|
(var->data.location_frac + glsl_get_components(var->type)))) &&
|
||||||
var->name) {
|
var->name) {
|
||||||
fprintf(fp, "\t/* %s */", var->name);
|
fprintf(fp, " // %s", var->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1873,11 +1872,11 @@ print_block(nir_block *block, print_state *state, unsigned tabs)
|
|||||||
nir_block **preds = nir_block_get_predecessors_sorted(block, NULL);
|
nir_block **preds = nir_block_get_predecessors_sorted(block, NULL);
|
||||||
|
|
||||||
print_indentation(tabs, fp);
|
print_indentation(tabs, fp);
|
||||||
fprintf(fp, "/* preds: ");
|
fprintf(fp, "// preds: ");
|
||||||
for (unsigned i = 0; i < block->predecessors->entries; i++) {
|
for (unsigned i = 0; i < block->predecessors->entries; i++) {
|
||||||
fprintf(fp, "b%u ", preds[i]->index);
|
fprintf(fp, "b%u ", preds[i]->index);
|
||||||
}
|
}
|
||||||
fprintf(fp, "*/\n");
|
fprintf(fp, "\n");
|
||||||
|
|
||||||
ralloc_free(preds);
|
ralloc_free(preds);
|
||||||
|
|
||||||
@@ -1888,12 +1887,12 @@ print_block(nir_block *block, print_state *state, unsigned tabs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_indentation(tabs, fp);
|
print_indentation(tabs, fp);
|
||||||
fprintf(fp, "/* succs: ");
|
fprintf(fp, "// succs: ");
|
||||||
for (unsigned i = 0; i < 2; i++)
|
for (unsigned i = 0; i < 2; i++)
|
||||||
if (block->successors[i]) {
|
if (block->successors[i]) {
|
||||||
fprintf(fp, "b%u ", block->successors[i]->index);
|
fprintf(fp, "b%u ", block->successors[i]->index);
|
||||||
}
|
}
|
||||||
fprintf(fp, "*/\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1906,13 +1905,13 @@ print_if(nir_if *if_stmt, print_state *state, unsigned tabs)
|
|||||||
print_src(&if_stmt->condition, state, nir_type_invalid);
|
print_src(&if_stmt->condition, state, nir_type_invalid);
|
||||||
switch (if_stmt->control) {
|
switch (if_stmt->control) {
|
||||||
case nir_selection_control_flatten:
|
case nir_selection_control_flatten:
|
||||||
fprintf(fp, " /* flatten */");
|
fprintf(fp, " // flatten");
|
||||||
break;
|
break;
|
||||||
case nir_selection_control_dont_flatten:
|
case nir_selection_control_dont_flatten:
|
||||||
fprintf(fp, " /* don't flatten */");
|
fprintf(fp, " // don't flatten");
|
||||||
break;
|
break;
|
||||||
case nir_selection_control_divergent_always_taken:
|
case nir_selection_control_divergent_always_taken:
|
||||||
fprintf(fp, " /* divergent always taken */");
|
fprintf(fp, " // divergent always taken");
|
||||||
break;
|
break;
|
||||||
case nir_selection_control_none:
|
case nir_selection_control_none:
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user