Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add window support for Deno and WebGPU #10714

Closed
ReddikHaien opened this issue May 19, 2021 · 4 comments
Closed

Add window support for Deno and WebGPU #10714

ReddikHaien opened this issue May 19, 2021 · 4 comments
Labels
suggestion suggestions for new features (yet to be agreed) webgpu WebGPU API

Comments

@ReddikHaien
Copy link

Based on the current progress with the WebGPU(hats off to everyone involved, good job :D), I was wondering if it would be possible to implement window support using raw-window-handle as mentioned in a #7863. I did some tinkering and think a possible solution could be to create a wrapper struct for the window handle. For example:

pub struct WindowResource{
  pub window_handle: &'static dyn raw_window_handle::HasRawWindowHandle
}

impl Resource for WindowResource {
  fn name(&self) -> Cow<str>{
    "WindowResource".into()
  }
}

unsafe impl raw_window_handle::HasRawWindowHandle for WindowResource{
  fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle{
    self.window_handle.raw_window_handle()
  }
}


impl WindowResource{
  pub fn create_window_resource(handle: &'static dyn raw_window_handle::HasRawWindowHandle) -> Self{
    Self{
      window_handle: handle
    }
  }
}

This could then be passed to webgpu or to a different plugin as a simple rid.

I'm pretty new to Rust, so I hope you'll exuse the terrible implementation above 😅

@crowlKats
Copy link
Member

We are currently working on this, see #10690

@ReddikHaien
Copy link
Author

Ahh, I see.
Nice👍👍

@lucacasonato
Copy link
Member

I'm going to keep the issue open, so we have something to track.

@lucacasonato lucacasonato reopened this May 19, 2021
@lucacasonato lucacasonato added webgpu WebGPU API suggestion suggestions for new features (yet to be agreed) labels May 19, 2021
@crowlKats
Copy link
Member

crowlKats commented Jan 9, 2023

We have abandoned this idea due to various difficulties and complications, and as such am closing this issue. The better approach will be through embedding using a newly added Extension; see gfx-rs/wgpu#3265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion suggestions for new features (yet to be agreed) webgpu WebGPU API
Projects
None yet
Development

No branches or pull requests

3 participants