From 3615fd2b559f3d0f0aeba4cc108402f50ff6b828 Mon Sep 17 00:00:00 2001 From: Bram Buurlage Date: Sun, 8 Nov 2020 20:08:28 +0100 Subject: [PATCH 1/2] Added RenderPass::set_scissor_rect --- crates/bevy_render/src/pass/render_pass.rs | 1 + crates/bevy_wgpu/src/wgpu_render_pass.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/crates/bevy_render/src/pass/render_pass.rs b/crates/bevy_render/src/pass/render_pass.rs index aac0bf4bc9c48..7d5091b125fd1 100644 --- a/crates/bevy_render/src/pass/render_pass.rs +++ b/crates/bevy_render/src/pass/render_pass.rs @@ -11,6 +11,7 @@ pub trait RenderPass { fn set_vertex_buffer(&mut self, start_slot: u32, buffer: BufferId, offset: u64); fn set_pipeline(&mut self, pipeline_handle: &Handle); fn set_viewport(&mut self, x: f32, y: f32, w: f32, h: f32, min_depth: f32, max_depth: f32); + fn set_scissor_rect(&mut self, x: u32, y: u32, w: u32, h: u32); fn set_stencil_reference(&mut self, reference: u32); fn draw(&mut self, vertices: Range, instances: Range); fn draw_indexed(&mut self, indices: Range, base_vertex: i32, instances: Range); diff --git a/crates/bevy_wgpu/src/wgpu_render_pass.rs b/crates/bevy_wgpu/src/wgpu_render_pass.rs index a27ff795f8942..35b6e75229f40 100644 --- a/crates/bevy_wgpu/src/wgpu_render_pass.rs +++ b/crates/bevy_wgpu/src/wgpu_render_pass.rs @@ -31,6 +31,11 @@ impl<'a> RenderPass for WgpuRenderPass<'a> { .set_viewport(x, y, w, h, min_depth, max_depth); } + fn set_scissor_rect(&mut self, x: u32, y: u32, w: u32, h: u32) { + self.render_pass + .set_scissor_rect(x, y, w, h); + } + fn set_stencil_reference(&mut self, reference: u32) { self.render_pass.set_stencil_reference(reference); } From 74bc11651b35e7df6091ca6c93585674efcb1d86 Mon Sep 17 00:00:00 2001 From: Bram Buurlage Date: Sun, 8 Nov 2020 20:25:40 +0100 Subject: [PATCH 2/2] formatting --- crates/bevy_wgpu/src/wgpu_render_pass.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/bevy_wgpu/src/wgpu_render_pass.rs b/crates/bevy_wgpu/src/wgpu_render_pass.rs index 35b6e75229f40..6aa59b7f3415a 100644 --- a/crates/bevy_wgpu/src/wgpu_render_pass.rs +++ b/crates/bevy_wgpu/src/wgpu_render_pass.rs @@ -32,8 +32,7 @@ impl<'a> RenderPass for WgpuRenderPass<'a> { } fn set_scissor_rect(&mut self, x: u32, y: u32, w: u32, h: u32) { - self.render_pass - .set_scissor_rect(x, y, w, h); + self.render_pass.set_scissor_rect(x, y, w, h); } fn set_stencil_reference(&mut self, reference: u32) {