mesa/st: Fix precompile misses on compat GL VSes writing to color outputs.

In compat GL, the gl_FrontColor/BackColor gets clamped unless you
explicitly turn it off with ARB_color_buffer_float, and most apps doing
floating point color rendering are going to be using non-compat varyings
anyway instead of hoping that ARB_color_buffer_float exists.  Thus, guess
that the app will get clamping on the color outputs to reduce draw-time
recompiles.

Saves 60 VS recompiles on half-life-2.trace on freedreno (and similarly for
many other compat GL apps).

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:46:16 -08:00 committed by Marge Bot
parent 35247ac017
commit 1cf8cf99c8
1 changed files with 9 additions and 0 deletions

View File

@ -1946,6 +1946,15 @@ st_precompile_shader_variant(struct st_context *st,
memset(&key, 0, sizeof(key));
if (st->ctx->API == API_OPENGL_COMPAT &&
st->clamp_vert_color_in_shader &&
(prog->info.outputs_written & (VARYING_SLOT_COL0 |
VARYING_SLOT_COL1 |
VARYING_SLOT_BFC0 |
VARYING_SLOT_BFC1))) {
key.clamp_color = true;
}
key.st = st->has_shareable_shaders ? NULL : st;
st_get_common_variant(st, p, &key);
break;