diff --git a/Cargo.lock b/Cargo.lock index d75ab1ea5..af786b5ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -465,7 +465,7 @@ dependencies = [ [[package]] name = "gfx-auxil" version = "0.8.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "fxhash", "gfx-hal", @@ -475,7 +475,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "arrayvec", "bitflags", @@ -496,7 +496,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "arrayvec", "bit-set", @@ -517,7 +517,7 @@ dependencies = [ [[package]] name = "gfx-backend-empty" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "gfx-hal", "log", @@ -527,7 +527,7 @@ dependencies = [ [[package]] name = "gfx-backend-gl" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "arrayvec", "bitflags", @@ -550,7 +550,7 @@ dependencies = [ [[package]] name = "gfx-backend-metal" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "arrayvec", "bitflags", @@ -576,7 +576,7 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "arrayvec", "ash", @@ -596,7 +596,7 @@ dependencies = [ [[package]] name = "gfx-hal" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" dependencies = [ "bitflags", "naga", @@ -1172,7 +1172,7 @@ dependencies = [ [[package]] name = "range-alloc" version = "0.1.2" -source = "git+https://github.com/gfx-rs/gfx?rev=69991710a968e1e846148cdba425077e00b6febe#69991710a968e1e846148cdba425077e00b6febe" +source = "git+https://github.com/gfx-rs/gfx?rev=84e02f96149207b1bafecb1924b14315930c98ee#84e02f96149207b1bafecb1924b14315930c98ee" [[package]] name = "raw-window-handle" diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index ebec44eb1..52403131c 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -40,24 +40,24 @@ thiserror = "1" gpu-alloc = { git = "https://github.com/zakarumych/gpu-alloc.git", rev = "2cd1ad650cdd24d1647b6041f77ced0cbf1ff2a6" } gpu-descriptor = { version = "0.1" } -hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } -gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } +hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } +gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } [target.'cfg(all(not(target_arch = "wasm32"), all(unix, not(target_os = "ios"), not(target_os = "macos"))))'.dependencies] -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe", features = ["naga"] } -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee", features = ["naga"] } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } [target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies] -gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe", optional = true } +gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee", optional = true } [target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies] -gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } -gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe", features = ["naga"] } +gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } +gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee", features = ["naga"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "69991710a968e1e846148cdba425077e00b6febe" } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "84e02f96149207b1bafecb1924b14315930c98ee" } [dependencies.naga] git = "https://github.com/gfx-rs/naga" diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 409984ff6..4275b16ad 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -864,6 +864,8 @@ impl Device { conv::map_texture_view_dimension(view_dim), conv::map_texture_format(format, self.private_features), hal::format::Swizzle::NO, + // conservatively assume the same usage + conv::map_texture_usage(texture.usage, aspects), range, ) .or(Err(resource::CreateTextureViewError::OutOfMemory))? @@ -947,6 +949,7 @@ impl Device { min_filter: conv::map_filter(desc.min_filter), mag_filter: conv::map_filter(desc.mag_filter), mip_filter: conv::map_filter(desc.mipmap_filter), + reduction_mode: hal::image::ReductionMode::WeightedAverage, wrap_mode: ( conv::map_wrap(desc.address_modes[0]), conv::map_wrap(desc.address_modes[1]), @@ -1892,9 +1895,9 @@ impl Device { let (shader_module_guard, _) = hub.shader_modules.read(&mut token); let entry_point_name = &desc.stage.entry_point; - let shader_module = shader_module_guard.get(desc.stage.module).map_err(|_| { - pipeline::CreateComputePipelineError::Stage(validation::StageError::InvalidModule) - })?; + let shader_module = shader_module_guard + .get(desc.stage.module) + .map_err(|_| validation::StageError::InvalidModule)?; let flag = wgt::ShaderStage::COMPUTE; if let Some(ref interface) = shader_module.interface { @@ -1912,15 +1915,13 @@ impl Device { None } }; - let _ = interface - .check_stage( - provided_layouts.as_ref().map(|p| p.as_slice()), - &mut derived_group_layouts, - &entry_point_name, - flag, - io, - ) - .map_err(pipeline::CreateComputePipelineError::Stage)?; + let _ = interface.check_stage( + provided_layouts.as_ref().map(|p| p.as_slice()), + &mut derived_group_layouts, + &entry_point_name, + flag, + io, + )?; } else if desc.layout.is_none() { return Err(pipeline::ImplicitLayoutError::ReflectionError(flag).into()); } @@ -2240,7 +2241,7 @@ impl Device { let shader_module = shader_module_guard.get(stage.module).map_err(|_| { pipeline::CreateRenderPipelineError::Stage { - flag, + stage: flag, error: validation::StageError::InvalidModule, } })?; @@ -2267,7 +2268,10 @@ impl Device { flag, io, ) - .map_err(|error| pipeline::CreateRenderPipelineError::Stage { flag, error })?; + .map_err(|error| pipeline::CreateRenderPipelineError::Stage { + stage: flag, + error, + })?; validated_stages |= flag; } @@ -2287,7 +2291,7 @@ impl Device { shader_module_guard .get(fragment.stage.module) .map_err(|_| pipeline::CreateRenderPipelineError::Stage { - flag, + stage: flag, error: validation::StageError::InvalidModule, })?; @@ -2312,7 +2316,7 @@ impl Device { io, ) .map_err(|error| pipeline::CreateRenderPipelineError::Stage { - flag, + stage: flag, error, })?; validated_stages |= flag; diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index ffab09b8c..c8661e572 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -111,8 +111,8 @@ pub enum CreateComputePipelineError { InvalidLayout, #[error("unable to derive an implicit layout")] Implicit(#[from] ImplicitLayoutError), - #[error(transparent)] - Stage(validation::StageError), + #[error("error matching shader requirements against the pipeline")] + Stage(#[from] validation::StageError), #[error("Internal error: {0}")] Internal(String), #[error( @@ -246,13 +246,13 @@ pub enum CreateRenderPipelineError { ConservativeRasterizationNonFillPolygonMode, #[error("missing required device features {0:?}")] MissingFeature(wgt::Features), - #[error("error in stage {flag:?}")] + #[error("error matching {stage:?} shader requirements against the pipeline")] Stage { - flag: wgt::ShaderStage, + stage: wgt::ShaderStage, #[source] error: validation::StageError, }, - #[error("Internal error in stage {stage:?}: {error}")] + #[error("Internal error in {stage:?} shader: {error}")] Internal { stage: wgt::ShaderStage, error: String, diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index d36d555d8..ddd588f07 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -216,7 +216,7 @@ pub enum StageError { InvalidModule, #[error("unable to find entry point '{0:?}'")] MissingEntryPoint(String), - #[error("error matching global {0:?} against the pipeline layout")] + #[error("shader global {0:?} is not available in the layout pipeline layout")] Binding(naga::ResourceBinding, #[source] BindingError), #[error("unable to filter the texture ({texture:?}) by the sampler ({sampler:?})")] Filtering { @@ -225,9 +225,7 @@ pub enum StageError { #[source] error: FilteringError, }, - #[error( - "error matching the stage input at {location} ({var}) against the previous stage outputs" - )] + #[error("location[{location}] {var} is not provided by the previous stage outputs")] Input { location: wgt::ShaderLocation, var: InterfaceVar,