aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_shader.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-09-22 16:44:08 +0200
committerSamuel Pitoiset <[email protected]>2017-10-04 19:37:08 +0200
commita2a350a3be1a4f3dec8cc3264a19eb877d606628 (patch)
tree32d8830a1ba76ef648e3ad2a6333fb9e0eded04f /src/amd/vulkan/radv_shader.c
parent94d800bfa364601faee73826c941015e2f15ae05 (diff)
radv: dump NIR when a GPU hang is detected
This looks a bit ugly to me, but the existing codepath is not terribly elegant as well. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_shader.c')
-rw-r--r--src/amd/vulkan/radv_shader.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index ca0ad2d5758..349e291b06a 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -377,6 +377,7 @@ radv_fill_shader_variant(struct radv_device *device,
static struct radv_shader_variant *
shader_variant_create(struct radv_device *device,
+ struct radv_shader_module *module,
struct nir_shader *shader,
gl_shader_stage stage,
struct ac_nir_compiler_options *options,
@@ -430,6 +431,9 @@ shader_variant_create(struct radv_device *device,
if (device->trace_bo) {
variant->disasm_string = binary.disasm_string;
+ if (!gs_copy_shader && !module->nir) {
+ variant->nir = shader;
+ }
} else {
free(binary.disasm_string);
}
@@ -439,6 +443,7 @@ shader_variant_create(struct radv_device *device,
struct radv_shader_variant *
radv_shader_variant_create(struct radv_device *device,
+ struct radv_shader_module *module,
struct nir_shader *shader,
struct radv_pipeline_layout *layout,
const struct ac_shader_variant_key *key,
@@ -454,7 +459,7 @@ radv_shader_variant_create(struct radv_device *device,
options.unsafe_math = !!(device->debug_flags & RADV_DEBUG_UNSAFE_MATH);
options.supports_spill = device->llvm_supports_spill;
- return shader_variant_create(device, shader, shader->stage,
+ return shader_variant_create(device, module, shader, shader->stage,
&options, false, code_out, code_size_out);
}
@@ -469,7 +474,7 @@ radv_create_gs_copy_shader(struct radv_device *device,
options.key.has_multiview_view_index = multiview;
- return shader_variant_create(device, shader, MESA_SHADER_VERTEX,
+ return shader_variant_create(device, NULL, shader, MESA_SHADER_VERTEX,
&options, true, code_out, code_size_out);
}
@@ -484,6 +489,7 @@ radv_shader_variant_destroy(struct radv_device *device,
list_del(&variant->slab_list);
mtx_unlock(&device->shader_slab_mutex);
+ ralloc_free(variant->nir);
free(variant->disasm_string);
free(variant);
}