Skip to content

Commit

Permalink
Merge pull request #37 from iMplode-nZ/main
Browse files Browse the repository at this point in the history
Multi: Add `Clone` to `Swapchain`, and remove return type on the tracked macro.
  • Loading branch information
shiinamiyuki authored Mar 26, 2024
2 parents 6d494b3 + cc95656 commit 96e8939
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 2 additions & 3 deletions luisa_compute/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,7 @@ impl Device {
raw_window_handle::RawWindowHandle::Orbital(_) => todo!(),
raw_window_handle::RawWindowHandle::Xlib(h) => h.window as u64,
raw_window_handle::RawWindowHandle::Xcb(h) => h.window.get() as u64,
raw_window_handle::RawWindowHandle::Wayland(h) => {
h.surface.as_ptr() as u64
}
raw_window_handle::RawWindowHandle::Wayland(h) => h.surface.as_ptr() as u64,
raw_window_handle::RawWindowHandle::Drm(_) => todo!(),
raw_window_handle::RawWindowHandle::Gbm(_) => todo!(),
raw_window_handle::RawWindowHandle::Win32(h) => h.hwnd.get() as u64,
Expand Down Expand Up @@ -832,6 +830,7 @@ impl Drop for SwapchainHandle {
}
}

#[derive(Clone)]
pub struct Swapchain {
pub(crate) handle: Arc<SwapchainHandle>,
#[allow(dead_code)]
Expand Down
6 changes: 1 addition & 5 deletions luisa_compute_track/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,6 @@ pub fn tracked(
let item = syn::parse_macro_input!(item as ItemFn);
let body = &item.block;
let body_span = body.span();
let ret_type = match &item.sig.output {
ReturnType::Default => quote_spanned! {body_span=> () },
ReturnType::Type(_, ty) => quote_spanned! {body_span=> #ty },
};
let body = proc_macro::TokenStream::from(quote!({ #body }));
let body = track_impl(parse_macro_input!(body as Expr), &crate_path);
let body = quote_spanned! {body_span=>
Expand All @@ -444,7 +440,7 @@ pub fn tracked(
};
#crate_path::lang::debug::comment(&format!("begin fn {} at {}:{}:{}", __fn_name, file!(), line!(), column!()));
#[allow(clippy::let_unit_value)]
let __ret: #ret_type = #body;
let __ret = #body;
#[allow(unreachable_code)]
{
#crate_path::lang::debug::comment(&format!("end fn {} at {}:{}:{}", __fn_name, file!(), line!(), column!()));
Expand Down

0 comments on commit 96e8939

Please sign in to comment.