radv: copy the spirv module for debugging after compilation
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15766>
This commit is contained in:
@@ -4497,6 +4497,21 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
|
||||
}
|
||||
}
|
||||
|
||||
if (keep_executable_info) {
|
||||
for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i) {
|
||||
struct radv_shader *shader = pipeline->shaders[i];
|
||||
if (!shader)
|
||||
continue;
|
||||
|
||||
if (!modules[i] || modules[i]->nir)
|
||||
continue;
|
||||
|
||||
shader->spirv = malloc(modules[i]->size);
|
||||
memcpy(shader->spirv, modules[i]->data, modules[i]->size);
|
||||
shader->spirv_size = modules[i]->size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Upload shader binaries. */
|
||||
radv_upload_shaders(device, pipeline, binaries, gs_copy_binary);
|
||||
|
||||
|
@@ -2000,17 +2000,6 @@ shader_compile(struct radv_device *device, struct vk_shader_module *module,
|
||||
|
||||
if (keep_shader_info) {
|
||||
shader->nir_string = radv_dump_nir_shaders(shaders, shader_count);
|
||||
if (!gs_copy_shader && !trap_handler_shader && !module->nir) {
|
||||
shader->spirv = malloc(module->size);
|
||||
if (!shader->spirv) {
|
||||
free(shader);
|
||||
free(binary);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(shader->spirv, module->data, module->size);
|
||||
shader->spirv_size = module->size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the shader binary configuration to store it in the cache. */
|
||||
|
Reference in New Issue
Block a user