aux/cso: store flatshade_first state from rasterizer
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 21 May 2021 09:26:51 +0000 (05:26 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 11 Jun 2021 22:06:49 +0000 (22:06 +0000)
this is necessary for handling index rewriting

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10964>

src/gallium/auxiliary/cso_cache/cso_context.c

index 99aeb6f..8ab3d46 100644 (file)
@@ -107,6 +107,7 @@ struct cso_context {
    struct pipe_query *render_condition, *render_condition_saved;
    uint render_condition_mode, render_condition_mode_saved;
    boolean render_condition_cond, render_condition_cond_saved;
+   bool flatshade_first, flatshade_first_saved;
 
    struct pipe_framebuffer_state fb, fb_saved;
    struct pipe_viewport_state vp, vp_saved;
@@ -572,6 +573,7 @@ enum pipe_error cso_set_rasterizer(struct cso_context *ctx,
 
    if (ctx->rasterizer != handle) {
       ctx->rasterizer = handle;
+      ctx->flatshade_first = templ->flatshade_first;
       ctx->pipe->bind_rasterizer_state(ctx->pipe, handle);
    }
    return PIPE_OK;
@@ -582,6 +584,7 @@ cso_save_rasterizer(struct cso_context *ctx)
 {
    assert(!ctx->rasterizer_saved);
    ctx->rasterizer_saved = ctx->rasterizer;
+   ctx->flatshade_first_saved = ctx->flatshade_first;
 }
 
 static void
@@ -589,6 +592,7 @@ cso_restore_rasterizer(struct cso_context *ctx)
 {
    if (ctx->rasterizer != ctx->rasterizer_saved) {
       ctx->rasterizer = ctx->rasterizer_saved;
+      ctx->flatshade_first = ctx->flatshade_first_saved;
       ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rasterizer_saved);
    }
    ctx->rasterizer_saved = NULL;