mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-26 00:33:51 +00:00
[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:
commit
4e33716df3
@ -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]
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user