nir/lower_shader_calls: name resume shaders
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 12 Apr 2022 13:04:52 +0000 (16:04 +0300)
committerMarge Bot <emma+marge@anholt.net>
Wed, 13 Apr 2022 06:59:29 +0000 (06:59 +0000)
Helpful when lost in a sea of NIR :)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15887>

src/compiler/nir/nir_lower_shader_calls.c

index bf6f763..b568382 100644 (file)
@@ -1115,9 +1115,17 @@ nir_lower_shader_calls(nir_shader *shader,
 
    /* Make N copies of our shader */
    nir_shader **resume_shaders = ralloc_array(mem_ctx, nir_shader *, num_calls);
-   for (unsigned i = 0; i < num_calls; i++)
+   for (unsigned i = 0; i < num_calls; i++) {
       resume_shaders[i] = nir_shader_clone(mem_ctx, shader);
 
+      /* Give them a recognizable name */
+      resume_shaders[i]->info.name =
+         ralloc_asprintf(mem_ctx, "%s%sresume_%u",
+                         shader->info.name ? shader->info.name : "",
+                         shader->info.name ? "-" : "",
+                         i);
+   }
+
    replace_resume_with_halt(shader, NULL);
    for (unsigned i = 0; i < num_calls; i++) {
       nir_instr *resume_instr = lower_resume(resume_shaders[i], i);