Skip to content

Commit

Permalink
[rs] Merge gfx-rs#28
Browse files Browse the repository at this point in the history
28: msaa-line example fixes r=kvark a=rukai

This PR fixes the msaa-line example in addition to the fixes in gfx-rs#235

If gfx-rs/gfx#2853 is merged first we can remove the crates.io patch.

Co-authored-by: Rukai <rubickent@gmail.com>
  • Loading branch information
bors[bot] and rukai committed Jun 24, 2019
2 parents 2dd0b43 + 4e9aa5b commit 4e33716
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gl = ["wgn/gfx-backend-gl"]

[dependencies]
#TODO: only depend on the published version
wgn = { package = "wgpu-native", version = "0.2.6", features = ["local", "window-winit"], git = "https://github.com/gfx-rs/wgpu", rev = "a667d50d01c3df03b8540c523278e111da7fc82a" }
wgn = { package = "wgpu-native", version = "0.2.6", features = ["local", "window-winit"], git = "https://github.com/gfx-rs/wgpu", rev = "dbef9f397eda87b82ae1691b2f7e8ba0f3e2e5d2" }
arrayvec = "0.4"

[dev-dependencies]
Expand Down
19 changes: 16 additions & 3 deletions wgpu/examples/msaa-line/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,32 @@ impl framework::Example for Example {
fn render(&mut self, frame: &wgpu::SwapChainOutput, device: &mut wgpu::Device) {
if self.rebuild_pipeline {
self.pipeline = Example::create_pipeline(device, &self.sc_desc, &self.vs_module, &self.fs_module, &self.pipeline_layout, self.sample_count);
self.multisampled_framebuffer = Example::create_multisampled_framebuffer(device, &self.sc_desc, self.sample_count);
self.rebuild_pipeline = false;
}

let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { todo: 0 });
{
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
let rpass_color_attachment = if self.sample_count == 1 {
wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.view,
resolve_target: None,
load_op: wgpu::LoadOp::Clear,
store_op: wgpu::StoreOp::Store,
clear_color: wgpu::Color::BLACK,
}
} else {
wgpu::RenderPassColorAttachmentDescriptor {
attachment: &self.multisampled_framebuffer,
resolve_target: Some(&frame.view),
load_op: wgpu::LoadOp::Clear,
store_op: wgpu::StoreOp::Store,
clear_color: wgpu::Color::BLACK,
}],
}
};

let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
color_attachments: &[rpass_color_attachment],
depth_stencil_attachment: None,
});
rpass.set_pipeline(&self.pipeline);
Expand Down

0 comments on commit 4e33716

Please sign in to comment.