diff --git a/crates/spirv-std/macros/src/lib.rs b/crates/spirv-std/macros/src/lib.rs index e95ee95e32..c5e7a0f3b6 100644 --- a/crates/spirv-std/macros/src/lib.rs +++ b/crates/spirv-std/macros/src/lib.rs @@ -151,10 +151,8 @@ pub fn spirv(attr: TokenStream, item: TokenStream) -> TokenStream { let attr: proc_macro2::TokenStream = attr.into(); tokens.extend(quote! { #[cfg_attr(target_arch="spirv", rust_gpu::spirv(#attr))] }); - if attr.to_string().trim() == "fragment" { - let item_clone = item.clone(); - let input = syn::parse_macro_input!(item_clone as ItemFn); - if !matches!(input.vis, Visibility::Public(_)) { + if let Ok(item_fn) = syn::parse::(item.clone()) { + if !matches!(item_fn.vis, Visibility::Public(_)) { panic!("The `spirv` macro can only be applied to public functions."); } } diff --git a/crates/spirv-std/src/byte_addressable_buffer.rs b/crates/spirv-std/src/byte_addressable_buffer.rs index 0640e54bda..aefccfbcb2 100644 --- a/crates/spirv-std/src/byte_addressable_buffer.rs +++ b/crates/spirv-std/src/byte_addressable_buffer.rs @@ -6,7 +6,7 @@ use core::mem; // HACK(eddyb) try to prevent MIR inlining from breaking our intrinsics. #[inline(never)] #[spirv_std_macros::gpu_only] -unsafe fn buffer_load_intrinsic( +pub unsafe fn buffer_load_intrinsic( buffer: &[u32], // FIXME(eddyb) should be `usize`. offset: u32, @@ -26,7 +26,7 @@ unsafe fn buffer_load_intrinsic( // HACK(eddyb) try to prevent MIR inlining from breaking our intrinsics. #[inline(never)] #[spirv_std_macros::gpu_only] -unsafe fn buffer_store_intrinsic( +pub unsafe fn buffer_store_intrinsic( buffer: &mut [u32], // FIXME(eddyb) should be `usize`. offset: u32,