mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 00:04:11 +00:00
Preserve function abi in gpu_only
macro (#617)
* Preserve function abi in gpu_only macro
This commit is contained in:
parent
943f09fef7
commit
fc268da041
@ -160,16 +160,22 @@ pub fn gpu_only(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let fn_name = sig.ident.clone();
|
let fn_name = sig.ident.clone();
|
||||||
|
|
||||||
let sig = syn::Signature { abi: None, ..sig };
|
let sig_cpu = syn::Signature {
|
||||||
|
abi: None,
|
||||||
|
..sig.clone()
|
||||||
|
};
|
||||||
|
|
||||||
let output = quote::quote! {
|
let output = quote::quote! {
|
||||||
// Don't warn on unused arguments on the CPU side.
|
// Don't warn on unused arguments on the CPU side.
|
||||||
#[cfg_attr(not(target_arch = "spirv"), allow(unused_variables))]
|
#[cfg(not(target_arch="spirv"))]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
#(#attrs)* #vis #sig_cpu {
|
||||||
|
unimplemented!(concat!("`", stringify!(#fn_name), "` is only available on SPIR-V platforms."))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch="spirv")]
|
||||||
#(#attrs)* #vis #sig {
|
#(#attrs)* #vis #sig {
|
||||||
#[cfg(target_arch="spirv")] { #block }
|
#block
|
||||||
#[cfg(not(target_arch="spirv"))] {
|
|
||||||
unimplemented!(concat!("`", stringify!(#fn_name), "` is only available on SPIR-V platforms."))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user