Removed empty bind group from integration example (#390)

This commit is contained in:
Richard 2020-06-08 06:03:34 -03:00 committed by GitHub
parent 9e01adc964
commit 40750d9b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,17 +3,13 @@ use iced_winit::Color;
pub struct Scene { pub struct Scene {
pipeline: wgpu::RenderPipeline, pipeline: wgpu::RenderPipeline,
bind_group: wgpu::BindGroup,
} }
impl Scene { impl Scene {
pub fn new(device: &wgpu::Device) -> Scene { pub fn new(device: &wgpu::Device) -> Scene {
let (pipeline, bind_group) = build_pipeline(device); let pipeline = build_pipeline(device);
Scene { Scene { pipeline }
pipeline,
bind_group,
}
} }
pub fn clear<'a>( pub fn clear<'a>(
@ -45,14 +41,11 @@ impl Scene {
pub fn draw<'a>(&'a self, render_pass: &mut wgpu::RenderPass<'a>) { pub fn draw<'a>(&'a self, render_pass: &mut wgpu::RenderPass<'a>) {
render_pass.set_pipeline(&self.pipeline); render_pass.set_pipeline(&self.pipeline);
render_pass.set_bind_group(0, &self.bind_group, &[]);
render_pass.draw(0..3, 0..1); render_pass.draw(0..3, 0..1);
} }
} }
fn build_pipeline( fn build_pipeline(device: &wgpu::Device) -> wgpu::RenderPipeline {
device: &wgpu::Device,
) -> (wgpu::RenderPipeline, wgpu::BindGroup) {
let vs = include_bytes!("shader/vert.spv"); let vs = include_bytes!("shader/vert.spv");
let fs = include_bytes!("shader/frag.spv"); let fs = include_bytes!("shader/frag.spv");
@ -64,21 +57,9 @@ fn build_pipeline(
&wgpu::read_spirv(std::io::Cursor::new(&fs[..])).unwrap(), &wgpu::read_spirv(std::io::Cursor::new(&fs[..])).unwrap(),
); );
let bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: None,
bindings: &[],
});
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: None,
layout: &bind_group_layout,
bindings: &[],
});
let pipeline_layout = let pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
bind_group_layouts: &[&bind_group_layout], bind_group_layouts: &[],
}); });
let pipeline = let pipeline =
@ -116,5 +97,5 @@ fn build_pipeline(
alpha_to_coverage_enabled: false, alpha_to_coverage_enabled: false,
}); });
(pipeline, bind_group) pipeline
} }