From 76b22368347b48168cf92d92c040095211390ad4 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 12 Aug 2024 14:53:10 +0200 Subject: [PATCH] rusticl/mesa: implement Clone for NirShader Part-of: --- src/gallium/frontends/rusticl/mesa/compiler/nir.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/frontends/rusticl/mesa/compiler/nir.rs b/src/gallium/frontends/rusticl/mesa/compiler/nir.rs index f386ca29ef1..e8e9f078fd3 100644 --- a/src/gallium/frontends/rusticl/mesa/compiler/nir.rs +++ b/src/gallium/frontends/rusticl/mesa/compiler/nir.rs @@ -484,6 +484,14 @@ impl NirShader { } } +impl Clone for NirShader { + fn clone(&self) -> Self { + Self { + nir: unsafe { NonNull::new_unchecked(self.dup_for_driver()) }, + } + } +} + impl Drop for NirShader { fn drop(&mut self) { unsafe { ralloc_free(self.nir.as_ptr().cast()) };