[rs] Merge #28

28: msaa-line example fixes r=kvark a=rukai

This PR fixes the msaa-line example in addition to the fixes in https://github.com/gfx-rs/wgpu/pull/235

If https://github.com/gfx-rs/gfx/pull/2853 is merged first we can remove the crates.io patch.

Co-authored-by: Rukai <rubickent@gmail.com>
This commit is contained in:
bors[bot] 2019-06-24 14:34:19 +00:00
commit 4e33716df3
2 changed files with 17 additions and 4 deletions

View File

@ -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]

View File

@ -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);