Learn Wgpu
Home
  • Dependencies and the window
  • The Surface
  • The Pipeline
  • Buffers and Indices
  • Textures and bind groups
  • Uniform buffers and a 3d camera
  • Instancing
  • The Depth Buffer
  • Model Loading
  • Working with Lights
  • Normal Mapping
  • A Better Camera
  • High Dynamic Range Rendering
  • Intro to Compute Pipelines
  • Sorting on the GPU
  • Foreword
  • Mipmapping
  • Stencil Buffers
  • Wgpu without a window
  • Creating gifs
  • Pong
  • Memory Layout in WGSL
  • Update to Wgpu 29.0
  • Update to Vuepress v2
  • Version 28.0 and stencil showcase
  • Update to 27.0!
  • Update to wgpu 26.0.1 and started compute pipeline guide
  • Update to Winit 0.30!
  • Version 25.0!
  • Version 24.0
  • First Major Version! (22.0)
  • Update to 0.18 and HDR tutorial
  • Update to 0.17
  • Update to 0.16
  • Update to 0.15!
  • Update to 0.14!
  • Update to 0.13!
  • Update to 0.12!
  • News (Pre 0.12)
Home
  • Dependencies and the window
  • The Surface
  • The Pipeline
  • Buffers and Indices
  • Textures and bind groups
  • Uniform buffers and a 3d camera
  • Instancing
  • The Depth Buffer
  • Model Loading
  • Working with Lights
  • Normal Mapping
  • A Better Camera
  • High Dynamic Range Rendering
  • Intro to Compute Pipelines
  • Sorting on the GPU
  • Foreword
  • Mipmapping
  • Stencil Buffers
  • Wgpu without a window
  • Creating gifs
  • Pong
  • Memory Layout in WGSL
  • Update to Wgpu 29.0
  • Update to Vuepress v2
  • Version 28.0 and stencil showcase
  • Update to 27.0!
  • Update to wgpu 26.0.1 and started compute pipeline guide
  • Update to Winit 0.30!
  • Version 25.0!
  • Version 24.0
  • First Major Version! (22.0)
  • Update to 0.18 and HDR tutorial
  • Update to 0.17
  • Update to 0.16
  • Update to 0.15!
  • Update to 0.14!
  • Update to 0.13!
  • Update to 0.12!
  • News (Pre 0.12)
  • Version 24.0

Version 24.0

I missed 23.0, as I've been busy with work and a baby! Not much has changed between 22.0 and 24.0 though at least as far as this tutorial is concerned.

Entry point inference

If a shader has only one function labeled with @vertex for vertex shaders, or @fragment for fragment shaders, then Wgpu you don't need to specify the entry point when creating a render pipeline. This means if you do want to specify the entry point, you need to wrap it in an option.

device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
        label: Some(&format!("{:?}", shader)),
        layout: Some(layout),
        vertex: wgpu::VertexState {
            module: &shader,
            entry_point: Some("vs_main"), // Updated
            buffers: vertex_layouts,
            compilation_options: Default::default(),
        },
        fragment: Some(wgpu::FragmentState {
            module: &shader,
            entry_point: Some("fs_main"), // Updated
            targets: &[Some(wgpu::ColorTargetState {
                format: color_format,
                blend: Some(wgpu::BlendState {
                    alpha: wgpu::BlendComponent::REPLACE,
                    color: wgpu::BlendComponent::REPLACE,
                }),
                write_mask: wgpu::ColorWrites::ALL,
            })],
            compilation_options: Default::default(),
        }),
        // ...
    })

The same applies for compute pipelines.

let equirect_to_cubemap =
    device.create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
        label: Some("equirect_to_cubemap"),
        layout: Some(&pipeline_layout),
        module: &module,
        entry_point: Some("compute_equirect_to_cubemap"), // Updated
        compilation_options: Default::default(),
        cache: None,
    });

Other changes

  • ImageCopyTexture has been renamed to TexelCopyTextureInfo
  • ImageDataLayout has been renamed to TexelCopyBufferLayout
  • ImageCopyBuffer has been renamed to TexelCopyBufferInfo
  • wgpu::Instance::new() now takes a reference to a &wgpu::InstanceDescriptor
  • wgpu::SurfaceError::Other is now a thing

Getting WASM to run

I'm not sure if it's specifically a version 24.0 thing, but I had to add some code to the Cargo.toml to get webpack to handle the WASM properly.

# This should go in the Cargo.toml in the root directory
[profile.release]
strip = true

If you know why this is required, let me know.

Last Updated: 5/17/26, 3:25 AM
Contributors: Benjamin Hansen