From edf269dbedf390afb1e3e1eb225c237021826400 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 22 Jan 2019 17:08:21 -0800 Subject: [PATCH] Remove the non-winit path from the example --- examples/hello_triangle_rust/main.rs | 35 ---------------------------- wgpu-native/src/command/compute.rs | 3 +++ wgpu-native/src/command/render.rs | 1 - 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/examples/hello_triangle_rust/main.rs b/examples/hello_triangle_rust/main.rs index b193fbd13..2568bb67b 100644 --- a/examples/hello_triangle_rust/main.rs +++ b/examples/hello_triangle_rust/main.rs @@ -117,39 +117,4 @@ fn main() { ControlFlow::Continue }); } - - #[cfg(not(feature = "winit"))] - { - let _ = render_pipeline; - let texture = device.create_texture(&wgpu::TextureDescriptor { - size: wgpu::Extent3d { - width: 256, - height: 256, - depth: 1, - }, - array_size: 1, - dimension: wgpu::TextureDimension::D2, - format: wgpu::TextureFormat::R8g8b8a8Unorm, - usage: wgpu::TextureUsageFlags::OUTPUT_ATTACHMENT, - }); - let color_view = texture.create_default_texture_view(); - - let mut cmd_buf = device.create_command_buffer(&wgpu::CommandBufferDescriptor {}); - { - let rpass = cmd_buf.begin_render_pass(&wgpu::RenderPassDescriptor { - color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { - attachment: &color_view, - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_color: wgpu::Color::GREEN, - }], - depth_stencil_attachment: None, - }); - rpass.end_pass(); - } - - device - .get_queue() - .submit(&[cmd_buf]); - } } diff --git a/wgpu-native/src/command/compute.rs b/wgpu-native/src/command/compute.rs index ba9d217d3..e9a739d86 100644 --- a/wgpu-native/src/command/compute.rs +++ b/wgpu-native/src/command/compute.rs @@ -66,6 +66,9 @@ pub extern "C" fn wgpu_compute_pass_set_bind_group( let bind_group_guard = HUB.bind_groups.read(); let bind_group = bind_group_guard.get(bind_group_id); + //Note: currently, WebGPU compute passes have synchronization defined + // at a dispatch granularity, so we insert the necessary barriers here. + CommandBuffer::insert_barriers( &mut pass.raw, pass.buffer_tracker.consume_by_replace(&bind_group.used_buffers), diff --git a/wgpu-native/src/command/render.rs b/wgpu-native/src/command/render.rs index 648befdf0..b5b42b801 100644 --- a/wgpu-native/src/command/render.rs +++ b/wgpu-native/src/command/render.rs @@ -73,7 +73,6 @@ pub extern "C" fn wgpu_render_pass_set_index_buffer( TrackPermit::EXTEND, ) .unwrap(); - buffer_guard.get(buffer_id); let view = hal::buffer::IndexBufferView { buffer: &buffer.raw,