(
enc: &mut wgpu::CommandEncoder,
pipe: &wgpu::RenderPipeline,
color_view: &wgpu::TextureView,
depth_view: &wgpu::TextureView,
bg: &wgpu::BindGroup,
vbuf: &wgpu::Buffer,
ib
| 315 | } |
| 316 | |
| 317 | fn render_one( |
| 318 | enc: &mut wgpu::CommandEncoder, |
| 319 | pipe: &wgpu::RenderPipeline, |
| 320 | color_view: &wgpu::TextureView, |
| 321 | depth_view: &wgpu::TextureView, |
| 322 | bg: &wgpu::BindGroup, |
| 323 | vbuf: &wgpu::Buffer, |
| 324 | ibuf: &wgpu::Buffer, |
| 325 | index_count: u32, |
| 326 | clear: bool, |
| 327 | ) { |
| 328 | let load = if clear { |
| 329 | wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT) |
| 330 | } else { |
| 331 | wgpu::LoadOp::Load |
| 332 | }; |
| 333 | let mut rp = enc.begin_render_pass(&wgpu::RenderPassDescriptor { |
| 334 | label: Some("imposter-pass"), |
| 335 | color_attachments: &[Some(wgpu::RenderPassColorAttachment { |
| 336 | view: color_view, |
| 337 | resolve_target: None, |
| 338 | ops: wgpu::Operations { load, store: wgpu::StoreOp::Store }, |
| 339 | depth_slice: None, |
| 340 | })], |
| 341 | depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { |
| 342 | view: depth_view, |
| 343 | depth_ops: Some(wgpu::Operations { load: wgpu::LoadOp::Clear(1.0), store: wgpu::StoreOp::Store }), |
| 344 | stencil_ops: None, |
| 345 | }), |
| 346 | timestamp_writes: None, |
| 347 | occlusion_query_set: None, |
| 348 | multiview_mask: None, |
| 349 | }); |
| 350 | rp.set_pipeline(pipe); |
| 351 | rp.set_bind_group(0, bg, &[]); |
| 352 | rp.set_vertex_buffer(0, vbuf.slice(..)); |
| 353 | rp.set_index_buffer(ibuf.slice(..), wgpu::IndexFormat::Uint32); |
| 354 | rp.draw_indexed(0..index_count, 0, 0..1); |
| 355 | } |
| 356 | |
| 357 | fn blit_into_atlas( |
| 358 | enc: &mut wgpu::CommandEncoder, |
no test coverage detected