mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 11:20:20 +01:00
radv: Use the SPIR-V printer in spirv_to_nir
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30875>
This commit is contained in:
parent
6e3938f45b
commit
3e1d847d37
3 changed files with 3 additions and 30 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "radv_pipeline_rt.h"
|
||||
#include "radv_shader.h"
|
||||
#include "sid.h"
|
||||
#include "spirv/nir_spirv.h"
|
||||
|
||||
#define TMA_BO_SIZE 4096
|
||||
|
||||
|
|
@ -389,7 +390,7 @@ radv_dump_shader(struct radv_device *device, struct radv_pipeline *pipeline, str
|
|||
_mesa_sha1_format(sha1buf, sha1);
|
||||
|
||||
if (device->vk.enabled_features.deviceFaultVendorBinary) {
|
||||
radv_print_spirv(shader->spirv, shader->spirv_size, f);
|
||||
spirv_print_asm(f, (const uint32_t *)shader->spirv, shader->spirv_size / 4);
|
||||
} else {
|
||||
fprintf(f, "SPIRV (see %s.spv)\n\n", sha1buf);
|
||||
radv_dump_spirv(shader, sha1buf, dump_dir);
|
||||
|
|
@ -871,32 +872,6 @@ radv_check_gpu_hangs(struct radv_queue *queue, const struct radv_winsys_submit_i
|
|||
return VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
void
|
||||
radv_print_spirv(const char *data, uint32_t size, FILE *fp)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
char path[] = "/tmp/fileXXXXXX";
|
||||
char command[128];
|
||||
int fd;
|
||||
|
||||
/* Dump the binary into a temporary file. */
|
||||
fd = mkstemp(path);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
if (write(fd, data, size) == -1)
|
||||
goto fail;
|
||||
|
||||
/* Disassemble using spirv-dis if installed. */
|
||||
sprintf(command, "spirv-dis %s", path);
|
||||
radv_dump_cmd(command, fp);
|
||||
|
||||
fail:
|
||||
close(fd);
|
||||
unlink(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
radv_trap_handler_init(struct radv_device *device)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,8 +86,6 @@ void radv_finish_trace(struct radv_device *device);
|
|||
|
||||
VkResult radv_check_gpu_hangs(struct radv_queue *queue, const struct radv_winsys_submit_info *submit_info);
|
||||
|
||||
void radv_print_spirv(const char *data, uint32_t size, FILE *fp);
|
||||
|
||||
void radv_dump_enabled_options(const struct radv_device *device, FILE *f);
|
||||
|
||||
bool radv_trap_handler_init(struct radv_device *device);
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
|
|||
|
||||
bool dump_meta = instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS;
|
||||
if ((instance->debug_flags & RADV_DEBUG_DUMP_SPIRV) && (!is_internal || dump_meta))
|
||||
radv_print_spirv(stage->spirv.data, stage->spirv.size, stderr);
|
||||
spirv_print_asm(stderr, (const uint32_t *)stage->spirv.data, stage->spirv.size / 4);
|
||||
|
||||
uint32_t num_spec_entries = 0;
|
||||
struct nir_spirv_specialization *spec_entries = vk_spec_info_to_nir_spirv(stage->spec_info, &num_spec_entries);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue