nir: Add a face_sysval argument to nir_lower_two_sided_color

This is needed for handling drivers that use an input for loading the
face, for example Panfrost with Midgard GPUs.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Tested-by: Urja Rannikko <urjaman@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5915>
This commit is contained in:
Icecream95 2020-07-14 22:17:34 +12:00 committed by Marge Bot
parent 2a6db94b05
commit 314ba5e174
6 changed files with 7 additions and 6 deletions

View file

@ -939,7 +939,7 @@ static void
v3d_nir_lower_fs_late(struct v3d_compile *c)
{
if (c->fs_key->light_twoside)
NIR_PASS_V(c->s, nir_lower_two_sided_color);
NIR_PASS_V(c->s, nir_lower_two_sided_color, true);
if (c->fs_key->clamp_color)
NIR_PASS_V(c->s, nir_lower_clamp_color_outputs);

View file

@ -4374,7 +4374,7 @@ void nir_lower_point_size_mov(nir_shader *shader,
bool nir_lower_frexp(nir_shader *nir);
void nir_lower_two_sided_color(nir_shader *shader);
void nir_lower_two_sided_color(nir_shader *shader, bool face_sysval);
bool nir_lower_clamp_color_outputs(nir_shader *shader);

View file

@ -195,7 +195,7 @@ nir_lower_two_sided_color_impl(nir_function_impl *impl,
}
void
nir_lower_two_sided_color(nir_shader *shader)
nir_lower_two_sided_color(nir_shader *shader, bool face_sysval)
{
lower_2side_state state = {
.shader = shader,

View file

@ -412,7 +412,7 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
progress |= OPT(s, ir3_nir_lower_layer_id);
}
if (so->key.color_two_side) {
OPT_V(s, nir_lower_two_sided_color);
OPT_V(s, nir_lower_two_sided_color, true);
progress = true;
}

View file

@ -2304,7 +2304,7 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
NIR_PASS_V(c->s, nir_lower_tex, &tex_options);
if (c->fs_key && c->fs_key->light_twoside)
NIR_PASS_V(c->s, nir_lower_two_sided_color);
NIR_PASS_V(c->s, nir_lower_two_sided_color, true);
if (c->vs_key && c->vs_key->clamp_color)
NIR_PASS_V(c->s, nir_lower_clamp_color_outputs);

View file

@ -1278,7 +1278,8 @@ st_create_fp_variant(struct st_context *st,
}
if (key->lower_two_sided_color) {
NIR_PASS_V(state.ir.nir, nir_lower_two_sided_color);
bool face_sysval = st->ctx->Const.GLSLFrontFacingIsSysVal;
NIR_PASS_V(state.ir.nir, nir_lower_two_sided_color, face_sysval);
finalize = true;
}