diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index 14f579baf41..3b9b3f29204 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -225,6 +225,9 @@ struct ir3_sampler_prefetch { /* Configuration key used to identify a shader variant.. different * shader variants can be used to implement features not supported * in hw (two sided color), binning-pass vertex shader, etc. + * + * When adding to this struct, please update ir3_shader_variant()'s debug + * output. */ struct ir3_shader_key { union { @@ -651,6 +654,11 @@ struct ir3_shader { uint32_t id; uint32_t variant_count; + /* Set by freedreno after shader_state_create, so we can emit debug info + * when recompiling a shader at draw time. + */ + bool initial_variants_done; + struct ir3_compiler *compiler; struct ir3_ubo_analysis_state ubo_state; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index f58e295b5a7..6e31fa0195a 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -86,6 +86,17 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key, v = ir3_shader_get_variant(shader, &key, binning_pass, &created); if (created) { + if (shader->initial_variants_done) { + pipe_debug_message(debug, SHADER_INFO, + "%s shader: recompiling at draw time: global 0x%08x, vsats %x/%x/%x, fsats %x/%x/%x, vfsamples %x/%x, astc %x/%x\n", + ir3_shader_stage(v), + key.global, + key.vsaturate_s, key.vsaturate_t, key.vsaturate_r, + key.fsaturate_s, key.fsaturate_t, key.fsaturate_r, + key.vsamples, key.fsamples, + key.vastc_srgb, key.fastc_srgb); + + } dump_shader_info(v, binning_pass, debug); } @@ -176,6 +187,8 @@ ir3_shader_create(struct ir3_compiler *compiler, ir3_shader_variant(shader, key, true, debug); } + shader->initial_variants_done = true; + return shader; } @@ -211,6 +224,8 @@ ir3_shader_create_compute(struct ir3_compiler *compiler, ir3_shader_variant(shader, key, false, debug); } + shader->initial_variants_done = true; + return shader; }