summaryrefslogtreecommitdiffstats
path: root/wgpu/src/triangle
diff options
context:
space:
mode:
authorLibravatar Dispersia <dispersias@gmail.com>2021-04-11 18:55:57 -0700
committerLibravatar Dispersia <dispersias@gmail.com>2021-04-11 18:55:57 -0700
commit9a2c78c4059d2be37d10adda397fb6e64f38ac02 (patch)
treef529faa116378e7ab447b40bd93bf5811c3dfca8 /wgpu/src/triangle
parent4b8ba8309f6645cdcb5bd605f8dd88097f8ee5a7 (diff)
downloadiced-9a2c78c4059d2be37d10adda397fb6e64f38ac02.tar.gz
iced-9a2c78c4059d2be37d10adda397fb6e64f38ac02.tar.bz2
iced-9a2c78c4059d2be37d10adda397fb6e64f38ac02.zip
Upgrade wgpu
Diffstat (limited to 'wgpu/src/triangle')
-rw-r--r--wgpu/src/triangle/msaa.rs49
1 files changed, 24 insertions, 25 deletions
diff --git a/wgpu/src/triangle/msaa.rs b/wgpu/src/triangle/msaa.rs
index d964f815..d155f3ec 100644
--- a/wgpu/src/triangle/msaa.rs
+++ b/wgpu/src/triangle/msaa.rs
@@ -74,45 +74,44 @@ impl Blit {
bind_group_layouts: &[&constant_layout, &texture_layout],
});
- let vs_module = device.create_shader_module(&wgpu::include_spirv!(
- "../shader/blit.vert.spv"
- ));
-
- let fs_module = device.create_shader_module(&wgpu::include_spirv!(
- "../shader/blit.frag.spv"
- ));
+ let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
+ label: Some("iced_wgpu::triangle::blit_shader"),
+ source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!("../shader/blit.wgsl"))),
+ flags: wgpu::ShaderFlags::all()
+ });
let pipeline =
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("iced_wgpu::triangle::msaa pipeline"),
layout: Some(&layout),
vertex: wgpu::VertexState {
- module: &vs_module,
- entry_point: "main",
+ module: &shader,
+ entry_point: "vs_main",
buffers: &[],
},
fragment: Some(wgpu::FragmentState {
- module: &fs_module,
- entry_point: "main",
+ module: &shader,
+ entry_point: "fs_main",
targets: &[wgpu::ColorTargetState {
format,
- color_blend: wgpu::BlendState {
- src_factor: wgpu::BlendFactor::SrcAlpha,
- dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
- operation: wgpu::BlendOperation::Add,
- },
- alpha_blend: wgpu::BlendState {
- src_factor: wgpu::BlendFactor::One,
- dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
- operation: wgpu::BlendOperation::Add,
- },
+ blend: Some(wgpu::BlendState {
+ color: wgpu::BlendComponent {
+ src_factor: wgpu::BlendFactor::SrcAlpha,
+ dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
+ operation: wgpu::BlendOperation::Add,
+ },
+ alpha: wgpu::BlendComponent {
+ src_factor: wgpu::BlendFactor::One,
+ dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
+ operation: wgpu::BlendOperation::Add,
+ },
+ }),
write_mask: wgpu::ColorWrite::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Cw,
- cull_mode: wgpu::CullMode::None,
..Default::default()
},
depth_stencil: None,
@@ -178,8 +177,8 @@ impl Blit {
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("iced_wgpu::triangle::msaa render pass"),
color_attachments: &[
- wgpu::RenderPassColorAttachmentDescriptor {
- attachment: target,
+ wgpu::RenderPassColorAttachment {
+ view: target,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,
@@ -222,7 +221,7 @@ impl Targets {
let extent = wgpu::Extent3d {
width,
height,
- depth: 1,
+ depth_or_array_layers: 1,
};
let attachment = device.create_texture(&wgpu::TextureDescriptor {