st/mesa: do not clear NewDriverState for inactive states

Fixes: 085aa7f91e8 ("st/mesa: don't update atomic, SSBO, UBO and TBO states that have no effect")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2951
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5660>
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 11b0ce6..181134a 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -181,7 +181,7 @@
     * Inactive states are shader states not used by shaders at the moment.
     */
    st->dirty |= ctx->NewDriverState & st->active_states & ST_ALL_STATES_MASK;
-   ctx->NewDriverState = 0;
+   ctx->NewDriverState &= ~st->dirty;
 
    /* Get pipeline state. */
    switch (pipeline) {