};
struct vc4_uncompiled_shader {
+ /** A name for this program, so you can track it in shader-db output. */
+ uint32_t program_id;
+ /** How many variants of this program were compiled, for shader-db. */
+ uint32_t compiled_variant_count;
struct pipe_shader_state base;
const struct tgsi_token *twoside_tokens;
};
struct primconvert_context *primconvert;
struct util_hash_table *fs_cache, *vs_cache;
+ uint32_t next_uncompiled_program_id;
uint64_t next_compiled_program_id;
struct ra_regs *regs;
c->stage = stage;
c->shader_state = &key->shader_state->base;
+ c->program_id = key->shader_state->program_id;
+ c->variant_id = key->shader_state->compiled_variant_count++;
c->key = key;
switch (stage) {
assert(ret == TGSI_PARSE_OK);
if (vc4_debug & VC4_DEBUG_TGSI) {
- fprintf(stderr, "TGSI:\n");
+ fprintf(stderr, "%s prog %d/%d TGSI:\n",
+ qir_get_stage_name(c->stage),
+ c->program_id, c->variant_id);
tgsi_dump(tokens, 0);
}
qir_optimize(c);
if (vc4_debug & VC4_DEBUG_QIR) {
- fprintf(stderr, "QIR:\n");
+ fprintf(stderr, "%s prog %d/%d QIR:\n",
+ qir_get_stage_name(c->stage),
+ c->program_id, c->variant_id);
qir_dump(c);
}
qir_reorder_uniforms(c);
vc4_generate_code(vc4, c);
if (vc4_debug & VC4_DEBUG_SHADERDB) {
- fprintf(stderr, "SHADER-DB: %s: %d instructions\n",
- qir_get_stage_name(c->stage), c->qpu_inst_count);
- fprintf(stderr, "SHADER-DB: %s: %d uniforms\n",
- qir_get_stage_name(c->stage), c->num_uniforms);
+ fprintf(stderr, "SHADER-DB: %s prog %d/%d: %d instructions\n",
+ qir_get_stage_name(c->stage),
+ c->program_id, c->variant_id,
+ c->qpu_inst_count);
+ fprintf(stderr, "SHADER-DB: %s prog %d/%d: %d uniforms\n",
+ qir_get_stage_name(c->stage),
+ c->program_id, c->variant_id,
+ c->num_uniforms);
}
return c;
vc4_shader_state_create(struct pipe_context *pctx,
const struct pipe_shader_state *cso)
{
+ struct vc4_context *vc4 = vc4_context(pctx);
struct vc4_uncompiled_shader *so = CALLOC_STRUCT(vc4_uncompiled_shader);
if (!so)
return NULL;
so->base.tokens = tgsi_transform_lowering(&lowering_config, cso->tokens, &info);
if (!so->base.tokens)
so->base.tokens = tgsi_dup_tokens(cso->tokens);
+ so->program_id = vc4->next_uncompiled_program_id++;
return so;
}
static void
vc4_dump_program(struct vc4_compile *c)
{
- fprintf(stderr, "%s:\n", qir_get_stage_name(c->stage));
+ fprintf(stderr, "%s prog %d/%d QPU:\n",
+ qir_get_stage_name(c->stage),
+ c->program_id, c->variant_id);
for (int i = 0; i < c->qpu_inst_count; i++) {
fprintf(stderr, "0x%016"PRIx64" ", c->qpu_insts[i]);