v3d: Stop advertising support for flat shading.

The GL frontend can lower this weird GL feature away for us.  This should
fix redeclaration of the gl_Color/SecondaryColor as centroid, since that
case had been missed in the !flat special case here.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8601>
This commit is contained in:
Eric Anholt
2021-01-20 13:22:23 -08:00
parent ff805f8ac7
commit bcb5f9f94a
5 changed files with 1 additions and 29 deletions

View File

@@ -955,28 +955,6 @@ emit_fragment_varying(struct v3d_compile *c, nir_variable *var,
struct qreg result;
switch (var->data.interpolation) {
case INTERP_MODE_NONE:
/* If a gl_FrontColor or gl_BackColor input has no interp
* qualifier, then if we're using glShadeModel(GL_FLAT) it
* needs to be flat shaded.
*/
switch (var->data.location + array_index) {
case VARYING_SLOT_COL0:
case VARYING_SLOT_COL1:
case VARYING_SLOT_BFC0:
case VARYING_SLOT_BFC1:
if (c->fs_key->shade_model_flat) {
BITSET_SET(c->flat_shade_flags, i);
vir_MOV_dest(c, c->undef, vary);
result = vir_MOV(c, r5);
} else {
result = vir_FADD(c, vir_FMUL(c, vary,
c->payload_w), r5);
}
goto done;
default:
break;
}
/* FALLTHROUGH */
case INTERP_MODE_SMOOTH:
if (var->data.centroid) {
BITSET_SET(c->centroid_flags, i);
@@ -1002,7 +980,6 @@ emit_fragment_varying(struct v3d_compile *c, nir_variable *var,
unreachable("Bad interp mode");
}
done:
if (input_idx >= 0)
c->inputs[input_idx] = result;
return result;

View File

@@ -389,7 +389,6 @@ struct v3d_fs_key {
bool sample_coverage;
bool sample_alpha_to_coverage;
bool sample_alpha_to_one;
bool shade_model_flat;
/* Mask of which color render targets are present. */
uint8_t cbufs;
uint8_t swap_color_rb;

View File

@@ -1188,9 +1188,6 @@ pipeline_populate_v3d_fs_key(struct v3d_fs_key *key,
key->point_coord_upper_left = true;
}
}
/* FIXME: ditto, although for flat lighting. Again, neet to confirm.*/
key->shade_model_flat = false;
}
static void

View File

@@ -613,8 +613,6 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
PIPE_SPRITE_COORD_UPPER_LEFT);
}
key->shade_model_flat = v3d->rasterizer->base.flatshade;
struct v3d_compiled_shader *old_fs = v3d->prog.fs;
v3d->prog.fs = v3d_get_compiled_shader(v3d, &key->base, sizeof(*key));
if (v3d->prog.fs == old_fs)

View File

@@ -258,6 +258,7 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_ALPHA_TEST:
case PIPE_CAP_FLATSHADE:
case PIPE_CAP_TWO_SIDED_COLOR:
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: