mesa/st: Add perf debug for draw-time variant compiles.

This ARB_debug_output is particularly useful in that default apitrace will
log it, so we can find when we're doing draw-time recompiles we shouldn't be.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9509>
This commit is contained in:
Eric Anholt
2021-03-10 14:27:31 -08:00
committed by Marge Bot
parent 6864ff35e9
commit 35247ac017
2 changed files with 43 additions and 2 deletions
+35
View File
@@ -948,6 +948,20 @@ st_get_common_variant(struct st_context *st,
}
if (!v) {
if (stp->variants != NULL) {
_mesa_perf_debug(st->ctx, MESA_DEBUG_SEVERITY_MEDIUM,
"Compiling %s shader variant (%s%s%s%s%s%s%s%s)",
_mesa_shader_stage_to_string(stp->Base.info.stage),
key->passthrough_edgeflags ? "edgeflags," : "",
key->clamp_color ? "clamp_color," : "",
key->lower_depth_clamp ? "depth_clamp," : "",
key->clip_negative_one_to_one ? "clip_negative_one," : "",
key->lower_point_size ? "point_size," : "",
key->lower_ucp ? "ucp," : "",
key->is_draw_shader ? "draw," : "",
key->gl_clamp[0] || key->gl_clamp[1] || key->gl_clamp[2] ? "GL_CLAMP," : "");
}
/* create now */
v = st_create_common_variant(st, stp, key);
if (v) {
@@ -1634,6 +1648,27 @@ st_get_fp_variant(struct st_context *st,
if (!fpv) {
/* create new */
if (stfp->variants != NULL) {
_mesa_perf_debug(st->ctx, MESA_DEBUG_SEVERITY_MEDIUM,
"Compiling fragment shader variant (%s%s%s%s%s%s%s%s%s%s%s%s%s%s)",
key->bitmap ? "bitmap," : "",
key->drawpixels ? "drawpixels," : "",
key->scaleAndBias ? "scale_bias," : "",
key->pixelMaps ? "pixel_maps," : "",
key->clamp_color ? "clamp_color," : "",
key->persample_shading ? "persample_shading," : "",
key->fog ? "fog," : "",
key->lower_depth_clamp ? "depth_clamp," : "",
key->lower_two_sided_color ? "twoside," : "",
key->lower_flatshade ? "flatshade," : "",
key->lower_texcoord_replace ? "texcoord_replace," : "",
key->lower_alpha_func ? "alpha_compare," : "",
/* skipped ATI_fs targets */
stfp->Base.ExternalSamplersUsed ? "external?," : "",
key->gl_clamp[0] || key->gl_clamp[1] || key->gl_clamp[2] ? "GL_CLAMP," : "");
}
fpv = st_create_fp_variant(st, stfp, key);
if (fpv) {
fpv->base.st = key->st;
+8 -2
View File
@@ -115,7 +115,10 @@ st_get_external_sampler_key(struct st_context *st, struct gl_program *prog)
return key;
}
/** Fragment program variant key */
/** Fragment program variant key
*
* Please update st_get_fp_variant() perf_debug() when adding fields.
*/
struct st_fp_variant_key
{
struct st_context *st; /**< variants are per-context */
@@ -189,7 +192,10 @@ struct st_fp_variant
};
/** Shader key shared by other shaders */
/** Shader key shared by other shaders.
*
* Please update st_get_common_variant() perf_debug() when adding fields.
*/
struct st_common_variant_key
{
struct st_context *st; /**< variants are per-context */