Created
August 19, 2022 11:40
-
-
Save kiljacken/10b727592c3a8ad2b30f944ad09e466d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! inner_ptr { | |
($gpuva:expr, $($f:tt)*) 0> ({ | |
fn uninit_from<T: GPUStruct>(_: &GPUWeakPointer<T>) -> MaybeUninit<T::Raw<'static>> { | |
core::mem::MaybeUninit::uninit() | |
} | |
let tmp = uninit_from($gpuva); | |
// ... All the stuff up to and including `inner.offset_from(...)` | |
let off = inner.offset_from(...); | |
let outer = tmp.as_ptr(); | |
fn out_from<T: GPUStruct, U>(gpuva: &GPUWeakPointer<T>) -> GPUWeakPointer<U> { | |
unsafe{ gpuva.offset(...) } | |
} | |
out_from($gpuva) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment