You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
learn-wgpu/docs/news/0.16/readme.md

1.7 KiB

Update to 0.16

Very few changes here! We no longer need to use NonZeroU32 and the like, instead it will be an Option<u32>. This is mostly used in dealing with textures.

queue.write_texture(
    wgpu::ImageCopyTexture {
        aspect: wgpu::TextureAspect::All,
        texture: &texture,
        mip_level: 0,
        origin: wgpu::Origin3d::ZERO,
    },
    &rgba,
    wgpu::ImageDataLayout {
        offset: 0,
        // bytes_per_row: NonZeroU32::new(4 * dimensions.0),
        bytes_per_row: Some(4 * dimensions.0),
        // rows_per_image: NonZeroU32::new(dimensions.1),
        rows_per_image: Some(dimensions.1),
    },
    size,
);

In other news WebGPU has been added to Chrome 113 and up! Currently the Linux version of Chrome beta isn't working and while it's working in Firefox, I'm going to hold off on switching to using that instead of the WebGL compatibility mode. If you mess around with WebGPU in browser check https://caniuse.com/webgpu to see if your browser is supported and then remove the extra wgpu line from the [target.'cfg(target_arch = "wasm32")'.dependencies] section of Cargo.toml:

[target.'cfg(target_arch = "wasm32")'.dependencies]
reqwest = { version = "0.11" }
console_error_panic_hook = "0.1"
console_log = "1.0"
# wgpu = { version = "0.16", features = ["webgl"]}
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = { version = "0.3", features = [
    "Document",
    "Window",
    "Element",
    "Location",
]}

No other changes need to be made to switch to using WebGPU in browser, so once the WebGPU samples at https://webgpu.github.io/ work in Chrome on Linux, I'll look into removing the webgl feature.

That's all! As always let me know if I missed anything!