mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 22:50:08 +01:00
zink: break out spirv shader dumping into separate function
debugging++ Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14976>
This commit is contained in:
parent
ff92d2f188
commit
5663fac5ca
1 changed files with 12 additions and 6 deletions
|
|
@ -1009,6 +1009,17 @@ zink_compiler_assign_io(nir_shader *producer, nir_shader *consumer)
|
|||
optimize_nir(nir);
|
||||
}
|
||||
|
||||
static void
|
||||
zink_shader_dump(void *words, size_t size, const char *file)
|
||||
{
|
||||
FILE *fp = fopen(file, "wb");
|
||||
if (fp) {
|
||||
fwrite(words, 1, size, fp);
|
||||
fclose(fp);
|
||||
fprintf(stderr, "wrote '%s'...\n", file);
|
||||
}
|
||||
}
|
||||
|
||||
VkShaderModule
|
||||
zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shader *base_nir, const struct zink_shader_key *key)
|
||||
{
|
||||
|
|
@ -1129,12 +1140,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad
|
|||
char buf[256];
|
||||
static int i;
|
||||
snprintf(buf, sizeof(buf), "dump%02d.spv", i++);
|
||||
FILE *fp = fopen(buf, "wb");
|
||||
if (fp) {
|
||||
fwrite(spirv->words, sizeof(uint32_t), spirv->num_words, fp);
|
||||
fclose(fp);
|
||||
fprintf(stderr, "wrote '%s'...\n", buf);
|
||||
}
|
||||
zink_shader_dump(spirv->words, spirv->num_words * sizeof(uint32_t), buf);
|
||||
}
|
||||
|
||||
VkShaderModuleCreateInfo smci = {0};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue