Skip to content

Commit

Permalink
Deps: Update wgpu from 0.19.2 to 22.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Aug 2, 2024
1 parent 019290b commit d55124c
Show file tree
Hide file tree
Showing 10 changed files with 351 additions and 107 deletions.
286 changes: 252 additions & 34 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ unicode-segmentation = { version = "1.10.1", default-features = false }
unicode-width = { version = "0.1.9", default-features = false }
wasm-bindgen-futures = "0.4.40"
web-time = "1.0.0"
wgpu = { version = "0.19.3", default-features = false, features = ["wgsl"] }
wgpu = { version = "22.1.0", default-features = false, features = ["wgsl"] }
yield-progress = { version = "0.1.6", default-features = false }

# Note: Lints are also necessarily redefined in the workspaces other than this one.
Expand Down
3 changes: 2 additions & 1 deletion all-is-cubes-gpu/src/in_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,13 @@ impl<I: time::Instant> EverythingRenderer<I> {
/// A device descriptor suitable for the expectations of [`EverythingRenderer`].
pub fn device_descriptor(available_limits: wgpu::Limits) -> wgpu::DeviceDescriptor<'static> {
wgpu::DeviceDescriptor {
label: None,
required_features: wgpu::Features::empty(),
required_limits: wgpu::Limits {
max_inter_stage_shader_components: 32, // number used by blocks-and-lines shader
..wgpu::Limits::downlevel_webgl2_defaults().using_resolution(available_limits)
},
label: None,
memory_hints: wgpu::MemoryHints::default(), // TODO: consider setting
}
}

Expand Down
6 changes: 6 additions & 0 deletions all-is-cubes-gpu/src/in_wgpu/bloom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ impl BloomPipelines {
vertex: wgpu::VertexState {
module: shaders.bloom.get(),
entry_point: "bloom_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
module: shaders.bloom.get(),
entry_point: "bloom_downsample_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: linear_scene_texture_format,
blend: None,
Expand All @@ -79,18 +81,21 @@ impl BloomPipelines {
// default = off. No need for multisampling since we are not drawing triangles here.
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});
let upsample_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("BloomPipelines::upsample_pipeline"),
layout: Some(&pipeline_layout),
vertex: wgpu::VertexState {
module: shaders.bloom.get(),
entry_point: "bloom_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
module: shaders.bloom.get(),
entry_point: "bloom_upsample_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: linear_scene_texture_format,
blend: None,
Expand All @@ -102,6 +107,7 @@ impl BloomPipelines {
// default = off. No need for multisampling since we are not drawing triangles here.
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});

#[cfg_attr(target_family = "wasm", allow(clippy::arc_with_non_send_sync))]
Expand Down
15 changes: 9 additions & 6 deletions all-is-cubes-gpu/src/in_wgpu/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ pub async fn create_instance_for_test_or_exit() -> wgpu::Instance {
});

// Report adapters that we *could* pick
_ = writeln!(
stderr,
"Available adapters (backend filter = {backends:?}):"
);
for adapter in instance.enumerate_adapters(wgpu::Backends::all()) {
_ = writeln!(stderr, " {}", shortened_adapter_info(&adapter.get_info()));
#[cfg(not(target_family = "wasm"))]
{
_ = writeln!(
stderr,
"Available adapters (backend filter = {backends:?}):"
);
for adapter in instance.enumerate_adapters(wgpu::Backends::all()) {
_ = writeln!(stderr, " {}", shortened_adapter_info(&adapter.get_info()));
}
}

let adapter = try_create_adapter_for_test(&instance, |m| _ = writeln!(stderr, "{m}")).await;
Expand Down
21 changes: 21 additions & 0 deletions all-is-cubes-gpu/src/in_wgpu/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ impl Pipelines {
// place to ensure that no skew occurs.
let current_graphics_options = graphics_options.get();

// Not using pipeline cache (but maybe we should set up hooks for that in the future).
let cache: Option<&wgpu::PipelineCache> = None;

let block_texture_entry = |binding| wgpu::BindGroupLayoutEntry {
binding,
visibility: wgpu::ShaderStages::FRAGMENT,
Expand Down Expand Up @@ -184,11 +187,13 @@ impl Pipelines {
vertex: wgpu::VertexState {
module: shaders.blocks_and_lines.get(),
entry_point: "block_vertex_main",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: vertex_buffers,
},
fragment: Some(wgpu::FragmentState {
module: shaders.blocks_and_lines.get(),
entry_point: "block_fragment_opaque",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: fb.linear_scene_texture_format(),
blend: None,
Expand All @@ -205,6 +210,7 @@ impl Pipelines {
}),
multisample,
multiview: None,
cache,
});

let transparent_render_pipeline =
Expand All @@ -214,6 +220,7 @@ impl Pipelines {
vertex: wgpu::VertexState {
module: shaders.blocks_and_lines.get(),
entry_point: "block_vertex_main",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: vertex_buffers,
},
fragment: Some(wgpu::FragmentState {
Expand All @@ -225,6 +232,7 @@ impl Pipelines {
}
ref t => panic!("unimplemented transparency option {t:?}"),
},
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: fb.linear_scene_texture_format(),
// Note that this blending configuration is for premultiplied alpha.
Expand Down Expand Up @@ -255,6 +263,7 @@ impl Pipelines {
}),
multisample,
multiview: None,
cache,
});

let skybox_render_pipeline =
Expand All @@ -266,11 +275,13 @@ impl Pipelines {
vertex: wgpu::VertexState {
module: shaders.blocks_and_lines.get(),
entry_point: "skybox_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
module: shaders.blocks_and_lines.get(),
entry_point: "skybox_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: fb.linear_scene_texture_format(),
blend: None,
Expand All @@ -288,6 +299,7 @@ impl Pipelines {
}),
multisample,
multiview: None,
cache,
});

let lines_render_pipeline_layout =
Expand All @@ -304,11 +316,13 @@ impl Pipelines {
vertex: wgpu::VertexState {
module: shaders.blocks_and_lines.get(),
entry_point: "lines_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[WgpuLinesVertex::desc()],
},
fragment: Some(wgpu::FragmentState {
module: shaders.blocks_and_lines.get(),
entry_point: "lines_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: fb.linear_scene_texture_format(),
blend: None,
Expand All @@ -328,6 +342,7 @@ impl Pipelines {
}),
multisample,
multiview: None,
cache,
});

let frame_copy_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
Expand Down Expand Up @@ -364,11 +379,13 @@ impl Pipelines {
vertex: wgpu::VertexState {
module: shaders.frame_copy.get(),
entry_point: "frame_copy_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
module: shaders.frame_copy.get(),
entry_point: "frame_copy_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba16Float,
blend: None,
Expand All @@ -382,6 +399,7 @@ impl Pipelines {
depth_stencil: None,
multisample,
multiview: None,
cache,
});

#[cfg(feature = "rerun")]
Expand Down Expand Up @@ -442,11 +460,13 @@ impl Pipelines {
vertex: wgpu::VertexState {
module: shaders.rerun_copy.get(),
entry_point: "rerun_frame_copy_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
module: shaders.rerun_copy.get(),
entry_point: "rerun_frame_copy_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[
Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8UnormSrgb,
Expand All @@ -468,6 +488,7 @@ impl Pipelines {
// we're writing *to* a non-multisampled texture
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache,
});

let linear_sampler = device.create_sampler(&wgpu::SamplerDescriptor {
Expand Down
3 changes: 3 additions & 0 deletions all-is-cubes-gpu/src/in_wgpu/postprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ pub(crate) fn create_postprocess_pipeline(
vertex: wgpu::VertexState {
module: shaders.postprocess.get(),
entry_point: "postprocess_vertex",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
module: shaders.postprocess.get(),
entry_point: "postprocess_fragment",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: super::surface_view_format(surface_format),
blend: Some(wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING),
Expand All @@ -115,6 +117,7 @@ pub(crate) fn create_postprocess_pipeline(
// default = off. No need for multisampling since we are not drawing triangles here.
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
})
}

Expand Down
3 changes: 3 additions & 0 deletions all-is-cubes-gpu/src/in_wgpu/shader_testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ where
vertex: wgpu::VertexState {
module: &shader,
entry_point: "block_vertex_main",
compilation_options: wgpu::PipelineCompilationOptions::default(),
buffers: &[WgpuBlockVertex::desc(), WgpuInstanceData::desc()],
},
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "test_entry_point",
compilation_options: wgpu::PipelineCompilationOptions::default(),
targets: &[Some(wgpu::ColorTargetState {
format: fbt.linear_scene_texture_format(),
blend: None,
Expand All @@ -122,6 +124,7 @@ where
}),
multisample: wgpu::MultisampleState::default(), // default = off
multiview: None,
cache: None,
});

// Placeholder space data for the bind group
Expand Down
Loading

0 comments on commit d55124c

Please sign in to comment.