device->ws->cs_dump(cs, f, (const int*)device->trace_id_ptr, 2);
fclose(f);
}
+
+void
+radv_print_spirv(struct radv_shader_module *module, FILE *fp)
+{
+ char path[] = "/tmp/fileXXXXXX";
+ char line[2048], command[128];
+ FILE *p;
+ int fd;
+
+ /* Dump the binary into a temporary file. */
+ fd = mkstemp(path);
+ if (fd < 0)
+ return;
+
+ if (write(fd, module->data, module->size) == -1)
+ goto fail;
+
+ sprintf(command, "spirv-dis %s", path);
+
+ /* Disassemble using spirv-dis if installed. */
+ p = popen(command, "r");
+ if (p) {
+ while (fgets(line, sizeof(line), p))
+ fprintf(fp, "%s", line);
+ pclose(p);
+ }
+
+fail:
+ close(fd);
+ unlink(path);
+}
RADV_DEBUG_UNSAFE_MATH = 0x80,
RADV_DEBUG_ALL_BOS = 0x100,
RADV_DEBUG_NO_IBS = 0x200,
+ RADV_DEBUG_DUMP_SPIRV = 0x400,
};
enum {
void
radv_dump_trace(struct radv_device *device, struct radeon_winsys_cs *cs);
+void
+radv_print_spirv(struct radv_shader_module *module, FILE *fp);
+
#endif
{"unsafemath", RADV_DEBUG_UNSAFE_MATH},
{"allbos", RADV_DEBUG_ALL_BOS},
{"noibs", RADV_DEBUG_NO_IBS},
+ {"spirv", RADV_DEBUG_DUMP_SPIRV},
{NULL, 0}
};
uint32_t *spirv = (uint32_t *) module->data;
assert(module->size % 4 == 0);
+ if (device->debug_flags & RADV_DEBUG_DUMP_SPIRV)
+ radv_print_spirv(module, stderr);
+
uint32_t num_spec_entries = 0;
struct nir_spirv_specialization *spec_entries = NULL;
if (spec_info && spec_info->mapEntryCount > 0) {