rusticl/mesa: implement Clone for NirShader

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30152>
This commit is contained in:
Karol Herbst 2024-08-12 14:53:10 +02:00 committed by Marge Bot
parent 89b2c3927e
commit 76b2236834

View file

@ -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()) };