Mesa (main): nir: Validate after deserialization.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 15 19:03:19 UTC 2021


Module: Mesa
Branch: main
Commit: bb35195b73824d2aa4ac89aa80ff84f54bc9b108
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb35195b73824d2aa4ac89aa80ff84f54bc9b108

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Jul 13 16:31:52 2021 -0700

nir: Validate after deserialization.

It's a particularly relevant place for NIR bugs to occur, and if you make
a mistake in this code it gets caught in your debug build in something
like mesa/st's call to nir_split_var_copies() during finalization, which is
rather misleading.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11860>

---

 src/compiler/nir/nir_serialize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index cc376cbcb6b..f9fc3193c6e 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -2102,6 +2102,8 @@ nir_deserialize(void *mem_ctx,
 
    free(ctx.idx_table);
 
+   nir_validate_shader(ctx.nir, "after deserialize");
+
    return ctx.nir;
 }
 



More information about the mesa-commit mailing list