struct pipe_stream_output_info stream_output;
- /* The serialized NIR (for the disk cache) and size in bytes. */
- void *ir_cache_binary;
- uint32_t ir_cache_binary_size;
+ /* A SHA1 of the serialized NIR for the disk cache. */
+ unsigned char nir_sha1[20];
unsigned program_id;
memcpy(&prog_key, orig_prog_key, prog_key_size);
brw_prog_key_set_id(&prog_key, stage, 0);
- uint32_t data_size = prog_key_size + ish->ir_cache_binary_size;
+ uint8_t data[sizeof(prog_key) + sizeof(ish->nir_sha1)];
+ uint32_t data_size = prog_key_size + sizeof(ish->nir_sha1);
- void *data = malloc(data_size);
- memcpy(data, &prog_key, prog_key_size);
- memcpy(data + prog_key_size, ish->ir_cache_binary,
- ish->ir_cache_binary_size);
+ memcpy(data, ish->nir_sha1, sizeof(ish->nir_sha1));
+ memcpy(data + sizeof(ish->nir_sha1), &prog_key, prog_key_size);
disk_cache_compute_key(cache, data, data_size, cache_key);
-
- free(data);
}
/**
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);
+ _mesa_sha1_compute(blob.data, blob.size, ish->nir_sha1);
blob_finish(&blob);
}