zink: add asserts to verify optimal key state
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 26 Sep 2022 17:46:20 +0000 (13:46 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 26 Sep 2022 21:58:58 +0000 (21:58 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18784>

src/gallium/drivers/zink/zink_program_state.hpp

index 777b49c..9fceac0 100644 (file)
@@ -183,6 +183,11 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
       state->final_hash ^= state->hash;
       state->dirty = false;
    }
+   if (screen->optimal_keys) {
+      ASSERTED const union zink_shader_key_optimal *opt = (union zink_shader_key_optimal*)&prog->last_variant_hash;
+      assert(opt->val == state->shader_keys_optimal.key.val);
+      assert(state->optimal_key == state->shader_keys_optimal.key.val);
+   }
    if (DYNAMIC_STATE < ZINK_DYNAMIC_VERTEX_INPUT && ctx->vertex_state_changed) {
       if (state->pipeline)
          state->final_hash ^= state->vertex_hash;