diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 26769fc2b8..a37c2718cd 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -28,20 +28,20 @@ cross = ["wgc/cross"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "41f106d7fc8e2ca49b21aed0919fa6cc67317f7f" +rev = "45f890c11c6b1251e269afa5bfdd681d409c9202" features = ["raw-window-handle"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "41f106d7fc8e2ca49b21aed0919fa6cc67317f7f" +rev = "45f890c11c6b1251e269afa5bfdd681d409c9202" features = ["raw-window-handle"] optional = true [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "41f106d7fc8e2ca49b21aed0919fa6cc67317f7f" +rev = "45f890c11c6b1251e269afa5bfdd681d409c9202" [dependencies] arrayvec = "0.5" diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index b76a93ce21..6e87583278 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -1,10 +1,11 @@ use crate::{ backend::{error::ContextError, native_gpu_future}, AdapterInfo, BindGroupDescriptor, BindGroupLayoutDescriptor, BindingResource, - CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor, Features, Label, - Limits, LoadOp, MapMode, Operations, PipelineLayoutDescriptor, RenderBundleEncoderDescriptor, - RenderPipelineDescriptor, SamplerDescriptor, ShaderModuleDescriptor, ShaderSource, - SwapChainStatus, TextureDescriptor, TextureFormat, TextureViewDescriptor, + CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor, + DownlevelProperties, Features, Label, Limits, LoadOp, MapMode, Operations, + PipelineLayoutDescriptor, RenderBundleEncoderDescriptor, RenderPipelineDescriptor, + SamplerDescriptor, ShaderModuleDescriptor, ShaderSource, SwapChainStatus, TextureDescriptor, + TextureFormat, TextureViewDescriptor, }; use arrayvec::ArrayVec; @@ -731,6 +732,14 @@ impl crate::Context for Context { } } + fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> DownlevelProperties { + let global = &self.0; + match wgc::gfx_select!(*adapter => global.adapter_downlevel_properties(*adapter)) { + Ok(downlevel) => downlevel, + Err(err) => self.handle_error_fatal(err, "Adapter::downlevel_properties"), + } + } + fn adapter_get_info(&self, adapter: &wgc::id::AdapterId) -> AdapterInfo { let global = &self.0; match wgc::gfx_select!(*adapter => global.adapter_get_info(*adapter)) { @@ -768,6 +777,14 @@ impl crate::Context for Context { } } + fn device_downlevel_properties(&self, device: &Self::DeviceId) -> DownlevelProperties { + let global = &self.0; + match wgc::gfx_select!(device.id => global.device_downlevel_properties(device.id)) { + Ok(limits) => limits, + Err(err) => self.handle_error_fatal(err, "Device::downlevel_properties"), + } + } + fn device_create_swap_chain( &self, device: &Self::DeviceId, diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index e8972ae1db..45210b8bf1 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -1080,6 +1080,11 @@ impl crate::Context for Context { } } + fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> wgt::DownlevelProperties { + // WebGPU is assumed to be fully compliant + wgt::DownlevelProperties::default() + } + fn adapter_get_info(&self, _adapter: &Self::AdapterId) -> wgt::AdapterInfo { // TODO: web-sys has no way of getting information on adapters wgt::AdapterInfo { @@ -1109,6 +1114,11 @@ impl crate::Context for Context { wgt::Limits::default() } + fn device_downlevel_properties(&self, _device: &Self::DeviceId) -> wgt::DownlevelProperties { + // WebGPU is assumed to be fully compliant + wgt::DownlevelProperties::default() + } + fn device_create_swap_chain( &self, device: &Self::DeviceId, diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 91b76fca7f..5b366d4c6f 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -28,15 +28,16 @@ pub use wgt::{ AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType, BlendComponent, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType, BufferSize, BufferUsage, Color, ColorTargetState, ColorWrite, CommandBufferDescriptor, - CompareFunction, DepthBiasState, DepthStencilState, DeviceType, DynamicOffset, Extent3d, Face, - Features, FilterMode, FrontFace, ImageDataLayout, 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, TextureDimension, TextureFormat, TextureFormatFeatureFlags, - TextureFormatFeatures, TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute, - VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, + CompareFunction, DepthBiasState, DepthStencilState, DeviceType, DownlevelFlags, + DownlevelProperties, DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, + ImageDataLayout, IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d, + PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode, PrimitiveState, + PrimitiveTopology, PushConstantRange, QuerySetDescriptor, QueryType, SamplerBorderColor, + ShaderFlags, ShaderLocation, ShaderModel, ShaderStage, StencilFaceState, StencilOperation, + StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, TextureAspect, + TextureDimension, TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures, + TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute, VertexFormat, + BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, QUERY_SET_MAX_QUERIES, QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT, }; @@ -205,6 +206,7 @@ trait Context: Debug + Send + Sized + Sync { ) -> Option; fn adapter_features(&self, adapter: &Self::AdapterId) -> Features; fn adapter_limits(&self, adapter: &Self::AdapterId) -> Limits; + fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> DownlevelProperties; fn adapter_get_info(&self, adapter: &Self::AdapterId) -> AdapterInfo; fn adapter_get_texture_format_features( &self, @@ -214,6 +216,7 @@ trait Context: Debug + Send + Sized + Sync { fn device_features(&self, device: &Self::DeviceId) -> Features; fn device_limits(&self, device: &Self::DeviceId) -> Limits; + fn device_downlevel_properties(&self, device: &Self::DeviceId) -> DownlevelProperties; fn device_create_swap_chain( &self, device: &Self::DeviceId,