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,
|
||||
vertex_buffers: Vec<wgpu::VertexBufferLayout<'a>>,
|
||||
sample_count: u32,
|
||||
sample_mask: u32,
|
||||
sample_mask: u64,
|
||||
alpha_to_coverage_enabled: bool,
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ impl<'a> RenderPipelineBuilder<'a> {
|
||||
}
|
||||
|
||||
#[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
|
||||
}
|
||||
@ -227,17 +227,10 @@ impl<'a> RenderPipelineBuilder<'a> {
|
||||
},
|
||||
depth_stencil: self.depth_stencil.clone(),
|
||||
multisample: wgpu::MultisampleState {
|
||||
count: 1,
|
||||
mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
count: self.sample_count,
|
||||
mask: self.sample_mask,
|
||||
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)
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ async fn run() {
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: Some("Device"),
|
||||
features: wgpu::Features::empty(),
|
||||
limits: wgpu::Limits::default(),
|
||||
shader_validation: true,
|
||||
},
|
||||
None, // Trace path
|
||||
)
|
||||
@ -79,6 +79,7 @@ async fn run() {
|
||||
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
|
||||
|
||||
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("GIF Pass"),
|
||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &render_target.view,
|
||||
resolve_target: None,
|
||||
@ -181,12 +182,20 @@ fn create_render_pipeline(
|
||||
vertex: wgpu::VertexState {
|
||||
module: &vs_module,
|
||||
entry_point: "main",
|
||||
buffers: &[],
|
||||
},
|
||||
fragment: Some(wgpu::FragmentState {
|
||||
module: &fs_module,
|
||||
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 {
|
||||
topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
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
|
||||
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,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
vertex_buffers: &[],
|
||||
multisample: wgpu::MultisampleState {
|
||||
count: 1,
|
||||
mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
sample_count: 1,
|
||||
sample_mask: !0,
|
||||
alpha_to_coverage_enabled: false,
|
||||
});
|
||||
|
||||
render_pipeline
|
||||
|
@ -98,6 +98,7 @@ for c in &colors {
|
||||
});
|
||||
|
||||
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("GIF Pass"),
|
||||
color_attachments: &[
|
||||
wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &render_target.view,
|
||||
|
Loading…
Reference in New Issue
Block a user