diff options
author | 2023-11-28 23:25:42 +0100 | |
---|---|---|
committer | 2023-11-28 23:25:42 +0100 | |
commit | 133f4da9014fcdc331ac44269209ee61ca56d007 (patch) | |
tree | 4165df808d50fbaa4cb9b27ded59077b769a4135 /examples/custom_shader/src/scene/pipeline.rs | |
parent | 100d15f30654d446cffe2fb60a435c79c81b0188 (diff) | |
parent | ab7dae554cac801aeed5d9aa4d3850d50be86263 (diff) | |
download | iced-133f4da9014fcdc331ac44269209ee61ca56d007.tar.gz iced-133f4da9014fcdc331ac44269209ee61ca56d007.tar.bz2 iced-133f4da9014fcdc331ac44269209ee61ca56d007.zip |
Merge pull request #2149 from iced-rs/fix/custom-pipeline-translation
Provide actual bounds to `Shader` primitives
Diffstat (limited to 'examples/custom_shader/src/scene/pipeline.rs')
-rw-r--r-- | examples/custom_shader/src/scene/pipeline.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/custom_shader/src/scene/pipeline.rs b/examples/custom_shader/src/scene/pipeline.rs index 94c6c562..124b421f 100644 --- a/examples/custom_shader/src/scene/pipeline.rs +++ b/examples/custom_shader/src/scene/pipeline.rs @@ -351,7 +351,7 @@ impl Pipeline { &self, target: &wgpu::TextureView, encoder: &mut wgpu::CommandEncoder, - bounds: Rectangle<u32>, + viewport: Rectangle<u32>, num_cubes: u32, show_depth: bool, ) { @@ -384,10 +384,10 @@ impl Pipeline { }); pass.set_scissor_rect( - bounds.x, - bounds.y, - bounds.width, - bounds.height, + viewport.x, + viewport.y, + viewport.width, + viewport.height, ); pass.set_pipeline(&self.pipeline); pass.set_bind_group(0, &self.uniform_bind_group, &[]); @@ -397,7 +397,7 @@ impl Pipeline { } if show_depth { - self.depth_pipeline.render(encoder, target, bounds); + self.depth_pipeline.render(encoder, target, viewport); } } } @@ -550,7 +550,7 @@ impl DepthPipeline { &self, encoder: &mut wgpu::CommandEncoder, target: &wgpu::TextureView, - bounds: Rectangle<u32>, + viewport: Rectangle<u32>, ) { let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { label: Some("cubes.pipeline.depth_pass"), @@ -573,7 +573,12 @@ impl DepthPipeline { occlusion_query_set: None, }); - pass.set_scissor_rect(bounds.x, bounds.y, bounds.width, bounds.height); + pass.set_scissor_rect( + viewport.x, + viewport.y, + viewport.width, + viewport.height, + ); pass.set_pipeline(&self.pipeline); pass.set_bind_group(0, &self.bind_group, &[]); pass.draw(0..6, 0..1); |