freedreno: Dirty the TCS state if patch_vertices change
authorRob Clark <robdclark@chromium.org>
Sat, 22 Oct 2022 17:55:25 +0000 (10:55 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Oct 2022 21:39:38 +0000 (21:39 +0000)
If using a passthrough TCS shader, we can't rely on having a new TCS
stage bound, so we need to invalidate the TCS state when the # of
patch_vertices changes.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19259>

src/gallium/drivers/freedreno/freedreno_program.c

index 1108799..b5b9686 100644 (file)
@@ -48,7 +48,17 @@ fd_set_patch_vertices(struct pipe_context *pctx, uint8_t patch_vertices) in_dt
 {
    struct fd_context *ctx = fd_context(pctx);
 
+   if (ctx->patch_vertices == patch_vertices)
+      return;
+
    ctx->patch_vertices = patch_vertices;
+
+   /* If we have tessellation this dirties the TCS state.  Check for TES
+    * stage as TCS could be NULL (passthrough)
+    */
+   if (ctx->prog.ds || ctx->prog.hs) {
+      fd_context_dirty_shader(ctx, PIPE_SHADER_TESS_CTRL, FD_DIRTY_SHADER_PROG);
+   }
 }
 
 static void