nir/serialize: restore ray query variables
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 20 Apr 2022 15:28:28 +0000 (18:28 +0300)
committerMarge Bot <emma+marge@anholt.net>
Sat, 9 Jul 2022 00:32:00 +0000 (00:32 +0000)
The ray query status of a variable is tracked in the
nir_variable::data. We need to store it in the serialization otherwise
restoring NIR from a cache will drop the annotation.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 5a9cdab17050 ("nir: track variables representing ray queries")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16059>

src/compiler/nir/nir_serialize.c

index 3e41911..f08ff1f 100644 (file)
@@ -214,7 +214,7 @@ union packed_var {
       unsigned data_encoding:2;
       unsigned type_same_as_last:1;
       unsigned interface_type_same_as_last:1;
-      unsigned _pad:1;
+      unsigned ray_query:1;
       unsigned num_members:16;
    } u;
 };
@@ -285,6 +285,8 @@ write_variable(write_ctx *ctx, const nir_variable *var)
          flags.u.data_encoding = var_encode_full;
    }
 
+   flags.u.ray_query = var->data.ray_query;
+
    blob_write_uint32(ctx->blob, flags.u32);
 
    if (!flags.u.type_same_as_last) {
@@ -386,6 +388,8 @@ read_variable(read_ctx *ctx)
       ctx->last_var_data = var->data;
    }
 
+   var->data.ray_query = flags.u.ray_query;
+
    var->num_state_slots = flags.u.num_state_slots;
    if (var->num_state_slots != 0) {
       var->state_slots = ralloc_array(var, nir_state_slot,