zink: split out scissor flagging from framebuffer updating
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 11 May 2022 14:54:33 +0000 (10:54 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 20 May 2022 16:42:21 +0000 (16:42 +0000)
this is kinda similar but not actually the same thing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>

src/gallium/drivers/zink/zink_clear.c
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_framebuffer.c
src/gallium/drivers/zink/zink_framebuffer.h
src/gallium/drivers/zink/zink_render_pass.c

index 97d2bae..c1fa010 100644 (file)
@@ -533,7 +533,7 @@ zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
       if (fb_changed) {
          ctx->fb_state.width = dstx + width;
          ctx->fb_state.height = dsty + height;
-         zink_update_framebuffer_state(ctx, orig_width, orig_height);
+         ctx->fb_changed = true;
          zink_batch_no_rp(ctx);
       }
       zink_clear(pctx, clear_flags, &scissor, NULL, depth, stencil);
@@ -541,7 +541,7 @@ zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
       if (fb_changed) {
          ctx->fb_state.width = orig_width;
          ctx->fb_state.height = orig_height;
-         zink_update_framebuffer_state(ctx, dstx + width, dsty + height);
+         ctx->fb_changed = true;
          zink_batch_no_rp(ctx);
       }
    } else {
index bdc2879..260a6da 100644 (file)
@@ -2351,7 +2351,7 @@ zink_set_color_write_enables(struct zink_context *ctx)
       /* use dummy color buffers instead of the more sane option */
       zink_batch_no_rp(ctx);
       ctx->rp_changed = true;
-      zink_update_framebuffer_state(ctx, ctx->fb_state.width, ctx->fb_state.height);
+      zink_update_framebuffer_state(ctx);
    } else {
       reapply_color_write(ctx);
    }
@@ -2434,7 +2434,9 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
    }
    rebind_fb_state(ctx, NULL, true);
    ctx->fb_state.samples = MAX2(samples, 1);
-   zink_update_framebuffer_state(ctx, w, h);
+   zink_update_framebuffer_state(ctx);
+   if (ctx->fb_state.width != w || ctx->fb_state.height != h)
+      ctx->scissor_changed = true;
 
    uint8_t rast_samples = ctx->fb_state.samples - 1;
    if (rast_samples != ctx->gfx_pipeline_state.rast_samples)
index ec83d3e..852c99b 100644 (file)
@@ -209,10 +209,8 @@ debug_describe_zink_framebuffer(char* buf, const struct zink_framebuffer *ptr)
 }
 
 void
-zink_update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h)
+zink_update_framebuffer_state(struct zink_context *ctx)
 {
-   if (ctx->fb_state.width != old_w || ctx->fb_state.height != old_h)
-      ctx->scissor_changed = true;
    /* get_framebuffer adds a ref if the fb is reused or created;
     * always do get_framebuffer first to avoid deleting the same fb
     * we're about to use
index 24d0dbf..7544074 100644 (file)
@@ -86,5 +86,5 @@ struct zink_framebuffer *
 zink_get_framebuffer(struct zink_context *ctx);
 
 void
-zink_update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h);
+zink_update_framebuffer_state(struct zink_context *ctx);
 #endif
index 6e330cb..fecb93f 100644 (file)
@@ -453,6 +453,7 @@ setup_framebuffer(struct zink_context *ctx)
    if (!ctx->fb_changed)
       return;
 
+   zink_update_framebuffer_state(ctx);
    zink_init_framebuffer(screen, ctx->framebuffer, rp);
    ctx->fb_changed = false;
    ctx->gfx_pipeline_state.render_pass = rp;
@@ -677,7 +678,9 @@ zink_render_update_swapchain(struct zink_context *ctx)
       ctx->fb_state.width = ctx->swapchain_size.width;
       ctx->fb_state.height = ctx->swapchain_size.height;
       zink_kopper_fixup_depth_buffer(ctx);
-      zink_update_framebuffer_state(ctx, old_w, old_h);
+      if (ctx->fb_state.width != old_w || ctx->fb_state.height != old_h)
+         ctx->scissor_changed = true;
+      zink_update_framebuffer_state(ctx);
       ctx->swapchain_size.width = ctx->swapchain_size.height = 0;
    }
 }