mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-26 00:33:51 +00:00
Update naga to gfx-11
This commit is contained in:
parent
94ee3d6c33
commit
fdd50e10fd
49
Cargo.lock
generated
49
Cargo.lock
generated
@ -58,7 +58,7 @@ version = "0.31.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
|
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading",
|
"libloading 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -304,11 +304,10 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/d3d12-rs?rev=be19a243b86e0bafb9937d661fc8eabb3e42b44e#be19a243b86e0bafb9937d661fc8eabb3e42b44e"
|
||||||
checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libloading",
|
"libloading 0.7.0",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -370,7 +369,7 @@ version = "0.4.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"
|
checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading",
|
"libloading 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -476,7 +475,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-auxil"
|
name = "gfx-auxil"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
@ -486,13 +485,13 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx11"
|
name = "gfx-backend-dx11"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"gfx-auxil",
|
"gfx-auxil",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"libloading",
|
"libloading 0.7.0",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
@ -507,7 +506,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-dx12"
|
name = "gfx-backend-dx12"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
@ -527,7 +526,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-empty"
|
name = "gfx-backend-empty"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
@ -537,16 +536,17 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-gl"
|
name = "gfx-backend-gl"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"fxhash",
|
||||||
"gfx-auxil",
|
"gfx-auxil",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"glow",
|
"glow",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"khronos-egl",
|
"khronos-egl",
|
||||||
"libloading",
|
"libloading 0.7.0",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
@ -559,7 +559,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-metal"
|
name = "gfx-backend-metal"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -567,6 +567,7 @@ dependencies = [
|
|||||||
"cocoa-foundation",
|
"cocoa-foundation",
|
||||||
"copyless",
|
"copyless",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
|
"fxhash",
|
||||||
"gfx-auxil",
|
"gfx-auxil",
|
||||||
"gfx-hal",
|
"gfx-hal",
|
||||||
"log",
|
"log",
|
||||||
@ -583,7 +584,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-backend-vulkan"
|
name = "gfx-backend-vulkan"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"ash",
|
"ash",
|
||||||
@ -603,7 +604,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx-hal"
|
name = "gfx-hal"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"naga",
|
"naga",
|
||||||
@ -775,7 +776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a8020ff3b84f9ac87461216ad0501bc09b33c1cbe17404d8ea405160fd164bab"
|
checksum = "a8020ff3b84f9ac87461216ad0501bc09b33c1cbe17404d8ea405160fd164bab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"libloading",
|
"libloading 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -806,6 +807,16 @@ dependencies = [
|
|||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libloading"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"winapi 0.3.9",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@ -935,7 +946,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
source = "git+https://github.com/gfx-rs/naga?tag=gfx-10#4f19903f465b6970054b29b1750235e5e9b83ca5"
|
source = "git+https://github.com/gfx-rs/naga?tag=gfx-11#539db1a317d62c8c50e21ff908cf952c731a05b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-set",
|
"bit-set",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -1201,7 +1212,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "range-alloc"
|
name = "range-alloc"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283"
|
source = "git+https://github.com/gfx-rs/gfx?rev=80655862ac4afc5efb6675eb9ac7c38e73544750#80655862ac4afc5efb6675eb9ac7c38e73544750"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-handle"
|
name = "raw-window-handle"
|
||||||
@ -1254,7 +1265,7 @@ checksum = "58fd0c55a54ecce0889aaca4ee87831cfe8c83c275c439443162be1f0eab5fdc"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"float-cmp",
|
"float-cmp",
|
||||||
"libloading",
|
"libloading 0.6.5",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"renderdoc-sys",
|
"renderdoc-sys",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
|
@ -12,4 +12,4 @@ publish = false
|
|||||||
[dependencies.wgc]
|
[dependencies.wgc]
|
||||||
path = "../wgpu-core"
|
path = "../wgpu-core"
|
||||||
package = "wgpu-core"
|
package = "wgpu-core"
|
||||||
features = ["serial-pass", "trace"]
|
features = ["cross", "serial-pass", "trace"]
|
||||||
|
@ -13,6 +13,8 @@ license = "MPL-2.0"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
# Enable SPIRV-Cross
|
||||||
|
cross = ["gfx-backend-metal/cross", "gfx-backend-gl/cross"]
|
||||||
# Enable API tracing
|
# Enable API tracing
|
||||||
trace = ["ron", "serde", "wgt/trace", "naga/serialize"]
|
trace = ["ron", "serde", "wgt/trace", "naga/serialize"]
|
||||||
# Enable API replaying
|
# Enable API replaying
|
||||||
@ -36,28 +38,28 @@ thiserror = "1"
|
|||||||
gpu-alloc = { version = "0.3", features = ["tracing"] }
|
gpu-alloc = { version = "0.3", features = ["tracing"] }
|
||||||
gpu-descriptor = { version = "0.1", features = ["tracing"] }
|
gpu-descriptor = { version = "0.1", features = ["tracing"] }
|
||||||
|
|
||||||
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" }
|
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" }
|
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
|
|
||||||
[target.'cfg(all(not(target_arch = "wasm32"), all(unix, not(target_os = "ios"), not(target_os = "macos"))))'.dependencies]
|
[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 = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] }
|
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750", features = ["naga"] }
|
||||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] }
|
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
|
|
||||||
[target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies]
|
[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 = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] }
|
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", optional = true }
|
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750", optional = true }
|
||||||
|
|
||||||
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
|
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
|
||||||
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" }
|
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" }
|
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] }
|
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750", features = ["naga"] }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] }
|
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "80655862ac4afc5efb6675eb9ac7c38e73544750" }
|
||||||
|
|
||||||
[dependencies.naga]
|
[dependencies.naga]
|
||||||
git = "https://github.com/gfx-rs/naga"
|
git = "https://github.com/gfx-rs/naga"
|
||||||
tag = "gfx-10"
|
tag = "gfx-11"
|
||||||
features = ["spv-in", "spv-out", "wgsl-in"]
|
features = ["spv-in", "spv-out", "wgsl-in"]
|
||||||
|
|
||||||
[dependencies.wgt]
|
[dependencies.wgt]
|
||||||
|
@ -13,8 +13,8 @@ use crate::{
|
|||||||
pipeline, resource, span, swap_chain,
|
pipeline, resource, span, swap_chain,
|
||||||
track::{BufferState, TextureSelector, TextureState, TrackerSet},
|
track::{BufferState, TextureSelector, TextureState, TrackerSet},
|
||||||
validation::{self, check_buffer_usage, check_texture_usage},
|
validation::{self, check_buffer_usage, check_texture_usage},
|
||||||
FastHashMap, FastHashSet, Label, LabelHelpers, LifeGuard, MultiRefCount, PrivateFeatures,
|
FastHashMap, Label, LabelHelpers, LifeGuard, MultiRefCount, PrivateFeatures, Stored,
|
||||||
Stored, SubmissionIndex, MAX_BIND_GROUPS,
|
SubmissionIndex, MAX_BIND_GROUPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
@ -285,7 +285,7 @@ pub struct Device<B: hal::Backend> {
|
|||||||
pub(crate) private_features: PrivateFeatures,
|
pub(crate) private_features: PrivateFeatures,
|
||||||
pub(crate) limits: wgt::Limits,
|
pub(crate) limits: wgt::Limits,
|
||||||
pub(crate) features: wgt::Features,
|
pub(crate) features: wgt::Features,
|
||||||
spirv_capabilities: FastHashSet<naga::back::spv::Capability>,
|
spv_options: naga::back::spv::Options,
|
||||||
//TODO: move this behind another mutex. This would allow several methods to switch
|
//TODO: move this behind another mutex. This would allow several methods to switch
|
||||||
// to borrow Device immutably, such as `write_buffer`, `write_texture`, and `buffer_unmap`.
|
// to borrow Device immutably, such as `write_buffer`, `write_texture`, and `buffer_unmap`.
|
||||||
pending_writes: queue::PendingWrites<B>,
|
pending_writes: queue::PendingWrites<B>,
|
||||||
@ -310,8 +310,6 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
desc: &DeviceDescriptor,
|
desc: &DeviceDescriptor,
|
||||||
trace_path: Option<&std::path::Path>,
|
trace_path: Option<&std::path::Path>,
|
||||||
) -> Result<Self, CreateDeviceError> {
|
) -> Result<Self, CreateDeviceError> {
|
||||||
use naga::back::spv::Capability as C;
|
|
||||||
|
|
||||||
let cmd_allocator = command::CommandAllocator::new(queue_group.family, &raw)
|
let cmd_allocator = command::CommandAllocator::new(queue_group.family, &raw)
|
||||||
.or(Err(CreateDeviceError::OutOfMemory))?;
|
.or(Err(CreateDeviceError::OutOfMemory))?;
|
||||||
|
|
||||||
@ -323,11 +321,26 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut spirv_capabilities = FastHashSet::default();
|
let spv_options = {
|
||||||
spirv_capabilities.insert(C::Shader);
|
use naga::back::spv;
|
||||||
spirv_capabilities.insert(C::Matrix);
|
let mut flags = spv::WriterFlags::empty();
|
||||||
spirv_capabilities.insert(C::Sampled1D);
|
if cfg!(debug_assertions) {
|
||||||
spirv_capabilities.insert(C::Image1D);
|
flags |= spv::WriterFlags::DEBUG;
|
||||||
|
}
|
||||||
|
spv::Options {
|
||||||
|
lang_version: (1, 0),
|
||||||
|
capabilities: [
|
||||||
|
spv::Capability::Shader,
|
||||||
|
spv::Capability::Matrix,
|
||||||
|
spv::Capability::Sampled1D,
|
||||||
|
spv::Capability::Image1D,
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.collect(),
|
||||||
|
flags,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
raw,
|
raw,
|
||||||
@ -363,7 +376,7 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
private_features,
|
private_features,
|
||||||
limits: desc.limits.clone(),
|
limits: desc.limits.clone(),
|
||||||
features: desc.features.clone(),
|
features: desc.features.clone(),
|
||||||
spirv_capabilities,
|
spv_options,
|
||||||
pending_writes: queue::PendingWrites::new(),
|
pending_writes: queue::PendingWrites::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -995,9 +1008,8 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
|
|
||||||
let (naga_result, interface) = match module {
|
let (naga_result, interface) = match module {
|
||||||
// If succeeded, then validate it and attempt to give it to gfx-hal directly.
|
// If succeeded, then validate it and attempt to give it to gfx-hal directly.
|
||||||
Some(module) => {
|
Some(module) if desc.flags.contains(wgt::ShaderFlags::VALIDATION) => {
|
||||||
let interface = if desc.flags.contains(wgt::ShaderFlags::VALIDATION) {
|
let analysis = naga::proc::Validator::new().validate(&module)?;
|
||||||
naga::proc::Validator::new().validate(&module)?;
|
|
||||||
if !self.features.contains(wgt::Features::PUSH_CONSTANTS)
|
if !self.features.contains(wgt::Features::PUSH_CONSTANTS)
|
||||||
&& module
|
&& module
|
||||||
.global_variables
|
.global_variables
|
||||||
@ -1008,28 +1020,27 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
wgt::Features::PUSH_CONSTANTS,
|
wgt::Features::PUSH_CONSTANTS,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
Some(validation::Interface::new(&module))
|
let interface = validation::Interface::new(&module);
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
let naga_result = if desc
|
let naga_result = if desc
|
||||||
.flags
|
.flags
|
||||||
.contains(wgt::ShaderFlags::EXPERIMENTAL_TRANSLATION)
|
.contains(wgt::ShaderFlags::EXPERIMENTAL_TRANSLATION)
|
||||||
{
|
{
|
||||||
match unsafe { self.raw.create_shader_module_from_naga(module) } {
|
let shader = hal::device::NagaShader { module, analysis };
|
||||||
|
match unsafe { self.raw.create_shader_module_from_naga(shader) } {
|
||||||
Ok(raw) => Ok(raw),
|
Ok(raw) => Ok(raw),
|
||||||
Err((hal::device::ShaderError::CompilationFailed(msg), module)) => {
|
Err((hal::device::ShaderError::CompilationFailed(msg), shader)) => {
|
||||||
tracing::warn!("Shader module compilation failed: {}", msg);
|
tracing::warn!("Shader module compilation failed: {}", msg);
|
||||||
Err(Some(module))
|
Err(Some(shader.module))
|
||||||
}
|
}
|
||||||
Err((_, module)) => Err(Some(module)),
|
Err((_, shader)) => Err(Some(shader.module)),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(Some(module))
|
Err(Some(module))
|
||||||
};
|
};
|
||||||
(naga_result, interface)
|
(naga_result, Some(interface))
|
||||||
}
|
}
|
||||||
None => (Err(None), None),
|
Some(module) => (Err(Some(module)), None),
|
||||||
|
_ => (Err(None), None),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Otherwise, fall back to SPIR-V.
|
// Otherwise, fall back to SPIR-V.
|
||||||
@ -1041,12 +1052,7 @@ impl<B: GfxBackend> Device<B> {
|
|||||||
None => {
|
None => {
|
||||||
// Produce a SPIR-V from the Naga module
|
// Produce a SPIR-V from the Naga module
|
||||||
let module = maybe_module.unwrap();
|
let module = maybe_module.unwrap();
|
||||||
let mut flags = naga::back::spv::WriterFlags::empty();
|
naga::back::spv::write_vec(&module, &self.spv_options).map(Cow::Owned)
|
||||||
if cfg!(debug_assertions) {
|
|
||||||
flags |= naga::back::spv::WriterFlags::DEBUG;
|
|
||||||
}
|
|
||||||
naga::back::spv::write_vec(&module, flags, self.spirv_capabilities.clone())
|
|
||||||
.map(Cow::Owned)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match spv {
|
match spv {
|
||||||
|
Loading…
Reference in New Issue
Block a user