mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-29 10:13:34 +00:00
Merge #1282
1282: Update naga to gfx-18 r=kvark a=Gordon-F Same as https://github.com/gfx-rs/gfx/pull/3695. Just waiting for new naga relese. Co-authored-by: Gordon-F <ishaposhnik@icloud.com>
This commit is contained in:
commit
b7ba481a91
24
Cargo.lock
generated
24
Cargo.lock
generated
@ -465,7 +465,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-auxil"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
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=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
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=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
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=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
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=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
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=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
@ -575,7 +575,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-vulkan"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ash",
|
||||
@ -595,7 +595,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-hal"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"naga",
|
||||
@ -754,9 +754,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "khronos-egl"
|
||||
version = "4.0.0"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e8cc4d128654d2191681ab98140c4d99e4bd9333efe1526e033586a5a061e1e"
|
||||
checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"libloading 0.7.0",
|
||||
@ -918,7 +918,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/gfx-rs/naga?tag=gfx-17#d5fbb193c354ec4886345435288a83df321c1c8e"
|
||||
source = "git+https://github.com/gfx-rs/naga?tag=gfx-18#e87f57d82c44b12fe0288d876b050e9ddd1d6e1b"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags",
|
||||
@ -1173,7 +1173,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "range-alloc"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=455ab67830ddf8b47f0d1e07eece65539e36e5a6#455ab67830ddf8b47f0d1e07eece65539e36e5a6"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0#2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0"
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
|
@ -39,28 +39,28 @@ thiserror = "1"
|
||||
gpu-alloc = { version = "0.3" }
|
||||
gpu-descriptor = { version = "0.1" }
|
||||
|
||||
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
|
||||
[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 = "455ab67830ddf8b47f0d1e07eece65539e36e5a6", features = ["naga"] }
|
||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0", features = ["naga"] }
|
||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
|
||||
[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 = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6", optional = true }
|
||||
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0", optional = true }
|
||||
|
||||
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
|
||||
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6", features = ["naga"] }
|
||||
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0", features = ["naga"] }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "455ab67830ddf8b47f0d1e07eece65539e36e5a6" }
|
||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "2ac006f7fe86f32dd5b5e07f9daf44cd876a66f0" }
|
||||
|
||||
[dependencies.naga]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
tag = "gfx-17"
|
||||
tag = "gfx-18"
|
||||
features = ["spv-in", "spv-out", "wgsl-in"]
|
||||
|
||||
[dependencies.wgt]
|
||||
|
@ -1017,7 +1017,7 @@ impl<B: GfxBackend> Device<B> {
|
||||
let (naga_result, interface) = match module {
|
||||
// If succeeded, then validate it and attempt to give it to gfx-hal directly.
|
||||
Some(module) if desc.flags.contains(wgt::ShaderFlags::VALIDATION) || spv.is_none() => {
|
||||
let analysis = naga::proc::Validator::new().validate(&module)?;
|
||||
let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all()).validate(&module)?;
|
||||
if !self.features.contains(wgt::Features::PUSH_CONSTANTS)
|
||||
&& module
|
||||
.global_variables
|
||||
@ -1028,8 +1028,8 @@ impl<B: GfxBackend> Device<B> {
|
||||
wgt::Features::PUSH_CONSTANTS,
|
||||
));
|
||||
}
|
||||
let interface = validation::Interface::new(&module, &analysis);
|
||||
let shader = hal::device::NagaShader { module, analysis };
|
||||
let interface = validation::Interface::new(&module, &info);
|
||||
let shader = hal::device::NagaShader { module, info };
|
||||
let naga_result = if desc
|
||||
.flags
|
||||
.contains(wgt::ShaderFlags::EXPERIMENTAL_TRANSLATION)
|
||||
@ -1061,7 +1061,7 @@ impl<B: GfxBackend> Device<B> {
|
||||
let shader = maybe_shader.unwrap();
|
||||
naga::back::spv::write_vec(
|
||||
&shader.module,
|
||||
&shader.analysis,
|
||||
&shader.info,
|
||||
&self.spv_options,
|
||||
)
|
||||
.map(Cow::Owned)
|
||||
|
@ -59,7 +59,7 @@ pub enum CreateShaderModuleError {
|
||||
#[error(transparent)]
|
||||
Device(#[from] DeviceError),
|
||||
#[error(transparent)]
|
||||
Validation(#[from] naga::proc::ValidationError),
|
||||
Validation(#[from] naga::valid::ValidationError),
|
||||
#[error("missing required device features {0:?}")]
|
||||
MissingFeature(wgt::Features),
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::{binding_model::BindEntryMap, FastHashMap};
|
||||
use naga::proc::{analyzer::GlobalUse, Layouter};
|
||||
use naga::valid::GlobalUse;
|
||||
use std::collections::hash_map::Entry;
|
||||
use thiserror::Error;
|
||||
use wgt::{BindGroupLayoutEntry, BindingType};
|
||||
@ -680,8 +680,7 @@ impl Interface {
|
||||
list.push(varying);
|
||||
}
|
||||
|
||||
pub fn new(module: &naga::Module, analysis: &naga::proc::analyzer::Analysis) -> Self {
|
||||
let layouter = Layouter::new(&module.types, &module.constants);
|
||||
pub fn new(module: &naga::Module, info: &naga::valid::ModuleInfo) -> Self {
|
||||
let mut resources = naga::Arena::new();
|
||||
let mut resource_mapping = FastHashMap::default();
|
||||
for (var_handle, var) in module.global_variables.iter() {
|
||||
@ -694,8 +693,7 @@ impl Interface {
|
||||
block: true,
|
||||
members: _,
|
||||
} => {
|
||||
//TODO: fix the Naga's resolve to include one element of a dynamic array
|
||||
let actual_size = layouter.resolve(var.ty).size.max(1);
|
||||
let actual_size = info.layouter[var.ty].size;
|
||||
ResourceType::Buffer {
|
||||
size: wgt::BufferSize::new(actual_size as u64).unwrap(),
|
||||
}
|
||||
@ -727,7 +725,7 @@ impl Interface {
|
||||
let mut entry_points = FastHashMap::default();
|
||||
entry_points.reserve(module.entry_points.len());
|
||||
for (index, entry_point) in (&module.entry_points).iter().enumerate() {
|
||||
let info = analysis.get_entry_point(index);
|
||||
let info = info.get_entry_point(index);
|
||||
let mut ep = EntryPoint::default();
|
||||
for arg in entry_point.function.arguments.iter() {
|
||||
Self::populate(&mut ep.inputs, arg.binding.as_ref(), arg.ty, &module.types);
|
||||
|
Loading…
Reference in New Issue
Block a user