mesa/st: lower psiz for shader precompile
if the driver is requesting that psiz always be set, precompile the first variant with psiz since that's most likely to be what's eventually used Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13588>
This commit is contained in:
parent
8be35803a5
commit
4af7842ede
|
@ -1955,6 +1955,35 @@ st_destroy_program_variants(struct st_context *st)
|
|||
destroy_shader_program_variants_cb, st);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_last_vertex_stage(struct gl_context *ctx, struct gl_program *prog)
|
||||
{
|
||||
struct gl_program *last = NULL;
|
||||
/* fixedfunc */
|
||||
if (prog->Id == 0)
|
||||
return true;
|
||||
|
||||
/* shader info accurately set */
|
||||
if (prog->info.next_stage == MESA_SHADER_FRAGMENT)
|
||||
return true;
|
||||
if (prog->info.next_stage != MESA_SHADER_VERTEX)
|
||||
return false;
|
||||
|
||||
/* check bound programs */
|
||||
if (ctx->GeometryProgram._Current)
|
||||
last = ctx->GeometryProgram._Current;
|
||||
else if (ctx->TessEvalProgram._Current)
|
||||
last = ctx->TessEvalProgram._Current;
|
||||
else
|
||||
last = ctx->VertexProgram._Current;
|
||||
if (last)
|
||||
return prog == last;
|
||||
|
||||
/* assume this will be the last vertex stage;
|
||||
* at worst, another variant without psiz is created later
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile one shader variant.
|
||||
|
@ -1983,6 +2012,12 @@ st_precompile_shader_variant(struct st_context *st,
|
|||
key.clamp_color = true;
|
||||
}
|
||||
|
||||
if (prog->Target == GL_VERTEX_PROGRAM_ARB ||
|
||||
prog->Target == GL_TESS_EVALUATION_PROGRAM_NV ||
|
||||
prog->Target == GL_GEOMETRY_PROGRAM_NV) {
|
||||
if (st->ctx->API == API_OPENGLES2 || !st->ctx->VertexProgram.PointSizeEnabled)
|
||||
key.export_point_size = st->lower_point_size && is_last_vertex_stage(st->ctx, prog);
|
||||
}
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
st_get_common_variant(st, p, &key);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue