zink: only unset a generated tcs if the bound tcs is the generated one
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 2 May 2023 16:10:27 +0000 (12:10 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 2 May 2023 20:08:32 +0000 (20:08 +0000)
this could otherwise unbind a non-generated tcs if the tes had at some
point generated a tcs

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22801>

src/gallium/drivers/zink/zink_program.c

index 0e5fee2..ffda48b 100644 (file)
@@ -1874,7 +1874,7 @@ zink_bind_tes_state(struct pipe_context *pctx,
    if (!!ctx->gfx_stages[MESA_SHADER_TESS_EVAL] != !!cso) {
       if (!cso) {
          /* if unsetting a TESS that uses a generated TCS, ensure the TCS is unset */
-         if (ctx->gfx_stages[MESA_SHADER_TESS_EVAL]->non_fs.generated_tcs)
+         if (ctx->gfx_stages[MESA_SHADER_TESS_CTRL] == ctx->gfx_stages[MESA_SHADER_TESS_EVAL]->non_fs.generated_tcs)
             ctx->gfx_stages[MESA_SHADER_TESS_CTRL] = NULL;
       }
    }