+static void
+upload_wm_state(struct brw_context *brw)
+{
+ struct gl_context *ctx = &brw->ctx;
+ /* BRW_NEW_FS_PROG_DATA */
+ const struct brw_wm_prog_data *prog_data =
+ brw_wm_prog_data(brw->wm.base.prog_data);
+
+ /* _NEW_BUFFERS */
+ const bool multisampled_fbo = _mesa_geometric_samples(ctx->DrawBuffer) > 1;
+
+ /* BRW_NEW_FS_PROG_DATA | _NEW_COLOR */
+ const bool dual_src_blend_enable = prog_data->dual_src_blend &&
+ (ctx->Color.BlendEnabled & 1) &&
+ ctx->Color.Blend[0]._UsesDualSrc;
+
+ /* _NEW_COLOR, _NEW_MULTISAMPLE _NEW_BUFFERS */
+ const bool kill_enable = prog_data->uses_kill ||
+ _mesa_is_alpha_test_enabled(ctx) ||
+ _mesa_is_alpha_to_coverage_enabled(ctx) ||
+ prog_data->uses_omask;
+
+ /* Rendering against the gl-context is always taken into account. */
+ const bool statistic_enable = true;
+
+ /* _NEW_LINE | _NEW_POLYGON | _NEW_BUFFERS | _NEW_COLOR |
+ * _NEW_MULTISAMPLE
+ */
+ gen6_upload_wm_state(brw, prog_data, &brw->wm.base,
+ multisampled_fbo,
+ dual_src_blend_enable, kill_enable,
+ brw_color_buffer_write_enabled(brw),
+ ctx->Multisample.Enabled,
+ ctx->Line.StippleFlag, ctx->Polygon.StippleFlag,
+ statistic_enable);
+}
+