summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_shader.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-10-28 16:56:15 +0100
committerSamuel Pitoiset <[email protected]>2019-10-30 13:02:08 +0000
commitd4e0bef1bbbe442fb6006ed13dac7ab7bca5e3fd (patch)
treed4744e1d98e43e5604e9f1024bbf7f0ffb46836c /src/amd/vulkan/radv_shader.c
parent4f8c86e6a58980df524796048e12695e07b78a95 (diff)
radv: fix dumping SPIR-V into hang reports
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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index a5ad594207d..c841a2f0726 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -312,7 +312,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
assert(module->size % 4 == 0);
if (device->instance->debug_flags & RADV_DEBUG_DUMP_SPIRV)
- radv_print_spirv(spirv, module->size, stderr);
+ radv_print_spirv(module->data, module->size, stderr);
uint32_t num_spec_entries = 0;
struct nir_spirv_specialization *spec_entries = NULL;
@@ -1145,7 +1145,14 @@ shader_variant_compile(struct radv_device *device,
if (keep_shader_info) {
variant->nir_string = radv_dump_nir_shaders(shaders, shader_count);
if (!gs_copy_shader && !module->nir) {
- variant->spirv = (uint32_t *)module->data;
+ variant->spirv = malloc(module->size);
+ if (!variant->spirv) {
+ free(variant);
+ free(binary);
+ return NULL;
+ }
+
+ memcpy(variant->spirv, module->data, module->size);
variant->spirv_size = module->size;
}
}
@@ -1211,6 +1218,7 @@ radv_shader_variant_destroy(struct radv_device *device,
list_del(&variant->slab_list);
mtx_unlock(&device->shader_slab_mutex);
+ free(variant->spirv);
free(variant->nir_string);
free(variant->disasm_string);
free(variant->ir_string);