diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index e455f6ee6..d48b97e62 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -26,20 +26,20 @@ webgl = ["wgc"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "05a531191d4ce2927f2157e5dd54b7aa5d779406" -features = ["raw-window-handle"] +rev = "5afe832c3c8e3417e4ad4d95f92a3f65379467ff" +features = ["raw-window-handle", "cross"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "05a531191d4ce2927f2157e5dd54b7aa5d779406" -features = ["raw-window-handle"] +rev = "5afe832c3c8e3417e4ad4d95f92a3f65379467ff" +features = ["raw-window-handle", "cross"] optional = true [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "05a531191d4ce2927f2157e5dd54b7aa5d779406" +rev = "5afe832c3c8e3417e4ad4d95f92a3f65379467ff" [dependencies] arrayvec = "0.5" @@ -54,7 +54,7 @@ bytemuck = { version = "1.4", features = ["derive"] } cgmath = "0.18" ddsfile = "0.4" log = "0.4" -naga = { git = "https://github.com/gfx-rs/naga", tag = "gfx-10", features = ["wgsl-in"] } +naga = { git = "https://github.com/gfx-rs/naga", tag = "gfx-11", features = ["wgsl-in"] } noise = "0.7" obj = "0.10" png = "0.16" @@ -68,7 +68,7 @@ wgpu-subscriber = "0.1" [target.'cfg(target_arch = "wasm32")'.dependencies.naga] git = "https://github.com/gfx-rs/naga" -tag = "gfx-10" +tag = "gfx-11" features = ["wgsl-in", "spv-out"] [[example]] diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index 73d6879ad..b00a83022 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -421,7 +421,7 @@ impl framework::Example for Example { let mut flags = wgpu::ShaderFlags::VALIDATION; match adapter.get_info().backend { - wgpu::Backend::Vulkan => { + wgpu::Backend::Metal | wgpu::Backend::Vulkan => { flags |= wgpu::ShaderFlags::EXPERIMENTAL_TRANSLATION; } _ => (), //TODO diff --git a/wgpu/examples/shadow/shader.wgsl b/wgpu/examples/shadow/shader.wgsl index a9244df63..6f6106b0f 100644 --- a/wgpu/examples/shadow/shader.wgsl +++ b/wgpu/examples/shadow/shader.wgsl @@ -62,7 +62,7 @@ var s_lights: [[access(read)]] Lights; [[group(0), binding(2)]] var t_shadow: texture_depth_2d_array; [[group(0), binding(3)]] -var sampler_shadow: sampler; +var sampler_shadow: sampler_comparison; fn fetch_shadow(light_id: u32, homogeneous_coords: vec4) -> f32 { if (homogeneous_coords.w <= 0.0) { diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 1326d7e81..956d462dd 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -1050,7 +1050,12 @@ impl crate::Context for Context { let module = wgsl::parse_str(code).unwrap(); let mut capabilities = HashSet::default(); capabilities.insert(spv::Capability::Shader); - let words = spv::write_vec(&module, spv::WriterFlags::NONE, capabilities).unwrap(); + let options = spv::Options { + lang_version: (1, 0), + flags: spv::WriterFlags::empty(), + capabilities, + }; + let words = spv::write_vec(&module, &options).unwrap(); web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(&words[..])) } }; diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 66dd6faff..feec92e4c 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -27,12 +27,12 @@ use parking_lot::Mutex; pub use wgt::{ AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType, BufferSize, BufferUsage, Color, - ColorTargetState, ColorWrite, CommandBufferDescriptor, CompareFunction, Face, - DepthBiasState, DepthStencilState, DeviceType, DynamicOffset, Extent3d, Features, FilterMode, - FrontFace, IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d, - PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode, PrimitiveState, - PrimitiveTopology, PushConstantRange, QuerySetDescriptor, QueryType, SamplerBorderColor, - ShaderFlags, ShaderLocation, ShaderStage, StencilFaceState, StencilOperation, StencilState, + ColorTargetState, ColorWrite, CommandBufferDescriptor, CompareFunction, DepthBiasState, + DepthStencilState, DeviceType, DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, + IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d, PipelineStatisticsTypes, + PolygonMode, PowerPreference, PresentMode, PrimitiveState, PrimitiveTopology, + PushConstantRange, QuerySetDescriptor, QueryType, SamplerBorderColor, ShaderFlags, + ShaderLocation, ShaderStage, StencilFaceState, StencilOperation, StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, TextureAspect, TextureDataLayout, TextureDimension, TextureFormat, TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute, VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, diff --git a/wgpu/src/util/mod.rs b/wgpu/src/util/mod.rs index 7730cf882..9f58ef99c 100644 --- a/wgpu/src/util/mod.rs +++ b/wgpu/src/util/mod.rs @@ -61,7 +61,11 @@ pub struct DownloadBuffer(super::Buffer, super::BufferMappedRange); impl DownloadBuffer { /// Asynchronously read the contents of a buffer. - pub fn read_buffer(device: &super::Device, queue: &super::Queue, buffer: &super::BufferSlice) -> impl Future> + Send { + pub fn read_buffer( + device: &super::Device, + queue: &super::Queue, + buffer: &super::BufferSlice, + ) -> impl Future> + Send { let size = match buffer.size { Some(size) => size.into(), None => buffer.buffer.map_context.lock().total_size - buffer.offset, @@ -74,7 +78,8 @@ impl DownloadBuffer { label: None, }); - let mut encoder = device.create_command_encoder(&super::CommandEncoderDescriptor { label: None }); + let mut encoder = + device.create_command_encoder(&super::CommandEncoderDescriptor { label: None }); encoder.copy_buffer_to_buffer(buffer.buffer, buffer.offset, &download, 0, size); let command_buffer: super::CommandBuffer = encoder.finish(); queue.submit(Some(command_buffer)); @@ -82,13 +87,14 @@ impl DownloadBuffer { let fut = download.slice(..).map_async(super::MapMode::Read); async move { fut.await?; - let mapped_range = super::Context::buffer_get_mapped_range(&*download.context, &download.id, 0..size); + let mapped_range = + super::Context::buffer_get_mapped_range(&*download.context, &download.id, 0..size); Ok(Self(download, mapped_range)) } } } -impl std::ops::Deref for DownloadBuffer{ +impl std::ops::Deref for DownloadBuffer { type Target = [u8]; fn deref(&self) -> &[u8] { super::BufferMappedRangeSlice::slice(&self.1)