unsigned thread_count);
void brw_init_shader_time(struct brw_context *brw);
int brw_get_shader_time_index(struct brw_context *brw,
- struct gl_shader_program *shader_prog,
struct gl_program *prog,
- enum shader_time_shader_type type);
+ enum shader_time_shader_type type,
+ bool is_glsl_sh);
void brw_collect_and_report_shader_time(struct brw_context *brw);
void brw_destroy_shader_time(struct brw_context *brw);
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &cp->program, ST_CS);
+ st_index = brw_get_shader_time_index(brw, &cp->program, ST_CS, true);
char *error_str;
program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx, key,
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, NULL, ST_GS);
+ st_index = brw_get_shader_time_index(brw, &gp->program, ST_GS, true);
if (unlikely(brw->perf_debug)) {
start_busy = brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo);
* change their lifetimes compared to normal operation.
*/
int
-brw_get_shader_time_index(struct brw_context *brw,
- struct gl_shader_program *shader_prog,
- struct gl_program *prog,
- enum shader_time_shader_type type)
+brw_get_shader_time_index(struct brw_context *brw, struct gl_program *prog,
+ enum shader_time_shader_type type, bool is_glsl_sh)
{
int shader_time_index = brw->shader_time.num_entries++;
assert(shader_time_index < brw->shader_time.max_entries);
brw->shader_time.types[shader_time_index] = type;
- int id = shader_prog ? shader_prog->Name : prog->Id;
const char *name;
- if (id == 0) {
+ if (prog->Id == 0) {
name = "ff";
- } else if (!shader_prog) {
- name = "prog";
- } else if (shader_prog->Label) {
- name = ralloc_strdup(brw->shader_time.names, shader_prog->Label);
+ } else if (is_glsl_sh) {
+ name = prog->info.label ?
+ ralloc_strdup(brw->shader_time.names, prog->info.label) : "glsl";
} else {
- name = "glsl";
+ name = "prog";
}
brw->shader_time.names[shader_time_index] = name;
- brw->shader_time.ids[shader_time_index] = id;
+ brw->shader_time.ids[shader_time_index] = prog->Id;
return shader_time_index;
}
brw_codegen_tcs_prog(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct brw_program *tcp,
+ struct brw_program *tep,
struct brw_tcs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
}
int st_index = -1;
- if (unlikely(INTEL_DEBUG & DEBUG_SHADER_TIME))
- st_index = brw_get_shader_time_index(brw, shader_prog, NULL, ST_TCS);
+ if (unlikely((INTEL_DEBUG & DEBUG_SHADER_TIME) && tep))
+ st_index = brw_get_shader_time_index(brw, &tep->program, ST_TCS, true);
if (unlikely(brw->perf_debug)) {
start_busy = brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo);
&stage_state->prog_offset,
&brw->tcs.base.prog_data)) {
bool success = brw_codegen_tcs_prog(brw, current[MESA_SHADER_TESS_CTRL],
- tcp, &key);
+ tcp, tep, &key);
assert(success);
(void)success;
}
_LinkedShaders[MESA_SHADER_TESS_CTRL]->info.TessCtrl.VerticesOut;
}
+ struct brw_program *btep;
if (tes) {
+ btep = brw_program(tes->Program);
key.tes_primitive_mode = tes->info.TessEval.PrimitiveMode;
key.quads_workaround = brw->gen < 9 &&
tes->info.TessEval.PrimitiveMode == GL_QUADS &&
tes->info.TessEval.Spacing == GL_EQUAL;
} else {
+ btep = NULL;
key.tes_primitive_mode = GL_TRIANGLES;
}
key.outputs_written = prog->nir->info->outputs_written;
key.patch_outputs_written = prog->nir->info->patch_outputs_written;
- success = brw_codegen_tcs_prog(brw, shader_prog, btcp, &key);
+ success = brw_codegen_tcs_prog(brw, shader_prog, btcp, btep, &key);
brw->tcs.base.prog_offset = old_prog_offset;
brw->tcs.base.prog_data = old_prog_data;
int st_index = -1;
if (unlikely(INTEL_DEBUG & DEBUG_SHADER_TIME))
- st_index = brw_get_shader_time_index(brw, shader_prog, NULL, ST_TES);
+ st_index = brw_get_shader_time_index(brw, &tep->program, ST_TES, true);
if (unlikely(brw->perf_debug)) {
start_busy = brw->batch.last_bo && drm_intel_bo_busy(brw->batch.last_bo);
}
int st_index = -1;
- if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &vp->program, ST_VS);
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
+ bool is_glsl_sh = prog != NULL;
+ st_index = brw_get_shader_time_index(brw, &vp->program, ST_VS,
+ is_glsl_sh);
+ }
/* Emit GEN4 code.
*/
int st_index8 = -1, st_index16 = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
- st_index8 = brw_get_shader_time_index(brw, prog, &fp->program, ST_FS8);
- st_index16 = brw_get_shader_time_index(brw, prog, &fp->program, ST_FS16);
+ bool is_glsl_sh = prog != NULL;
+ st_index8 = brw_get_shader_time_index(brw, &fp->program, ST_FS8,
+ is_glsl_sh);
+ st_index16 = brw_get_shader_time_index(brw, &fp->program, ST_FS16,
+ is_glsl_sh);
}
char *error_str = NULL;