+ if (screen->disk_cache) {
+ /* Serialize the NIR to a binary blob that we can hash for the disk
+ * cache. First, drop unnecessary information (like variable names)
+ * so the serialized NIR is smaller, and also to let us detect more
+ * isomorphic shaders when hashing, increasing cache hits.
+ *
+ * We skip this step when not using the disk cache, as variable names
+ * are useful for inspecting and debugging shaders.
+ */
+ nir_strip(nir);
+
+ struct blob blob;
+ blob_init(&blob);
+ nir_serialize(&blob, ish->nir);
+ ish->ir_cache_binary = malloc(blob.size);
+ ish->ir_cache_binary_size = blob.size;
+ memcpy(ish->ir_cache_binary, blob.data, blob.size);
+ blob_finish(&blob);
+ }
+