Update gfx and naga to gfx-13 tag (#1248)

* wgpu-core: update gfx-hal usage related to sparse resources

* wgpu-core: support naga gfx-13

* Update gfx and naga dependencies to gfx-13 tag

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
Anthony Cowley 2021-03-10 00:04:16 -05:00 committed by GitHub
parent 6f49f041d3
commit f01feacc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 31 deletions

37
Cargo.lock generated
View File

@ -215,6 +215,16 @@ dependencies = [
"objc",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
dependencies = [
"termcolor",
"unicode-width",
]
[[package]]
name = "copyless"
version = "0.1.5"
@ -477,7 +487,7 @@ dependencies = [
[[package]]
name = "gfx-auxil"
version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"fxhash",
"gfx-hal",
@ -487,7 +497,7 @@ dependencies = [
[[package]]
name = "gfx-backend-dx11"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"arrayvec",
"bitflags",
@ -508,7 +518,7 @@ dependencies = [
[[package]]
name = "gfx-backend-dx12"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"arrayvec",
"bit-set",
@ -528,7 +538,7 @@ dependencies = [
[[package]]
name = "gfx-backend-empty"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"gfx-hal",
"log",
@ -538,7 +548,7 @@ dependencies = [
[[package]]
name = "gfx-backend-gl"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"arrayvec",
"bitflags",
@ -561,7 +571,7 @@ dependencies = [
[[package]]
name = "gfx-backend-metal"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"arrayvec",
"bitflags",
@ -586,7 +596,7 @@ dependencies = [
[[package]]
name = "gfx-backend-vulkan"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"arrayvec",
"ash",
@ -606,7 +616,7 @@ dependencies = [
[[package]]
name = "gfx-hal"
version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
dependencies = [
"bitflags",
"naga",
@ -948,10 +958,11 @@ dependencies = [
[[package]]
name = "naga"
version = "0.3.1"
source = "git+https://github.com/gfx-rs/naga?tag=gfx-12#fa7d4d8b51d4eeffe9f648d285466637f733a4a1"
source = "git+https://github.com/gfx-rs/naga?tag=gfx-13#f5ee79191223e4ebe323a728f4de40830b8d10f6"
dependencies = [
"bit-set",
"bitflags",
"codespan-reporting",
"fxhash",
"log",
"num-traits",
@ -1213,7 +1224,7 @@ dependencies = [
[[package]]
name = "range-alloc"
version = "0.1.2"
source = "git+https://github.com/gfx-rs/gfx?rev=0a201d1c406b5119ec11068293a40e50ec0be4c8#0a201d1c406b5119ec11068293a40e50ec0be4c8"
source = "git+https://github.com/gfx-rs/gfx?rev=cd96e77952dd2e330fe2c31f768203eef47a0d6a#cd96e77952dd2e330fe2c31f768203eef47a0d6a"
[[package]]
name = "raw-window-handle"
@ -1632,6 +1643,12 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc"
[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
version = "0.2.1"

View File

@ -38,28 +38,28 @@ thiserror = "1"
gpu-alloc = { version = "0.3", features = ["tracing"] }
gpu-descriptor = { version = "0.1", features = ["tracing"] }
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
[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 = "0a201d1c406b5119ec11068293a40e50ec0be4c8", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
[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 = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8", optional = true }
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a", optional = true }
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8", features = ["naga"] }
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a", features = ["naga"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "0a201d1c406b5119ec11068293a40e50ec0be4c8" }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "cd96e77952dd2e330fe2c31f768203eef47a0d6a" }
[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
tag = "gfx-12"
tag = "gfx-13"
features = ["spv-in", "spv-out", "wgsl-in"]
[dependencies.wgt]

View File

@ -558,12 +558,14 @@ impl<B: GfxBackend> Device<B> {
flags
};
let mut buffer = unsafe { self.raw.create_buffer(desc.size.max(1), usage) }.map_err(
|err| match err {
hal::buffer::CreationError::OutOfMemory(_) => DeviceError::OutOfMemory,
_ => panic!("failed to create buffer: {}", err),
},
)?;
let mut buffer = unsafe {
self.raw
.create_buffer(desc.size.max(1), usage, hal::memory::SparseFlags::empty())
}
.map_err(|err| match err {
hal::buffer::CreationError::OutOfMemory(_) => DeviceError::OutOfMemory,
_ => panic!("failed to create buffer: {}", err),
})?;
if let Some(ref label) = desc.label {
unsafe { self.raw.set_buffer_name(&mut buffer, label) };
}
@ -678,6 +680,7 @@ impl<B: GfxBackend> Device<B> {
format,
hal::image::Tiling::Optimal,
usage,
hal::memory::SparseFlags::empty(),
view_caps,
)
.map_err(|err| match err {

View File

@ -111,7 +111,11 @@ impl<B: hal::Backend> super::Device<B> {
fn prepare_stage(&mut self, size: wgt::BufferAddress) -> Result<StagingData<B>, DeviceError> {
let mut buffer = unsafe {
self.raw
.create_buffer(size, hal::buffer::Usage::TRANSFER_SRC)
.create_buffer(
size,
hal::buffer::Usage::TRANSFER_SRC,
hal::memory::SparseFlags::empty(),
)
.map_err(|err| match err {
hal::buffer::CreationError::OutOfMemory(_) => DeviceError::OutOfMemory,
_ => panic!("failed to create staging buffer: {}", err),

View File

@ -735,8 +735,8 @@ impl Interface {
let mut entry_points = FastHashMap::default();
entry_points.reserve(module.entry_points.len());
for (&(stage, ref ep_name), _entry_point) in module.entry_points.iter() {
let info = analysis.get_entry_point(stage, ep_name);
for (index, entry_point) in (&module.entry_points).into_iter().enumerate() {
let info = analysis.get_entry_point(index);
let mut ep = EntryPoint::default();
for (var_handle, var) in module.global_variables.iter() {
let usage = info[var_handle];
@ -786,7 +786,7 @@ impl Interface {
}
}
}
entry_points.insert((stage, ep_name.clone()), ep);
entry_points.insert((entry_point.stage, entry_point.name.clone()), ep);
}
Interface {