diff options
author | 2023-09-24 15:10:19 +0200 | |
---|---|---|
committer | 2023-09-24 15:10:19 +0200 | |
commit | 3f467d121229142177ef1b2f417fe87c7bf7fdf2 (patch) | |
tree | f7c98f9009dca79b7d164801a8badb0fab1f7089 /wgpu/src/quad/solid.rs | |
parent | bc9bb28b1ccd1248d63ccdfef2f57d7aa837abbb (diff) | |
download | iced-3f467d121229142177ef1b2f417fe87c7bf7fdf2.tar.gz iced-3f467d121229142177ef1b2f417fe87c7bf7fdf2.tar.bz2 iced-3f467d121229142177ef1b2f417fe87c7bf7fdf2.zip |
Compute vertex position in shader
Diffstat (limited to 'wgpu/src/quad/solid.rs')
-rw-r--r-- | wgpu/src/quad/solid.rs | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/wgpu/src/quad/solid.rs b/wgpu/src/quad/solid.rs index 9bc6b466..bab7367d 100644 --- a/wgpu/src/quad/solid.rs +++ b/wgpu/src/quad/solid.rs @@ -87,27 +87,24 @@ impl Pipeline { vertex: wgpu::VertexState { module: &shader, entry_point: "solid_vs_main", - buffers: &[ - quad::Vertex::buffer_layout(), - wgpu::VertexBufferLayout { - array_stride: std::mem::size_of::<Solid>() as u64, - step_mode: wgpu::VertexStepMode::Instance, - attributes: &wgpu::vertex_attr_array!( - // Color - 1 => Float32x4, - // Position - 2 => Float32x2, - // Size - 3 => Float32x2, - // Border color - 4 => Float32x4, - // Border radius - 5 => Float32x4, - // Border width - 6 => Float32, - ), - }, - ], + buffers: &[wgpu::VertexBufferLayout { + array_stride: std::mem::size_of::<Solid>() as u64, + step_mode: wgpu::VertexStepMode::Instance, + attributes: &wgpu::vertex_attr_array!( + // Color + 1 => Float32x4, + // Position + 2 => Float32x2, + // Size + 3 => Float32x2, + // Border color + 4 => Float32x4, + // Border radius + 5 => Float32x4, + // Border width + 6 => Float32, + ), + }], }, fragment: Some(wgpu::FragmentState { module: &shader, @@ -143,12 +140,8 @@ impl Pipeline { render_pass.set_pipeline(&self.pipeline); render_pass.set_bind_group(0, constants, &[]); - render_pass.set_vertex_buffer(1, layer.instances.slice(..)); + render_pass.set_vertex_buffer(0, layer.instances.slice(..)); - render_pass.draw_indexed( - 0..quad::INDICES.len() as u32, - 0, - range.start as u32..range.end as u32, - ); + render_pass.draw(0..6, range.start as u32..range.end as u32); } } |