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

problem with creating surface #6897

Open
butterdev0 opened this issue Jan 11, 2025 · 1 comment
Open

problem with creating surface #6897

butterdev0 opened this issue Jan 11, 2025 · 1 comment
Labels
type: question Further information is requested

Comments

@butterdev0
Copy link

im trynna run wgpu on web using winit and wasm but i cant create a surface

panicked at src/window.rs:63:63:
called Result::unwrap() on an Err value: CreateSurfaceError { inner: Web("canvas.getContext() returned null; webgpu not available or canvas already in use") }

    let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
        backends: wgpu::Backends::all(),
        dx12_shader_compiler: Default::default(),
        flags: wgpu::InstanceFlags::default(),
        gles_minor_version: Default::default(),
    });

    let surface = instance.create_surface(window.clone()).unwrap();
    
    ive been trying to fix it for days but i havent figured it out yet
@Wumpf
Copy link
Member

Wumpf commented Jan 12, 2025

@butterdev0 are you running in a WebGPU enabled browser (you can for instance check if the https://webgpu.github.io/webgpu-samples/ work)? If potentially not, you should enable the webgl backend (see https://docs.rs/wgpu/latest/wgpu/) and then try using https://docs.rs/wgpu/latest/wgpu/util/fn.new_instance_with_webgpu_detection.html for instance creation

@Wumpf Wumpf added the type: question Further information is requested label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
Status: Todo
Development

No branches or pull requests

2 participants