mirror of
https://github.com/sotrh/learn-wgpu.git
synced 2024-11-10 01:10:28 +00:00
migrated gifs showcase
This commit is contained in:
parent
fb73851e5d
commit
5029aa196d
@ -16,7 +16,7 @@ pub struct RenderPipelineBuilder<'a> {
|
|||||||
index_format: wgpu::IndexFormat,
|
index_format: wgpu::IndexFormat,
|
||||||
vertex_buffers: Vec<wgpu::VertexBufferLayout<'a>>,
|
vertex_buffers: Vec<wgpu::VertexBufferLayout<'a>>,
|
||||||
sample_count: u32,
|
sample_count: u32,
|
||||||
sample_mask: u32,
|
sample_mask: u64,
|
||||||
alpha_to_coverage_enabled: bool,
|
alpha_to_coverage_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ impl<'a> RenderPipelineBuilder<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn sample_mask(&mut self, sm: u32) -> &mut Self {
|
pub fn sample_mask(&mut self, sm: u64) -> &mut Self {
|
||||||
self.sample_mask = sm;
|
self.sample_mask = sm;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -227,17 +227,10 @@ impl<'a> RenderPipelineBuilder<'a> {
|
|||||||
},
|
},
|
||||||
depth_stencil: self.depth_stencil.clone(),
|
depth_stencil: self.depth_stencil.clone(),
|
||||||
multisample: wgpu::MultisampleState {
|
multisample: wgpu::MultisampleState {
|
||||||
count: 1,
|
count: self.sample_count,
|
||||||
mask: !0,
|
mask: self.sample_mask,
|
||||||
alpha_to_coverage_enabled: false,
|
alpha_to_coverage_enabled: self.alpha_to_coverage_enabled,
|
||||||
},
|
},
|
||||||
// vertex_state: wgpu::VertexStateDescriptor {
|
|
||||||
// index_format: self.index_format,
|
|
||||||
// vertex_buffers: &self.vertex_buffers,
|
|
||||||
// },
|
|
||||||
// sample_count: self.sample_count,
|
|
||||||
// sample_mask: self.sample_mask,
|
|
||||||
// alpha_to_coverage_enabled: self.alpha_to_coverage_enabled,
|
|
||||||
});
|
});
|
||||||
Ok(pipeline)
|
Ok(pipeline)
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ async fn run() {
|
|||||||
let (device, queue) = adapter
|
let (device, queue) = adapter
|
||||||
.request_device(
|
.request_device(
|
||||||
&wgpu::DeviceDescriptor {
|
&wgpu::DeviceDescriptor {
|
||||||
|
label: Some("Device"),
|
||||||
features: wgpu::Features::empty(),
|
features: wgpu::Features::empty(),
|
||||||
limits: wgpu::Limits::default(),
|
limits: wgpu::Limits::default(),
|
||||||
shader_validation: true,
|
|
||||||
},
|
},
|
||||||
None, // Trace path
|
None, // Trace path
|
||||||
)
|
)
|
||||||
@ -79,6 +79,7 @@ async fn run() {
|
|||||||
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
|
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
|
||||||
|
|
||||||
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||||
|
label: Some("GIF Pass"),
|
||||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||||
attachment: &render_target.view,
|
attachment: &render_target.view,
|
||||||
resolve_target: None,
|
resolve_target: None,
|
||||||
@ -181,12 +182,20 @@ fn create_render_pipeline(
|
|||||||
vertex: wgpu::VertexState {
|
vertex: wgpu::VertexState {
|
||||||
module: &vs_module,
|
module: &vs_module,
|
||||||
entry_point: "main",
|
entry_point: "main",
|
||||||
|
buffers: &[],
|
||||||
},
|
},
|
||||||
fragment: Some(wgpu::FragmentState {
|
fragment: Some(wgpu::FragmentState {
|
||||||
module: &fs_module,
|
module: &fs_module,
|
||||||
entry_point: "main",
|
entry_point: "main",
|
||||||
|
targets: &[
|
||||||
|
wgpu::ColorTargetState {
|
||||||
|
format: target.desc.format,
|
||||||
|
color_blend: wgpu::BlendState::REPLACE,
|
||||||
|
alpha_blend: wgpu::BlendState::REPLACE,
|
||||||
|
write_mask: wgpu::ColorWrite::ALL,
|
||||||
|
}
|
||||||
|
]
|
||||||
}),
|
}),
|
||||||
rasterization_state: None,
|
|
||||||
primitive: wgpu::PrimitiveState {
|
primitive: wgpu::PrimitiveState {
|
||||||
topology: wgpu::PrimitiveTopology::TriangleList,
|
topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
strip_index_format: None,
|
strip_index_format: None,
|
||||||
@ -195,20 +204,12 @@ fn create_render_pipeline(
|
|||||||
// Setting this to anything other than Fill requires Features::NON_FILL_POLYGON_MODE
|
// Setting this to anything other than Fill requires Features::NON_FILL_POLYGON_MODE
|
||||||
polygon_mode: wgpu::PolygonMode::Fill,
|
polygon_mode: wgpu::PolygonMode::Fill,
|
||||||
},
|
},
|
||||||
color_states: &[wgpu::ColorStateDescriptor {
|
|
||||||
format: target.desc.format,
|
|
||||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
|
||||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
|
||||||
write_mask: wgpu::ColorWrite::ALL,
|
|
||||||
}],
|
|
||||||
depth_stencil: None,
|
depth_stencil: None,
|
||||||
vertex_state: wgpu::VertexStateDescriptor {
|
multisample: wgpu::MultisampleState {
|
||||||
index_format: wgpu::IndexFormat::Uint16,
|
count: 1,
|
||||||
vertex_buffers: &[],
|
mask: !0,
|
||||||
|
alpha_to_coverage_enabled: false,
|
||||||
},
|
},
|
||||||
sample_count: 1,
|
|
||||||
sample_mask: !0,
|
|
||||||
alpha_to_coverage_enabled: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
render_pipeline
|
render_pipeline
|
||||||
|
@ -98,6 +98,7 @@ for c in &colors {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||||
|
label: Some("GIF Pass"),
|
||||||
color_attachments: &[
|
color_attachments: &[
|
||||||
wgpu::RenderPassColorAttachmentDescriptor {
|
wgpu::RenderPassColorAttachmentDescriptor {
|
||||||
attachment: &render_target.view,
|
attachment: &render_target.view,
|
||||||
|
Loading…
Reference in New Issue
Block a user