summaryrefslogtreecommitdiffstats
path: root/wgpu/src/triangle
diff options
context:
space:
mode:
authorLibravatar Poly <marynczak.bartlomiej@gmail.com>2021-02-03 20:05:37 +0100
committerLibravatar Poly <marynczak.bartlomiej@gmail.com>2021-02-03 20:05:37 +0100
commit5f935c34fdd23a99e39ea80fef3845d476fc78f4 (patch)
tree28e4765b092772605e1168aaa30af0daab2f55e4 /wgpu/src/triangle
parent98d108d2b73b994a63140361110dec6401a80ae4 (diff)
downloadiced-5f935c34fdd23a99e39ea80fef3845d476fc78f4.tar.gz
iced-5f935c34fdd23a99e39ea80fef3845d476fc78f4.tar.bz2
iced-5f935c34fdd23a99e39ea80fef3845d476fc78f4.zip
[wgpu 0.7] Update triangle/msaa.rs
Notes: - not sure if `filtering sampler` should be used, so for now it is not used .
Diffstat (limited to 'wgpu/src/triangle')
-rw-r--r--wgpu/src/triangle/msaa.rs74
1 files changed, 40 insertions, 34 deletions
diff --git a/wgpu/src/triangle/msaa.rs b/wgpu/src/triangle/msaa.rs
index db86f748..13c2a3c4 100644
--- a/wgpu/src/triangle/msaa.rs
+++ b/wgpu/src/triangle/msaa.rs
@@ -32,7 +32,10 @@ impl Blit {
entries: &[wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStage::FRAGMENT,
- ty: wgpu::BindingType::Sampler { comparison: false },
+ ty: wgpu::BindingType::Sampler {
+ comparison: false,
+ filtering: true,
+ },
count: None,
}],
});
@@ -53,9 +56,11 @@ impl Blit {
entries: &[wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStage::FRAGMENT,
- ty: wgpu::BindingType::SampledTexture {
- dimension: wgpu::TextureViewDimension::D2,
- component_type: wgpu::TextureComponentType::Float,
+ ty: wgpu::BindingType::Texture {
+ sample_type: wgpu::TextureSampleType::Float {
+ filterable: true,
+ },
+ view_dimension: wgpu::TextureViewDimension::D2,
multisampled: false,
},
count: None,
@@ -69,11 +74,11 @@ impl Blit {
bind_group_layouts: &[&constant_layout, &texture_layout],
});
- let vs_module = device.create_shader_module(wgpu::include_spirv!(
+ let vs_module = device.create_shader_module(&wgpu::include_spirv!(
"../shader/blit.vert.spv"
));
- let fs_module = device.create_shader_module(wgpu::include_spirv!(
+ let fs_module = device.create_shader_module(&wgpu::include_spirv!(
"../shader/blit.frag.spv"
));
@@ -81,42 +86,42 @@ impl Blit {
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("iced_wgpu::triangle::msaa pipeline"),
layout: Some(&layout),
- vertex_stage: wgpu::ProgrammableStageDescriptor {
+ vertex: wgpu::VertexState {
module: &vs_module,
entry_point: "main",
+ buffers: &[],
},
- fragment_stage: Some(wgpu::ProgrammableStageDescriptor {
+ fragment: Some(wgpu::FragmentState {
module: &fs_module,
entry_point: "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,
+ },
+ write_mask: wgpu::ColorWrite::ALL,
+ }],
}),
- rasterization_state: Some(wgpu::RasterizationStateDescriptor {
+ primitive: wgpu::PrimitiveState {
+ topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Cw,
cull_mode: wgpu::CullMode::None,
..Default::default()
- }),
- primitive_topology: wgpu::PrimitiveTopology::TriangleList,
- color_states: &[wgpu::ColorStateDescriptor {
- format,
- color_blend: wgpu::BlendDescriptor {
- src_factor: wgpu::BlendFactor::SrcAlpha,
- dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
- operation: wgpu::BlendOperation::Add,
- },
- alpha_blend: wgpu::BlendDescriptor {
- src_factor: wgpu::BlendFactor::One,
- dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
- operation: wgpu::BlendOperation::Add,
- },
- write_mask: wgpu::ColorWrite::ALL,
- }],
- depth_stencil_state: None,
- vertex_state: wgpu::VertexStateDescriptor {
- index_format: wgpu::IndexFormat::Uint16,
- vertex_buffers: &[],
},
- sample_count: 1,
- sample_mask: !0,
- alpha_to_coverage_enabled: false,
+ depth_stencil: None,
+
+ multisample: wgpu::MultisampleState {
+ count: 1,
+ mask: !0,
+ alpha_to_coverage_enabled: false,
+ },
});
Blit {
@@ -172,6 +177,7 @@ impl Blit {
) {
let mut render_pass =
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
+ label: Some("iced_wgpu::triangle::msaa Render Pass"),
color_attachments: &[
wgpu::RenderPassColorAttachmentDescriptor {
attachment: target,
@@ -227,7 +233,7 @@ impl Targets {
sample_count,
dimension: wgpu::TextureDimension::D2,
format,
- usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
+ usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
});
let resolve = device.create_texture(&wgpu::TextureDescriptor {
@@ -237,7 +243,7 @@ impl Targets {
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format,
- usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT
+ usage: wgpu::TextureUsage::RENDER_ATTACHMENT
| wgpu::TextureUsage::SAMPLED,
});