diff options
author | Kenneth Graunke <[email protected]> | 2019-05-28 15:39:24 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-05-29 18:16:32 +0000 |
commit | 6892d2b94a546ec35c259b98a014107d83986227 (patch) | |
tree | c158537c9d2ac5309df3711f394367e530ef7e75 /src/gallium/drivers/iris/iris_program.c | |
parent | e1409aead589d582f62a2526d2acaf03c704615f (diff) |
iris: Clone before calling nir_strip and serializing
This is non-destructive and leaves the debugging information in place.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_program.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 60f45eec629..0e294d1b8e0 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1496,18 +1496,20 @@ iris_create_uncompiled_shader(struct pipe_context *ctx, /* 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. + * isomorphic shaders when hashing, increasing cache hits. We clone + * the NIR before stripping away this info because it can be useful + * when inspecting and debugging shaders. */ - nir_strip(nir); + nir_shader *clone = nir_shader_clone(NULL, nir); + nir_strip(clone); struct blob blob; blob_init(&blob); - nir_serialize(&blob, ish->nir); + nir_serialize(&blob, clone); _mesa_sha1_compute(blob.data, blob.size, ish->nir_sha1); blob_finish(&blob); + + ralloc_free(clone); } return ish; |