radv: dump the trap handler shader with RADV_DEBUG=dump_trap_handler

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32031>
This commit is contained in:
Samuel Pitoiset
2024-11-07 14:12:01 +01:00
committed by Marge Bot
parent 4d50691ae9
commit 30d9166d80
4 changed files with 14 additions and 3 deletions
+2
View File
@@ -1329,6 +1329,8 @@ RADV driver environment variables
force all allocated buffers to be referenced in submissions
``checkir``
validate the LLVM IR before LLVM compiles the shader
``dump_trap_handler``
dump the trap handler shader
``epilogs``
dump fragment shader epilogs
``extra_md``
+1
View File
@@ -60,6 +60,7 @@ enum {
RADV_DEBUG_NO_ESO = 1ull << 44,
RADV_DEBUG_PSO_CACHE_STATS = 1ull << 45,
RADV_DEBUG_NIR_DEBUG_INFO = 1ull << 46,
RADV_DEBUG_DUMP_TRAP_HANDLER = 1ull << 47,
};
enum {
+1
View File
@@ -73,6 +73,7 @@ static const struct debug_control radv_debug_options[] = {{"nofastclears", RADV_
{"noeso", RADV_DEBUG_NO_ESO},
{"psocachestats", RADV_DEBUG_PSO_CACHE_STATS},
{"nirdebuginfo", RADV_DEBUG_NIR_DEBUG_INFO},
{"dump_trap_handler", RADV_DEBUG_DUMP_TRAP_HANDLER},
{NULL, 0}};
const char *
+10 -3
View File
@@ -3123,12 +3123,16 @@ radv_shader_generate_debug_info(struct radv_device *device, bool dump_shader, bo
struct radv_shader *
radv_create_trap_handler_shader(struct radv_device *device)
{
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
gl_shader_stage stage = MESA_SHADER_COMPUTE;
struct radv_shader_stage_key stage_key = {0};
struct radv_shader_info info = {0};
struct radv_nir_compiler_options options = {0};
radv_fill_nir_compiler_options(&options, device, NULL, radv_should_use_wgp_mode(device, stage, &info), false, false,
false);
const bool dump_shader = !!(instance->debug_flags & RADV_DEBUG_DUMP_TRAP_HANDLER);
radv_fill_nir_compiler_options(&options, device, NULL, radv_should_use_wgp_mode(device, stage, &info), dump_shader,
false, false);
nir_builder b = radv_meta_init_shader(device, stage, "meta_trap_handler");
@@ -3144,6 +3148,9 @@ radv_create_trap_handler_shader(struct radv_device *device)
struct radv_shader *shader;
radv_shader_create_uncached(device, binary, false, NULL, &shader);
radv_shader_generate_debug_info(device, dump_shader, false, binary, shader, &b.shader, 1, &info);
free(shader->disasm_string);
ralloc_free(b.shader);
free(binary);
@@ -3442,7 +3449,7 @@ radv_get_shader_name(const struct radv_shader_info *info, gl_shader_stage stage)
case MESA_SHADER_FRAGMENT:
return "Pixel Shader";
case MESA_SHADER_COMPUTE:
return "Compute Shader";
return info->type == RADV_SHADER_TYPE_TRAP_HANDLER ? "Trap Handler Shader" : "Compute Shader";
case MESA_SHADER_MESH:
return "Mesh Shader as NGG";
case MESA_SHADER_TASK: