nir/builder: Add a name format arg to nir_builder_init_simple_shader().

This cleans up a bunch of gross sprintfs and keeps the caller from needing
to remember to ralloc_strdup.  I added a couple of '"%s", name ? name :
""' to radv where I didn't fully trace through whether a non-null name was
being passed in.

I also took the liberty of adding a basic name to a few shaders (pan_blit,
unit tests)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7323>
This commit is contained in:
Eric Anholt
2020-10-26 11:37:25 -07:00
parent 5f992802f5
commit eda3e4e055
39 changed files with 122 additions and 172 deletions
+1 -3
View File
@@ -29,10 +29,8 @@ blorp_nir_init_shader(nir_builder *b,
gl_shader_stage stage,
const char *name)
{
*b = nir_builder_init_simple_shader(stage, NULL);
*b = nir_builder_init_simple_shader(stage, NULL, "%s", name ? name : "");
ralloc_adopt(mem_ctx, b->shader);
if (name != NULL)
b->shader->info.name = ralloc_strdup(b->shader, name);
if (stage == MESA_SHADER_FRAGMENT)
b->shader->info.fs.origin_upper_left = true;
}