From bafcc5ace577eae1f2956370ebf9c7843f387b7d Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 15 Dec 2020 01:36:51 -0500 Subject: [PATCH] [rs] Update wgpu with Naga fixes and OpenGL backend --- wgpu/Cargo.toml | 12 ++---------- wgpu/examples/capture/main.rs | 1 - wgpu/examples/framework.rs | 5 ++--- wgpu/examples/hello-compute/main.rs | 1 - wgpu/examples/hello-triangle/main.rs | 3 +-- wgpu/examples/hello-windows/main.rs | 1 - wgpu/src/backend/direct.rs | 2 +- wgpu/src/lib.rs | 6 +++--- wgpu/src/macros.rs | 2 +- 9 files changed, 10 insertions(+), 23 deletions(-) diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index e345a05f8c..82b007b217 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -25,13 +25,13 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "42a8dc5b343b1c882d7c5bb03b0718602ea03915" +rev = "89e585af615c5ed2050a1cab7225f6e92a26b3ba" features = ["raw-window-handle"] [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "42a8dc5b343b1c882d7c5bb03b0718602ea03915" +rev = "89e585af615c5ed2050a1cab7225f6e92a26b3ba" [dependencies] arrayvec = "0.5" @@ -43,14 +43,6 @@ tracing = { version = "0.1", default-features = false, features = ["std"] } typed-arena = "2.0.1" serde = { version = "1", features = ["derive"], optional = true } -# Enable X11 support for GL -# Note: we may consider switching this to "dev-dependencies" if users -# want to opt into X11 explicitly. -[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies.gfx-backend-gl] -git = "https://github.com/gfx-rs/gfx" -rev = "f1398d29c7ad726968723a37187bd3932c539783" -features = ["x11"] - [dev-dependencies] cgmath = "0.17" log = "0.4" diff --git a/wgpu/examples/capture/main.rs b/wgpu/examples/capture/main.rs index 7c3e42e3f9..80f96aa21a 100644 --- a/wgpu/examples/capture/main.rs +++ b/wgpu/examples/capture/main.rs @@ -39,7 +39,6 @@ async fn create_red_image_with_dimensions( label: None, features: wgpu::Features::empty(), limits: wgpu::Limits::default(), - shader_validation: true, }, None, ) diff --git a/wgpu/examples/framework.rs b/wgpu/examples/framework.rs index cf6fb47621..d448b93bbd 100644 --- a/wgpu/examples/framework.rs +++ b/wgpu/examples/framework.rs @@ -142,7 +142,7 @@ async fn setup(title: &str) -> Setup { compatible_surface: Some(&surface), }) .await - .unwrap(); + .expect("No suitable GPU adapters found on the system!"); #[cfg(not(target_arch = "wasm32"))] { @@ -168,12 +168,11 @@ async fn setup(title: &str) -> Setup { label: None, features: (optional_features & adapter_features) | required_features, limits: needed_limits, - shader_validation: false, }, trace_dir.ok().as_ref().map(std::path::Path::new), ) .await - .unwrap(); + .expect("Unable to find a suitable GPU adapter!"); Setup { window, diff --git a/wgpu/examples/hello-compute/main.rs b/wgpu/examples/hello-compute/main.rs index 340e03d992..962b8c257d 100644 --- a/wgpu/examples/hello-compute/main.rs +++ b/wgpu/examples/hello-compute/main.rs @@ -37,7 +37,6 @@ async fn execute_gpu(numbers: Vec) -> Vec { label: None, features: wgpu::Features::empty(), limits: wgpu::Limits::default(), - shader_validation: true, }, None, ) diff --git a/wgpu/examples/hello-triangle/main.rs b/wgpu/examples/hello-triangle/main.rs index dcbe390a5c..7ce41c0387 100644 --- a/wgpu/examples/hello-triangle/main.rs +++ b/wgpu/examples/hello-triangle/main.rs @@ -25,7 +25,6 @@ async fn run(event_loop: EventLoop<()>, window: Window, swapchain_format: wgpu:: label: None, features: wgpu::Features::empty(), limits: wgpu::Limits::default(), - shader_validation: true, }, None, ) @@ -36,7 +35,7 @@ async fn run(event_loop: EventLoop<()>, window: Window, swapchain_format: wgpu:: let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - experimental_translation: true, + flags: wgpu::ShaderFlags::all(), }); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { diff --git a/wgpu/examples/hello-windows/main.rs b/wgpu/examples/hello-windows/main.rs index 74b54787c2..42f098cb14 100644 --- a/wgpu/examples/hello-windows/main.rs +++ b/wgpu/examples/hello-windows/main.rs @@ -88,7 +88,6 @@ async fn run( label: None, features: wgpu::Features::empty(), limits: wgpu::Limits::default(), - shader_validation: true, }, None, ) diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 80086ac1e5..c97b69e1c0 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -730,7 +730,7 @@ impl crate::Context for Context { let global = &self.0; let descriptor = wgc::pipeline::ShaderModuleDescriptor { label: desc.label.map(Borrowed), - experimental_translation: desc.experimental_translation, + flags: desc.flags, }; let source = match desc.source { ShaderSource::SpirV(ref spv) => wgc::pipeline::ShaderModuleSource::SpirV(Borrowed(spv)), diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 2191cb933b..7169fbc53e 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -38,7 +38,7 @@ pub use wgt::{ DepthStencilStateDescriptor, DynamicOffset, Extent3d, Features, FilterMode, FrontFace, IndexFormat, InputStepMode, Limits, Origin3d, PolygonMode, PowerPreference, PresentMode, PrimitiveTopology, PushConstantRange, RasterizationStateDescriptor, SamplerBorderColor, - ShaderLocation, ShaderStage, StencilOperation, StencilStateDescriptor, + ShaderFlags, ShaderLocation, ShaderStage, StencilOperation, StencilStateDescriptor, StencilStateFaceDescriptor, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, TextureAspect, TextureDataLayout, TextureDimension, TextureFormat, TextureSampleType, TextureUsage, TextureViewDimension, VertexAttributeDescriptor, VertexFormat, @@ -694,8 +694,8 @@ pub struct ShaderModuleDescriptor<'a> { pub label: Label<'a>, /// Source code for the shader. pub source: ShaderSource<'a>, - /// Experimental translation path attempts to avoid SPIR-V and work with Naga IR directly. - pub experimental_translation: bool, + /// Shader handling flags. + pub flags: ShaderFlags, } /// Handle to a pipeline layout. diff --git a/wgpu/src/macros.rs b/wgpu/src/macros.rs index 5521df199e..d31d645cdc 100644 --- a/wgpu/src/macros.rs +++ b/wgpu/src/macros.rs @@ -52,7 +52,7 @@ macro_rules! include_spirv { $crate::ShaderModuleDescriptor { label: Some($($token)*), source: $crate::util::make_spirv(include_bytes!($($token)*)), - experimental_translation: false, + flags: $crate::ShaderFlags::VALIDATION, } } };