if (!shader)
return;
- fprintf(f, "%s:\n%s\n\n", radv_get_shader_name(shader, stage),
- shader->disasm_string);
+ fprintf(f, "%s:\n\n", radv_get_shader_name(shader, stage));
+
+ if (shader->nir) {
+ fprintf(f, "NIR:\n");
+ nir_print_shader(shader->nir, f);
+ }
+
+ fprintf(stderr, "DISASM:\n%s\n", shader->disasm_string);
radv_shader_dump_stats(pipeline->device, shader, stage, f);
}
return NULL;
if (!variant) {
- variant = radv_shader_variant_create(pipeline->device, nir,
+ variant = radv_shader_variant_create(pipeline->device, module, nir,
layout, key, &code,
&code_size);
}
free(gs_copy_code);
}
- if (!module->nir)
+ if (!module->nir && !pipeline->device->trace_bo)
ralloc_free(nir);
if (variant)
nir_lower_tes_patch_vertices(tes_nir,
tcs_nir->info.tess.tcs_vertices_out);
- tes_variant = radv_shader_variant_create(pipeline->device, tes_nir,
+ tes_variant = radv_shader_variant_create(pipeline->device, tes_module, tes_nir,
layout, &tes_key, &tes_code,
&tes_code_size);
radv_hash_shader(tcs_sha1, tcs_module, tcs_entrypoint, tcs_spec_info, layout, &tcs_key, 0);
- tcs_variant = radv_shader_variant_create(pipeline->device, tcs_nir,
+ tcs_variant = radv_shader_variant_create(pipeline->device, tcs_module, tcs_nir,
layout, &tcs_key, &tcs_code,
&tcs_code_size);
- if (!tes_module->nir)
+ if (!tes_module->nir && !pipeline->device->trace_bo)
ralloc_free(tes_nir);
- if (!tcs_module->nir)
+ if (!tcs_module->nir && !pipeline->device->trace_bo)
ralloc_free(tcs_nir);
if (tes_variant)
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,
if (device->trace_bo) {
variant->disasm_string = binary.disasm_string;
+ if (!gs_copy_shader && !module->nir) {
+ variant->nir = shader;
+ }
} else {
free(binary.disasm_string);
}
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,
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);
}
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);
}
list_del(&variant->slab_list);
mtx_unlock(&device->shader_slab_mutex);
+ ralloc_free(variant->nir);
free(variant->disasm_string);
free(variant);
}
struct ac_shader_variant_info info;
unsigned rsrc1;
unsigned rsrc2;
- char *disasm_string; /* debug only */
+
+ /* debug only */
+ struct nir_shader *nir;
+ char *disasm_string;
struct list_head slab_list;
};
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,