/* _NEW_LIGHT
*/
- raster->flatshade = ctx->Light.ShadeModel == GL_FLAT;
+ raster->flatshade = !st->lower_flatshade &&
+ ctx->Light.ShadeModel == GL_FLAT;
raster->flatshade_first = ctx->Light.ProvokingVertex ==
GL_FIRST_VERTEX_CONVENTION_EXT;
key.st = st->has_shareable_shaders ? NULL : st;
+ key.lower_flatshade = st->lower_flatshade &&
+ st->ctx->Light.ShadeModel == GL_FLAT;
+
/* _NEW_FRAG_CLAMP */
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
_NEW_POINT))
st->dirty |= ST_NEW_RASTERIZER;
+ if ((new_state & _NEW_LIGHT) &&
+ st->lower_flatshade)
+ st->dirty |= ST_NEW_FS_STATE;
+
if (new_state & _NEW_PROJECTION &&
st_user_clip_planes_enabled(ctx))
st->dirty |= ST_NEW_CLIP_STATE;
screen->get_param(screen, PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND);
st->has_signed_vertex_buffer_offset =
screen->get_param(screen, PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET);
+ st->lower_flatshade =
+ !screen->get_param(screen, PIPE_CAP_FLATSHADE);
st->has_hw_atomics =
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
st->shader_has_one_variant[MESA_SHADER_FRAGMENT] =
st->has_shareable_shaders &&
+ !st->lower_flatshade &&
!st->clamp_frag_color_in_shader &&
!st->clamp_frag_depth_in_shader &&
!st->force_persample_in_shader;
boolean needs_rgb_dst_alpha_override;
boolean can_bind_const_buffer_as_vertex;
boolean has_signed_vertex_buffer_offset;
+ boolean lower_flatshade;
/**
* If a shader can be created when we get its source.
if (key->clamp_color)
NIR_PASS_V(tgsi.ir.nir, nir_lower_clamp_color_outputs);
+ if (key->lower_flatshade)
+ NIR_PASS_V(tgsi.ir.nir, nir_lower_flatshade);
+
if (key->persample_shading) {
nir_shader *shader = tgsi.ir.nir;
nir_foreach_variable(var, &shader->inputs)
char texture_targets[MAX_NUM_FRAGMENT_REGISTERS_ATI];
struct st_external_sampler_key external;
+
+ GLuint lower_flatshade:1;
};