mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures.
This commit is contained in:
parent
ce59cf1c5a
commit
8aa4e033a1
@ -25,14 +25,14 @@ git = "https://github.com/franziskuskiefer/cose-rust"
|
||||
rev = "43c22248d136c8b38fe42ea709d08da6355cf04b"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/gfx-rs/naga?rev=7a19f3af909202c7eafd36633b5584bfbb353ecb"]
|
||||
[source."git+https://github.com/gfx-rs/naga?rev=bac2d82a430fbfcf100ee22b7c3bc12f3d593079"]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/gfx-rs/wgpu?rev=57874e5c540330c8183e19ee87654cf24bb5c250"]
|
||||
[source."git+https://github.com/gfx-rs/wgpu?rev=7c6b85756237f77bfe8d6231dfc7a1412ff662b6"]
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/glandium/prost?rev=95964e9d33df3c2a9c3f14285e262867cab6f96b"]
|
||||
|
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -3730,13 +3730,13 @@ checksum = "a2983372caf4480544083767bf2d27defafe32af49ab4df3a0b7fc90793a3664"
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gfx-rs/naga?rev=7a19f3af909202c7eafd36633b5584bfbb353ecb#7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
source = "git+https://github.com/gfx-rs/naga?rev=bac2d82a430fbfcf100ee22b7c3bc12f3d593079#bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags 2.999.999",
|
||||
"codespan-reporting",
|
||||
"hexf-parse",
|
||||
"indexmap 2.999.999",
|
||||
"indexmap 1.9.3",
|
||||
"log",
|
||||
"num-traits",
|
||||
"rustc-hash",
|
||||
@ -6292,7 +6292,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.17.0"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=57874e5c540330c8183e19ee87654cf24bb5c250#57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7c6b85756237f77bfe8d6231dfc7a1412ff662b6#7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
@ -6315,7 +6315,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "0.17.0"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=57874e5c540330c8183e19ee87654cf24bb5c250#57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7c6b85756237f77bfe8d6231dfc7a1412ff662b6#7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
@ -6351,7 +6351,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "wgpu-types"
|
||||
version = "0.17.0"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=57874e5c540330c8183e19ee87654cf24bb5c250#57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
source = "git+https://github.com/gfx-rs/wgpu?rev=7c6b85756237f77bfe8d6231dfc7a1412ff662b6#7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
dependencies = [
|
||||
"bitflags 2.999.999",
|
||||
"js-sys",
|
||||
|
@ -9,7 +9,3 @@ path = "lib.rs"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.9.3"
|
||||
|
||||
[features]
|
||||
serde = ["indexmap/serde"]
|
||||
std = ["indexmap/std"]
|
||||
|
@ -17,7 +17,7 @@ default = []
|
||||
[dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
#Note: "replay" shouldn't ideally be needed,
|
||||
# but it allows us to serialize everything across IPC.
|
||||
features = ["replay", "trace", "serial-pass", "strict_asserts", "wgsl"]
|
||||
@ -27,32 +27,32 @@ features = ["replay", "trace", "serial-pass", "strict_asserts", "wgsl"]
|
||||
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
features = ["metal"]
|
||||
|
||||
# We want the wgpu-core Direct3D backends on Windows.
|
||||
[target.'cfg(windows)'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
features = ["dx11", "dx12"]
|
||||
|
||||
# We want the wgpu-core Vulkan backend on Linux and Windows.
|
||||
[target.'cfg(any(windows, all(unix, not(any(target_os = "macos", target_os = "ios")))))'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
features = ["vulkan"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
|
||||
[dependencies.wgh]
|
||||
package = "wgpu-hal"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
rev = "7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
|
||||
[dependencies]
|
||||
bincode = "1"
|
||||
|
@ -20,11 +20,11 @@ origin:
|
||||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: commit 57874e5c540330c8183e19ee87654cf24bb5c250
|
||||
release: commit 7c6b85756237f77bfe8d6231dfc7a1412ff662b6
|
||||
|
||||
# Revision to pull in
|
||||
# Must be a long or short commit SHA (long preferred)
|
||||
revision: 57874e5c540330c8183e19ee87654cf24bb5c250
|
||||
revision: 7c6b85756237f77bfe8d6231dfc7a1412ff662b6
|
||||
|
||||
license: ['MIT', 'Apache-2.0']
|
||||
|
||||
|
@ -2262,11 +2262,6 @@ who = "Teodor Tanasoaia <ttanasoaia@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.12.0@git:b99d58ea435090e561377949f428bce2c18451bb -> 0.12.0@git:76003dc0035d53a474d366dcdf49d2e4d12e921f"
|
||||
|
||||
[[audits.naga]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.13.0@git:bac2d82a430fbfcf100ee22b7c3bc12f3d593079 -> 0.13.0@git:7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
|
||||
[[audits.net2]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-run"
|
||||
@ -3949,11 +3944,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
|
||||
[[audits.wgpu-core]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6 -> 0.17.0@git:57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
|
||||
[[audits.wgpu-hal]]
|
||||
who = "Dzmitry Malyshau <kvark@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -4057,11 +4047,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
|
||||
[[audits.wgpu-hal]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6 -> 0.17.0@git:57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
|
||||
[[audits.wgpu-types]]
|
||||
who = "Dzmitry Malyshau <kvark@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -4165,11 +4150,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:09b010b26af6876ce84991576a168a572172f08d -> 0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6"
|
||||
|
||||
[[audits.wgpu-types]]
|
||||
who = "Nicolas Silva <nical@fastmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.17.0@git:7c6b85756237f77bfe8d6231dfc7a1412ff662b6 -> 0.17.0@git:57874e5c540330c8183e19ee87654cf24bb5c250"
|
||||
|
||||
[[audits.whatsys]]
|
||||
who = "Bobby Holley <bobbyholley@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
|
2
third_party/rust/naga/.cargo-checksum.json
vendored
2
third_party/rust/naga/.cargo-checksum.json
vendored
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@ env:
|
||||
CARGO_INCREMENTAL: false
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: full
|
||||
MSRV: 1.65
|
||||
MSRV: 1.63
|
||||
|
||||
jobs:
|
||||
check-msrv:
|
||||
@ -26,7 +26,7 @@ jobs:
|
||||
tool: cargo-hack
|
||||
|
||||
# -Z avoid-dev-deps doesn't work
|
||||
- run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z minimal-versions
|
||||
- run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z minimal-versions --offline
|
||||
|
||||
- name: Test all features
|
||||
run: cargo +$MSRV clippy --all-features --workspace -- -D warnings
|
||||
|
108
third_party/rust/naga/CHANGELOG.md
vendored
108
third_party/rust/naga/CHANGELOG.md
vendored
@ -1,99 +1,5 @@
|
||||
# Change Log
|
||||
|
||||
## Unreleased
|
||||
|
||||
#### GENERAL
|
||||
|
||||
- Bump MSRV to 1.65 ([#2420](https://github.com/gfx-rs/naga/pull/2420)) **@jimblandy**
|
||||
|
||||
## v0.13 (2023-07-21)
|
||||
|
||||
#### GENERAL
|
||||
|
||||
- Move from `make` to `cargo xtask` workflows. ([#2297](https://github.com/gfx-rs/naga/pull/2297)) **@ErichDonGubler**
|
||||
- Omit non referenced expressions from output. ([#2378](https://github.com/gfx-rs/naga/pull/2378)) **@teoxoy**
|
||||
- Bump `bitflags` to v2. ([#2358](https://github.com/gfx-rs/naga/pull/2358)) **@daxpedda**
|
||||
- Implement `workgroupUniformLoad`. ([#2201](https://github.com/gfx-rs/naga/pull/2201)) **@DJMcNab**
|
||||
|
||||
#### API
|
||||
|
||||
- Expose early depth test field. ([#2393](https://github.com/gfx-rs/naga/pull/2393)) **@Joeoc2001**
|
||||
- Split image bounds check policy. ([#2265](https://github.com/gfx-rs/naga/pull/2265)) **@teoxoy**
|
||||
- Change type of constant sized arrays to `NonZeroU32`. ([#2337](https://github.com/gfx-rs/naga/pull/2337)) **@teoxoy**
|
||||
- Introduce `GlobalCtx`. ([#2335](https://github.com/gfx-rs/naga/pull/2335)) **@teoxoy**
|
||||
- Introduce `Expression::Literal`. ([#2333](https://github.com/gfx-rs/naga/pull/2333)) **@teoxoy**
|
||||
- Introduce `Expression::ZeroValue`. ([#2332](https://github.com/gfx-rs/naga/pull/2332)) **@teoxoy**
|
||||
- Add support for const-expressions (only at the API level, functionality is still WIP). ([#2266](https://github.com/gfx-rs/naga/pull/2266)) **@teoxoy**, **@jimblandy**
|
||||
|
||||
#### DOCS
|
||||
|
||||
- Document which expressions are in scope for a `break_if` expression. ([#2326](https://github.com/gfx-rs/naga/pull/2326)) **@jimblandy**
|
||||
|
||||
#### VALIDATOR
|
||||
|
||||
- Don't `use std::opsIndex`, used only when `"validate"` is on. ([#2383](https://github.com/gfx-rs/naga/pull/2383)) **@jimblandy**
|
||||
- Remove unneeded `ConstantError::Unresolved{Component,Size}`. ([#2330](https://github.com/gfx-rs/naga/pull/2330)) **@ErichDonGubler**
|
||||
- Remove `TypeError::UnresolvedBase`. ([#2308](https://github.com/gfx-rs/naga/pull/2308)) **@ErichDonGubler**
|
||||
|
||||
#### WGSL-IN
|
||||
|
||||
- Error on param redefinition. ([#2342](https://github.com/gfx-rs/naga/pull/2342)) **@SparkyPotato**
|
||||
|
||||
#### SPV-IN
|
||||
|
||||
- Improve documentation for SPIR-V control flow parsing. ([#2324](https://github.com/gfx-rs/naga/pull/2324)) **@jimblandy**
|
||||
- Obey the `is_depth` field of `OpTypeImage`. ([#2341](https://github.com/gfx-rs/naga/pull/2341)) **@expenses**
|
||||
- Convert conditional backedges to `break if`. ([#2290](https://github.com/gfx-rs/naga/pull/2290)) **@eddyb**
|
||||
|
||||
#### GLSL-IN
|
||||
|
||||
- Support commas in structure definitions. ([#2400](https://github.com/gfx-rs/naga/pull/2400)) **@fornwall**
|
||||
|
||||
#### SPV-OUT
|
||||
|
||||
- Add debug info. ([#2379](https://github.com/gfx-rs/naga/pull/2379)) **@wicast**
|
||||
- Use `IndexSet` instead of `HashSet` for iterated sets (capabilities/extensions). ([#2389](https://github.com/gfx-rs/naga/pull/2389)) **@eddyb**
|
||||
- Support array bindings of buffers. ([#2282](https://github.com/gfx-rs/naga/pull/2282)) **@kvark**
|
||||
|
||||
#### MSL-OUT
|
||||
|
||||
- Rename `allow_point_size` to `allow_and_force_point_size`. ([#2280](https://github.com/gfx-rs/naga/pull/2280)) **@teoxoy**
|
||||
- Initialize arrays inline. ([#2331](https://github.com/gfx-rs/naga/pull/2331)) **@teoxoy**
|
||||
|
||||
#### HLSL-OUT
|
||||
|
||||
- Implement Pack/Unpack for HLSL. ([#2353](https://github.com/gfx-rs/naga/pull/2353)) **@Elabajaba**
|
||||
- Complete HLSL reserved symbols. ([#2367](https://github.com/gfx-rs/naga/pull/2367)) **@teoxoy**
|
||||
- Handle case insensitive FXC keywords. ([#2347](https://github.com/gfx-rs/naga/pull/2347)) **@PJB3005**
|
||||
- Fix return type for firstbitlow/high. ([#2315](https://github.com/gfx-rs/naga/pull/2315)) **@evahop**
|
||||
|
||||
#### GLSL-OUT
|
||||
|
||||
- `textureSize` level must be a signed integer. ([#2397](https://github.com/gfx-rs/naga/pull/2397)) **@nical**
|
||||
- Fix functions with array return type. ([#2382](https://github.com/gfx-rs/naga/pull/2382)) **@Gordon-F**
|
||||
|
||||
#### WGSL-OUT
|
||||
|
||||
- Output `@interpolate(flat)` attribute for integer locations. ([#2318](https://github.com/gfx-rs/naga/pull/2318)) **@expenses**
|
||||
|
||||
## v0.12.3 (2023-07-09)
|
||||
|
||||
#### WGSL-OUT
|
||||
|
||||
- (Backport) Output `@interpolate(flat)` attribute for integer locations. ([#2318](https://github.com/gfx-rs/naga/pull/2318)) **@expenses**
|
||||
|
||||
## v0.12.2 (2023-05-30)
|
||||
|
||||
#### SPV-OUT
|
||||
|
||||
- (Backport) Support array bindings of buffers. ([#2282](https://github.com/gfx-rs/naga/pull/2282)) **@kvark**
|
||||
|
||||
## v0.12.1 (2023-05-18)
|
||||
|
||||
#### SPV-IN
|
||||
|
||||
- (Backport) Convert conditional backedges to `break if`. ([#2290](https://github.com/gfx-rs/naga/pull/2290)) **@eddyb**
|
||||
|
||||
## v0.12 (2023-04-19)
|
||||
|
||||
#### GENERAL
|
||||
@ -165,12 +71,6 @@
|
||||
- Skip `invariant` for `gl_FragCoord` on WebGL2. ([#2254](https://github.com/gfx-rs/naga/pull/2254)) **@grovesNL**
|
||||
- Inject default `gl_PointSize = 1.0` in vertex shaders if `FORCE_POINT_SIZE` option was set. ([#2223](https://github.com/gfx-rs/naga/pull/2223)) **@REASY**
|
||||
|
||||
## v0.11.1 (2023-05-18)
|
||||
|
||||
#### SPV-IN
|
||||
|
||||
- (Backport) Convert conditional backedges to `break if`. ([#2290](https://github.com/gfx-rs/naga/pull/2290)) **@eddyb**
|
||||
|
||||
## v0.11 (2023-01-25)
|
||||
|
||||
- Move to the Rust 2021 edition ([#2085](https://github.com/gfx-rs/naga/pull/2085)) **@ErichDonGubler**
|
||||
@ -263,14 +163,6 @@
|
||||
|
||||
- Write correct scalar kind when `width != 4` ([#1514](https://github.com/gfx-rs/naga/pull/1514)) **@fintelia**
|
||||
|
||||
## v0.10.1 (2023-06-21)
|
||||
|
||||
SPV-OUT
|
||||
- Backport #2389 (Use `IndexSet` instead of `HashSet` for iterated sets (capabilities/extensions)) by @eddyb, @jimblandy in https://github.com/gfx-rs/naga/pull/2391
|
||||
|
||||
SPV-IN
|
||||
- Backport #2290 (Convert conditional backedges to `break if`) by @eddyb in https://github.com/gfx-rs/naga/pull/2387
|
||||
|
||||
## v0.10 (2022-10-05)
|
||||
|
||||
- Make termcolor dependency optional by @AldaronLau in https://github.com/gfx-rs/naga/pull/2014
|
||||
|
12
third_party/rust/naga/Cargo.toml
vendored
12
third_party/rust/naga/Cargo.toml
vendored
@ -11,7 +11,7 @@
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.63"
|
||||
name = "naga"
|
||||
version = "0.13.0"
|
||||
authors = ["Naga Developers"]
|
||||
@ -49,14 +49,14 @@ harness = false
|
||||
|
||||
[dependencies]
|
||||
bit-set = "0.5"
|
||||
bitflags = "2.2"
|
||||
bitflags = "2"
|
||||
log = "0.4"
|
||||
num-traits = "0.2"
|
||||
rustc-hash = "1.1.0"
|
||||
thiserror = "1.0.21"
|
||||
|
||||
[dependencies.arbitrary]
|
||||
version = "1.3"
|
||||
version = "1.0.2"
|
||||
features = ["derive"]
|
||||
optional = true
|
||||
|
||||
@ -69,7 +69,7 @@ version = "0.2.1"
|
||||
optional = true
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "2"
|
||||
version = "1.9.2"
|
||||
features = ["std"]
|
||||
|
||||
[dependencies.petgraph]
|
||||
@ -134,7 +134,7 @@ default = []
|
||||
deserialize = [
|
||||
"serde",
|
||||
"bitflags/serde",
|
||||
"indexmap/serde",
|
||||
"indexmap/serde-1",
|
||||
]
|
||||
dot-out = []
|
||||
glsl-in = ["pp-rs"]
|
||||
@ -144,7 +144,7 @@ msl-out = []
|
||||
serialize = [
|
||||
"serde",
|
||||
"bitflags/serde",
|
||||
"indexmap/serde",
|
||||
"indexmap/serde-1",
|
||||
]
|
||||
span = [
|
||||
"codespan-reporting",
|
||||
|
2
third_party/rust/naga/README.md
vendored
2
third_party/rust/naga/README.md
vendored
@ -4,7 +4,7 @@
|
||||
[![Crates.io](https://img.shields.io/crates/v/naga.svg?label=naga)](https://crates.io/crates/naga)
|
||||
[![Docs.rs](https://docs.rs/naga/badge.svg)](https://docs.rs/naga)
|
||||
[![Build Status](https://github.com/gfx-rs/naga/workflows/pipeline/badge.svg)](https://github.com/gfx-rs/naga/actions)
|
||||
![MSRV](https://img.shields.io/badge/rustc-1.65+-blue.svg)
|
||||
![MSRV](https://img.shields.io/badge/rustc-1.63+-blue.svg)
|
||||
[![codecov.io](https://codecov.io/gh/gfx-rs/naga/branch/master/graph/badge.svg?token=9VOKYO8BM2)](https://codecov.io/gh/gfx-rs/naga)
|
||||
|
||||
The shader translation library for the needs of [wgpu](https://github.com/gfx-rs/wgpu).
|
||||
|
420
third_party/rust/naga/src/back/glsl/keywords.rs
vendored
420
third_party/rust/naga/src/back/glsl/keywords.rs
vendored
@ -1,17 +1,10 @@
|
||||
pub const RESERVED_KEYWORDS: &[&str] = &[
|
||||
//
|
||||
// GLSL 4.6 keywords, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L2004-L2322
|
||||
// GLSL ES 3.2 keywords, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/es/3.2/GLSL_ES_Specification_3.20.html#L2166-L2478
|
||||
//
|
||||
// Note: The GLSL ES 3.2 keywords are the same as GLSL 4.6 keywords with some residing in the reserved section.
|
||||
// The only exception are the missing Vulkan keywords which I think is an oversight (see https://github.com/KhronosGroup/OpenGL-Registry/issues/585).
|
||||
//
|
||||
"attribute",
|
||||
"const",
|
||||
"uniform",
|
||||
"varying",
|
||||
"buffer",
|
||||
"shared",
|
||||
"attribute",
|
||||
"varying",
|
||||
"coherent",
|
||||
"volatile",
|
||||
"restrict",
|
||||
@ -25,8 +18,6 @@ pub const RESERVED_KEYWORDS: &[&str] = &[
|
||||
"noperspective",
|
||||
"patch",
|
||||
"sample",
|
||||
"invariant",
|
||||
"precise",
|
||||
"break",
|
||||
"continue",
|
||||
"do",
|
||||
@ -41,15 +32,41 @@ pub const RESERVED_KEYWORDS: &[&str] = &[
|
||||
"in",
|
||||
"out",
|
||||
"inout",
|
||||
"float",
|
||||
"double",
|
||||
"int",
|
||||
"void",
|
||||
"bool",
|
||||
"true",
|
||||
"false",
|
||||
"float",
|
||||
"double",
|
||||
"invariant",
|
||||
"precise",
|
||||
"discard",
|
||||
"return",
|
||||
"mat2",
|
||||
"mat3",
|
||||
"mat4",
|
||||
"dmat2",
|
||||
"dmat3",
|
||||
"dmat4",
|
||||
"mat2x2",
|
||||
"mat2x3",
|
||||
"mat2x4",
|
||||
"dmat2x2",
|
||||
"dmat2x3",
|
||||
"dmat2x4",
|
||||
"mat3x2",
|
||||
"mat3x3",
|
||||
"mat3x4",
|
||||
"dmat3x2",
|
||||
"dmat3x3",
|
||||
"dmat3x4",
|
||||
"mat4x2",
|
||||
"mat4x3",
|
||||
"mat4x4",
|
||||
"dmat4x2",
|
||||
"dmat4x3",
|
||||
"dmat4x4",
|
||||
"vec2",
|
||||
"vec3",
|
||||
"vec4",
|
||||
@ -59,158 +76,91 @@ pub const RESERVED_KEYWORDS: &[&str] = &[
|
||||
"bvec2",
|
||||
"bvec3",
|
||||
"bvec4",
|
||||
"dvec2",
|
||||
"dvec3",
|
||||
"dvec4",
|
||||
"uint",
|
||||
"uvec2",
|
||||
"uvec3",
|
||||
"uvec4",
|
||||
"dvec2",
|
||||
"dvec3",
|
||||
"dvec4",
|
||||
"mat2",
|
||||
"mat3",
|
||||
"mat4",
|
||||
"mat2x2",
|
||||
"mat2x3",
|
||||
"mat2x4",
|
||||
"mat3x2",
|
||||
"mat3x3",
|
||||
"mat3x4",
|
||||
"mat4x2",
|
||||
"mat4x3",
|
||||
"mat4x4",
|
||||
"dmat2",
|
||||
"dmat3",
|
||||
"dmat4",
|
||||
"dmat2x2",
|
||||
"dmat2x3",
|
||||
"dmat2x4",
|
||||
"dmat3x2",
|
||||
"dmat3x3",
|
||||
"dmat3x4",
|
||||
"dmat4x2",
|
||||
"dmat4x3",
|
||||
"dmat4x4",
|
||||
"lowp",
|
||||
"mediump",
|
||||
"highp",
|
||||
"precision",
|
||||
"sampler1D",
|
||||
"sampler1DShadow",
|
||||
"sampler1DArray",
|
||||
"sampler1DArrayShadow",
|
||||
"isampler1D",
|
||||
"isampler1DArray",
|
||||
"usampler1D",
|
||||
"usampler1DArray",
|
||||
"sampler2D",
|
||||
"sampler3D",
|
||||
"samplerCube",
|
||||
"sampler1DShadow",
|
||||
"sampler2DShadow",
|
||||
"samplerCubeShadow",
|
||||
"sampler1DArray",
|
||||
"sampler2DArray",
|
||||
"sampler1DArrayShadow",
|
||||
"sampler2DArrayShadow",
|
||||
"isampler1D",
|
||||
"isampler2D",
|
||||
"isampler3D",
|
||||
"isamplerCube",
|
||||
"isampler1DArray",
|
||||
"isampler2DArray",
|
||||
"usampler1D",
|
||||
"usampler2D",
|
||||
"usampler3D",
|
||||
"usamplerCube",
|
||||
"usampler1DArray",
|
||||
"usampler2DArray",
|
||||
"sampler2DRect",
|
||||
"sampler2DRectShadow",
|
||||
"isampler2DRect",
|
||||
"isampler2D",
|
||||
"Rect",
|
||||
"usampler2DRect",
|
||||
"samplerBuffer",
|
||||
"isamplerBuffer",
|
||||
"usamplerBuffer",
|
||||
"sampler2DMS",
|
||||
"isampler2DMS",
|
||||
"usampler2DMS",
|
||||
"sampler2DMSArray",
|
||||
"isampler2DMSArray",
|
||||
"usampler2DMSArray",
|
||||
"sampler3D",
|
||||
"isampler3D",
|
||||
"usampler3D",
|
||||
"samplerCube",
|
||||
"samplerCubeShadow",
|
||||
"isamplerCube",
|
||||
"usamplerCube",
|
||||
"samplerCubeArray",
|
||||
"samplerCubeArrayShadow",
|
||||
"isamplerCubeArray",
|
||||
"usamplerCubeArray",
|
||||
"samplerBuffer",
|
||||
"isamplerBuffer",
|
||||
"usamplerBuffer",
|
||||
"image1D",
|
||||
"iimage1D",
|
||||
"uimage1D",
|
||||
"image1DArray",
|
||||
"iimage1DArray",
|
||||
"uimage1DArray",
|
||||
"image2D",
|
||||
"iimage2D",
|
||||
"uimage2D",
|
||||
"image2DArray",
|
||||
"iimage2DArray",
|
||||
"uimage2DArray",
|
||||
"image3D",
|
||||
"iimage3D",
|
||||
"uimage3D",
|
||||
"image2DRect",
|
||||
"iimage2DRect",
|
||||
"uimage2DRect",
|
||||
"imageCube",
|
||||
"iimageCube",
|
||||
"uimageCube",
|
||||
"imageBuffer",
|
||||
"iimageBuffer",
|
||||
"uimageBuffer",
|
||||
"image1DArray",
|
||||
"iimage1DArray",
|
||||
"uimage1DArray",
|
||||
"image2DArray",
|
||||
"iimage2DArray",
|
||||
"uimage2DArray",
|
||||
"imageCubeArray",
|
||||
"iimageCubeArray",
|
||||
"uimageCubeArray",
|
||||
"image2DMS",
|
||||
"iimage2DMS",
|
||||
"uimage2DMS",
|
||||
"image2DMSArray",
|
||||
"iimage2DMSArray",
|
||||
"uimage2DMSArray",
|
||||
"image3D",
|
||||
"iimage3D",
|
||||
"uimage3D",
|
||||
"imageCube",
|
||||
"iimageCube",
|
||||
"uimageCube",
|
||||
"imageCubeArray",
|
||||
"iimageCubeArray",
|
||||
"uimageCubeArray",
|
||||
"imageBuffer",
|
||||
"iimageBuffer",
|
||||
"uimageBuffer",
|
||||
"struct",
|
||||
// Vulkan keywords
|
||||
"texture1D",
|
||||
"texture1DArray",
|
||||
"itexture1D",
|
||||
"itexture1DArray",
|
||||
"utexture1D",
|
||||
"utexture1DArray",
|
||||
"texture2D",
|
||||
"texture2DArray",
|
||||
"itexture2D",
|
||||
"itexture2DArray",
|
||||
"utexture2D",
|
||||
"utexture2DArray",
|
||||
"texture2DRect",
|
||||
"itexture2DRect",
|
||||
"utexture2DRect",
|
||||
"texture2DMS",
|
||||
"itexture2DMS",
|
||||
"utexture2DMS",
|
||||
"texture2DMSArray",
|
||||
"itexture2DMSArray",
|
||||
"utexture2DMSArray",
|
||||
"texture3D",
|
||||
"itexture3D",
|
||||
"utexture3D",
|
||||
"textureCube",
|
||||
"itextureCube",
|
||||
"utextureCube",
|
||||
"textureCubeArray",
|
||||
"itextureCubeArray",
|
||||
"utextureCubeArray",
|
||||
"textureBuffer",
|
||||
"itextureBuffer",
|
||||
"utextureBuffer",
|
||||
"sampler",
|
||||
"samplerShadow",
|
||||
"subpassInput",
|
||||
"isubpassInput",
|
||||
"usubpassInput",
|
||||
"subpassInputMS",
|
||||
"isubpassInputMS",
|
||||
"usubpassInputMS",
|
||||
// Reserved keywords
|
||||
"uimage2DMSArraystruct",
|
||||
"common",
|
||||
"partition",
|
||||
"active",
|
||||
@ -244,237 +194,11 @@ pub const RESERVED_KEYWORDS: &[&str] = &[
|
||||
"fvec2",
|
||||
"fvec3",
|
||||
"fvec4",
|
||||
"sampler3DRect",
|
||||
"filter",
|
||||
"sizeof",
|
||||
"cast",
|
||||
"namespace",
|
||||
"using",
|
||||
"sampler3DRect",
|
||||
//
|
||||
// GLSL 4.6 Built-In Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L13314
|
||||
//
|
||||
// Angle and Trigonometry Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L13469-L13561C5
|
||||
"radians",
|
||||
"degrees",
|
||||
"sin",
|
||||
"cos",
|
||||
"tan",
|
||||
"asin",
|
||||
"acos",
|
||||
"atan",
|
||||
"sinh",
|
||||
"cosh",
|
||||
"tanh",
|
||||
"asinh",
|
||||
"acosh",
|
||||
"atanh",
|
||||
// Exponential Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L13569-L13620
|
||||
"pow",
|
||||
"exp",
|
||||
"log",
|
||||
"exp2",
|
||||
"log2",
|
||||
"sqrt",
|
||||
"inversesqrt",
|
||||
// Common Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L13628-L13908
|
||||
"abs",
|
||||
"sign",
|
||||
"floor",
|
||||
"trunc",
|
||||
"round",
|
||||
"roundEven",
|
||||
"ceil",
|
||||
"fract",
|
||||
"mod",
|
||||
"modf",
|
||||
"min",
|
||||
"max",
|
||||
"clamp",
|
||||
"mix",
|
||||
"step",
|
||||
"smoothstep",
|
||||
"isnan",
|
||||
"isinf",
|
||||
"floatBitsToInt",
|
||||
"floatBitsToUint",
|
||||
"intBitsToFloat",
|
||||
"uintBitsToFloat",
|
||||
"fma",
|
||||
"frexp",
|
||||
"ldexp",
|
||||
// Floating-Point Pack and Unpack Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L13916-L14007
|
||||
"packUnorm2x16",
|
||||
"packSnorm2x16",
|
||||
"packUnorm4x8",
|
||||
"packSnorm4x8",
|
||||
"unpackUnorm2x16",
|
||||
"unpackSnorm2x16",
|
||||
"unpackUnorm4x8",
|
||||
"unpackSnorm4x8",
|
||||
"packHalf2x16",
|
||||
"unpackHalf2x16",
|
||||
"packDouble2x32",
|
||||
"unpackDouble2x32",
|
||||
// Geometric Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L14014-L14121
|
||||
"length",
|
||||
"distance",
|
||||
"dot",
|
||||
"cross",
|
||||
"normalize",
|
||||
"ftransform",
|
||||
"faceforward",
|
||||
"reflect",
|
||||
"refract",
|
||||
// Matrix Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L14151-L14215
|
||||
"matrixCompMult",
|
||||
"outerProduct",
|
||||
"transpose",
|
||||
"determinant",
|
||||
"inverse",
|
||||
// Vector Relational Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L14259-L14322
|
||||
"lessThan",
|
||||
"lessThanEqual",
|
||||
"greaterThan",
|
||||
"greaterThanEqual",
|
||||
"equal",
|
||||
"notEqual",
|
||||
"any",
|
||||
"all",
|
||||
"not",
|
||||
// Integer Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L14335-L14432
|
||||
"uaddCarry",
|
||||
"usubBorrow",
|
||||
"umulExtended",
|
||||
"imulExtended",
|
||||
"bitfieldExtract",
|
||||
"bitfieldInsert",
|
||||
"bitfieldReverse",
|
||||
"bitCount",
|
||||
"findLSB",
|
||||
"findMSB",
|
||||
// Texture Query Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L14645-L14732
|
||||
"textureSize",
|
||||
"textureQueryLod",
|
||||
"textureQueryLevels",
|
||||
"textureSamples",
|
||||
// Texel Lookup Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L14736-L14997
|
||||
"texture",
|
||||
"textureProj",
|
||||
"textureLod",
|
||||
"textureOffset",
|
||||
"texelFetch",
|
||||
"texelFetchOffset",
|
||||
"textureProjOffset",
|
||||
"textureLodOffset",
|
||||
"textureProjLod",
|
||||
"textureProjLodOffset",
|
||||
"textureGrad",
|
||||
"textureGradOffset",
|
||||
"textureProjGrad",
|
||||
"textureProjGradOffset",
|
||||
// Texture Gather Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L15077-L15154
|
||||
"textureGather",
|
||||
"textureGatherOffset",
|
||||
"textureGatherOffsets",
|
||||
// Compatibility Profile Texture Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L15161-L15220
|
||||
"texture1D",
|
||||
"texture1DProj",
|
||||
"texture1DLod",
|
||||
"texture1DProjLod",
|
||||
"texture2D",
|
||||
"texture2DProj",
|
||||
"texture2DLod",
|
||||
"texture2DProjLod",
|
||||
"texture3D",
|
||||
"texture3DProj",
|
||||
"texture3DLod",
|
||||
"texture3DProjLod",
|
||||
"textureCube",
|
||||
"textureCubeLod",
|
||||
"shadow1D",
|
||||
"shadow2D",
|
||||
"shadow1DProj",
|
||||
"shadow2DProj",
|
||||
"shadow1DLod",
|
||||
"shadow2DLod",
|
||||
"shadow1DProjLod",
|
||||
"shadow2DProjLod",
|
||||
// Atomic Counter Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L15241-L15531
|
||||
"atomicCounterIncrement",
|
||||
"atomicCounterDecrement",
|
||||
"atomicCounter",
|
||||
"atomicCounterAdd",
|
||||
"atomicCounterSubtract",
|
||||
"atomicCounterMin",
|
||||
"atomicCounterMax",
|
||||
"atomicCounterAnd",
|
||||
"atomicCounterOr",
|
||||
"atomicCounterXor",
|
||||
"atomicCounterExchange",
|
||||
"atomicCounterCompSwap",
|
||||
// Atomic Memory Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L15563-L15624
|
||||
"atomicAdd",
|
||||
"atomicMin",
|
||||
"atomicMax",
|
||||
"atomicAnd",
|
||||
"atomicOr",
|
||||
"atomicXor",
|
||||
"atomicExchange",
|
||||
"atomicCompSwap",
|
||||
// Image Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L15763-L15878
|
||||
"imageSize",
|
||||
"imageSamples",
|
||||
"imageLoad",
|
||||
"imageStore",
|
||||
"imageAtomicAdd",
|
||||
"imageAtomicMin",
|
||||
"imageAtomicMax",
|
||||
"imageAtomicAnd",
|
||||
"imageAtomicOr",
|
||||
"imageAtomicXor",
|
||||
"imageAtomicExchange",
|
||||
"imageAtomicCompSwap",
|
||||
// Geometry Shader Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L15886-L15932
|
||||
"EmitStreamVertex",
|
||||
"EndStreamPrimitive",
|
||||
"EmitVertex",
|
||||
"EndPrimitive",
|
||||
// Fragment Processing Functions, Derivative Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16041-L16114
|
||||
"dFdx",
|
||||
"dFdy",
|
||||
"dFdxFine",
|
||||
"dFdyFine",
|
||||
"dFdxCoarse",
|
||||
"dFdyCoarse",
|
||||
"fwidth",
|
||||
"fwidthFine",
|
||||
"fwidthCoarse",
|
||||
// Fragment Processing Functions, Interpolation Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16150-L16198
|
||||
"interpolateAtCentroid",
|
||||
"interpolateAtSample",
|
||||
"interpolateAtOffset",
|
||||
// Noise Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16214-L16243
|
||||
"noise1",
|
||||
"noise2",
|
||||
"noise3",
|
||||
"noise4",
|
||||
// Shader Invocation Control Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16255-L16276
|
||||
"barrier",
|
||||
// Shader Memory Control Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16336-L16382
|
||||
"memoryBarrier",
|
||||
"memoryBarrierAtomicCounter",
|
||||
"memoryBarrierBuffer",
|
||||
"memoryBarrierShared",
|
||||
"memoryBarrierImage",
|
||||
"groupMemoryBarrier",
|
||||
// Subpass-Input Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16451-L16470
|
||||
"subpassLoad",
|
||||
// Shader Invocation Group Functions, from https://github.com/KhronosGroup/OpenGL-Registry/blob/d00e11dc1a1ffba581d633f21f70202051248d5c/specs/gl/GLSLangSpec.4.60.html#L16483-L16511
|
||||
"anyInvocation",
|
||||
"allInvocations",
|
||||
"allInvocationsEqual",
|
||||
//
|
||||
// entry point name (should not be shadowed)
|
||||
//
|
||||
"main",
|
||||
];
|
||||
|
43
third_party/rust/naga/src/back/spv/block.rs
vendored
43
third_party/rust/naga/src/back/spv/block.rs
vendored
@ -242,7 +242,7 @@ impl<'w> BlockContext<'w> {
|
||||
let init = self.ir_module.constants[handle].init;
|
||||
self.writer.constant_ids[init.index()]
|
||||
}
|
||||
crate::Expression::ZeroValue(_) => self.writer.get_constant_null(result_type_id),
|
||||
crate::Expression::ZeroValue(_) => self.writer.write_constant_null(result_type_id),
|
||||
crate::Expression::Compose {
|
||||
ty: _,
|
||||
ref components,
|
||||
@ -271,7 +271,6 @@ impl<'w> BlockContext<'w> {
|
||||
crate::TypeInner::Vector { .. } => {
|
||||
self.write_vector_access(expr_handle, base, index, block)?
|
||||
}
|
||||
// Only binding arrays in the Handle address space will take this path (due to `is_intermediate`)
|
||||
crate::TypeInner::BindingArray {
|
||||
base: binding_type, ..
|
||||
} => {
|
||||
@ -309,14 +308,6 @@ impl<'w> BlockContext<'w> {
|
||||
None,
|
||||
));
|
||||
|
||||
// Subsequent image operations require the image/sampler to be decorated as NonUniform
|
||||
// if the image/sampler binding array was accessed with a non-uniform index
|
||||
// see VUID-RuntimeSpirv-NonUniform-06274
|
||||
if self.fun_info[index].uniformity.non_uniform_result.is_some() {
|
||||
self.writer
|
||||
.decorate_non_uniform_binding_array_access(load_id)?;
|
||||
}
|
||||
|
||||
load_id
|
||||
}
|
||||
ref other => {
|
||||
@ -356,7 +347,6 @@ impl<'w> BlockContext<'w> {
|
||||
));
|
||||
id
|
||||
}
|
||||
// Only binding arrays in the Handle address space will take this path (due to `is_intermediate`)
|
||||
crate::TypeInner::BindingArray {
|
||||
base: binding_type, ..
|
||||
} => {
|
||||
@ -1436,8 +1426,8 @@ impl<'w> BlockContext<'w> {
|
||||
) -> Result<ExpressionPointer, Error> {
|
||||
let result_lookup_ty = match self.fun_info[expr_handle].ty {
|
||||
TypeResolution::Handle(ty_handle) => match return_type_override {
|
||||
// We use the return type override as a special case for handle binding arrays as the OpAccessChain
|
||||
// needs to return a pointer, but indexing into a handle binding array just gives you the type of
|
||||
// We use the return type override as a special case for binding arrays as the OpAccessChain
|
||||
// needs to return a pointer, but indexing into a binding array just gives you the type of
|
||||
// the binding in the IR.
|
||||
Some(ty) => ty,
|
||||
None => LookupType::Handle(ty_handle),
|
||||
@ -1464,20 +1454,12 @@ impl<'w> BlockContext<'w> {
|
||||
if let crate::Expression::GlobalVariable(var_handle) =
|
||||
self.ir_function.expressions[base]
|
||||
{
|
||||
let gvar: &crate::GlobalVariable =
|
||||
&self.ir_module.global_variables[var_handle];
|
||||
match gvar.space {
|
||||
crate::AddressSpace::Storage { .. } | crate::AddressSpace::Uniform => {
|
||||
if let crate::TypeInner::BindingArray { .. } =
|
||||
self.ir_module.types[gvar.ty].inner
|
||||
{
|
||||
is_non_uniform_binding_array = self.fun_info[index]
|
||||
.uniformity
|
||||
.non_uniform_result
|
||||
.is_some();
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
let gvar = &self.ir_module.global_variables[var_handle];
|
||||
if let crate::TypeInner::BindingArray { .. } =
|
||||
self.ir_module.types[gvar.ty].inner
|
||||
{
|
||||
is_non_uniform_binding_array |=
|
||||
self.fun_info[index].uniformity.non_uniform_result.is_some();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1561,9 +1543,6 @@ impl<'w> BlockContext<'w> {
|
||||
};
|
||||
(pointer_id, expr_pointer)
|
||||
};
|
||||
// Subsequent load, store and atomic operations require the pointer to be decorated as NonUniform
|
||||
// if the buffer binding array was accessed with a non-uniform index
|
||||
// see VUID-RuntimeSpirv-NonUniform-06274
|
||||
if is_non_uniform_binding_array {
|
||||
self.writer
|
||||
.decorate_non_uniform_binding_array_access(pointer_id)?;
|
||||
@ -1679,7 +1658,7 @@ impl<'w> BlockContext<'w> {
|
||||
size: u32,
|
||||
block: &mut Block,
|
||||
) {
|
||||
let mut partial_sum = self.writer.get_constant_null(result_type_id);
|
||||
let mut partial_sum = self.writer.write_constant_null(result_type_id);
|
||||
let last_component = size - 1;
|
||||
for index in 0..=last_component {
|
||||
// compute the product of the current components
|
||||
@ -2336,7 +2315,7 @@ impl<'w> BlockContext<'w> {
|
||||
BlockExit::Return => match self.ir_function.result {
|
||||
Some(ref result) if self.function.entry_point_context.is_none() => {
|
||||
let type_id = self.get_type_id(LookupType::Handle(result.ty));
|
||||
let null_id = self.writer.get_constant_null(type_id);
|
||||
let null_id = self.writer.write_constant_null(type_id);
|
||||
Instruction::return_value(null_id)
|
||||
}
|
||||
_ => Instruction::return_void(),
|
||||
|
103
third_party/rust/naga/src/back/spv/image.rs
vendored
103
third_party/rust/naga/src/back/spv/image.rs
vendored
@ -189,7 +189,7 @@ impl Access for Load {
|
||||
}
|
||||
|
||||
fn out_of_bounds_value(&self, ctx: &mut BlockContext<'_>) -> Word {
|
||||
ctx.writer.get_constant_null(self.type_id)
|
||||
ctx.writer.write_constant_null(self.type_id)
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ impl<'w> BlockContext<'w> {
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn get_handle_id(&mut self, expr_handle: Handle<crate::Expression>) -> Word {
|
||||
pub(super) fn get_image_id(&mut self, expr_handle: Handle<crate::Expression>) -> Word {
|
||||
let id = match self.ir_function.expressions[expr_handle] {
|
||||
crate::Expression::GlobalVariable(handle) => {
|
||||
self.writer.global_variables[handle.index()].handle_id
|
||||
@ -745,7 +745,7 @@ impl<'w> BlockContext<'w> {
|
||||
sample: Option<Handle<crate::Expression>>,
|
||||
block: &mut Block,
|
||||
) -> Result<Word, Error> {
|
||||
let image_id = self.get_handle_id(image);
|
||||
let image_id = self.get_image_id(image);
|
||||
let image_type = self.fun_info[image].ty.inner_with(&self.ir_module.types);
|
||||
let image_class = match *image_type {
|
||||
crate::TypeInner::Image { class, .. } => class,
|
||||
@ -830,7 +830,7 @@ impl<'w> BlockContext<'w> {
|
||||
) -> Result<Word, Error> {
|
||||
use super::instructions::SampleLod;
|
||||
// image
|
||||
let image_id = self.get_handle_id(image);
|
||||
let image_id = self.get_image_id(image);
|
||||
let image_type = self.fun_info[image].ty.handle().unwrap();
|
||||
// SPIR-V doesn't know about our `Depth` class, and it returns
|
||||
// `vec4<f32>`, so we need to grab the first component out of it.
|
||||
@ -857,7 +857,7 @@ impl<'w> BlockContext<'w> {
|
||||
let sampled_image_type_id =
|
||||
self.get_type_id(LookupType::Local(LocalType::SampledImage { image_type_id }));
|
||||
|
||||
let sampler_id = self.get_handle_id(sampler);
|
||||
let sampler_id = self.get_image_id(sampler);
|
||||
let coordinates_id = self
|
||||
.write_image_coordinates(coordinate, array_index, block)?
|
||||
.value_id;
|
||||
@ -1013,7 +1013,7 @@ impl<'w> BlockContext<'w> {
|
||||
) -> Result<Word, Error> {
|
||||
use crate::{ImageClass as Ic, ImageDimension as Id, ImageQuery as Iq};
|
||||
|
||||
let image_id = self.get_handle_id(image);
|
||||
let image_id = self.get_image_id(image);
|
||||
let image_type = self.fun_info[image].ty.handle().unwrap();
|
||||
let (dim, arrayed, class) = match self.ir_module.types[image_type].inner {
|
||||
crate::TypeInner::Image {
|
||||
@ -1045,7 +1045,7 @@ impl<'w> BlockContext<'w> {
|
||||
};
|
||||
let extended_size_type_id = self.get_type_id(LookupType::Local(LocalType::Value {
|
||||
vector_size,
|
||||
kind: crate::ScalarKind::Uint,
|
||||
kind: crate::ScalarKind::Sint,
|
||||
width: 4,
|
||||
pointer_space: None,
|
||||
}));
|
||||
@ -1077,7 +1077,24 @@ impl<'w> BlockContext<'w> {
|
||||
}
|
||||
block.body.push(inst);
|
||||
|
||||
if result_type_id != extended_size_type_id {
|
||||
let bitcast_type_id = self.get_type_id(
|
||||
LocalType::Value {
|
||||
vector_size,
|
||||
kind: crate::ScalarKind::Uint,
|
||||
width: 4,
|
||||
pointer_space: None,
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
let bitcast_id = self.gen_id();
|
||||
block.body.push(Instruction::unary(
|
||||
spirv::Op::Bitcast,
|
||||
bitcast_type_id,
|
||||
bitcast_id,
|
||||
id_extended,
|
||||
));
|
||||
|
||||
if result_type_id != bitcast_type_id {
|
||||
let id = self.gen_id();
|
||||
let components = match dim {
|
||||
// always pick the first component, and duplicate it for all 3 dimensions
|
||||
@ -1087,26 +1104,42 @@ impl<'w> BlockContext<'w> {
|
||||
block.body.push(Instruction::vector_shuffle(
|
||||
result_type_id,
|
||||
id,
|
||||
id_extended,
|
||||
id_extended,
|
||||
bitcast_id,
|
||||
bitcast_id,
|
||||
components,
|
||||
));
|
||||
|
||||
id
|
||||
} else {
|
||||
id_extended
|
||||
bitcast_id
|
||||
}
|
||||
}
|
||||
Iq::NumLevels => {
|
||||
let query_id = self.gen_id();
|
||||
block.body.push(Instruction::image_query(
|
||||
spirv::Op::ImageQueryLevels,
|
||||
result_type_id,
|
||||
self.get_type_id(
|
||||
LocalType::Value {
|
||||
vector_size: None,
|
||||
kind: crate::ScalarKind::Sint,
|
||||
width: 4,
|
||||
pointer_space: None,
|
||||
}
|
||||
.into(),
|
||||
),
|
||||
query_id,
|
||||
image_id,
|
||||
));
|
||||
|
||||
query_id
|
||||
let id = self.gen_id();
|
||||
block.body.push(Instruction::unary(
|
||||
spirv::Op::Bitcast,
|
||||
result_type_id,
|
||||
id,
|
||||
query_id,
|
||||
));
|
||||
|
||||
id
|
||||
}
|
||||
Iq::NumLayers => {
|
||||
let vec_size = match dim {
|
||||
@ -1116,7 +1149,7 @@ impl<'w> BlockContext<'w> {
|
||||
};
|
||||
let extended_size_type_id = self.get_type_id(LookupType::Local(LocalType::Value {
|
||||
vector_size: Some(vec_size),
|
||||
kind: crate::ScalarKind::Uint,
|
||||
kind: crate::ScalarKind::Sint,
|
||||
width: 4,
|
||||
pointer_space: None,
|
||||
}));
|
||||
@ -1132,24 +1165,56 @@ impl<'w> BlockContext<'w> {
|
||||
|
||||
let extract_id = self.gen_id();
|
||||
block.body.push(Instruction::composite_extract(
|
||||
result_type_id,
|
||||
self.get_type_id(
|
||||
LocalType::Value {
|
||||
vector_size: None,
|
||||
kind: crate::ScalarKind::Sint,
|
||||
width: 4,
|
||||
pointer_space: None,
|
||||
}
|
||||
.into(),
|
||||
),
|
||||
extract_id,
|
||||
id_extended,
|
||||
&[vec_size as u32 - 1],
|
||||
));
|
||||
|
||||
extract_id
|
||||
let id = self.gen_id();
|
||||
block.body.push(Instruction::unary(
|
||||
spirv::Op::Bitcast,
|
||||
result_type_id,
|
||||
id,
|
||||
extract_id,
|
||||
));
|
||||
|
||||
id
|
||||
}
|
||||
Iq::NumSamples => {
|
||||
let query_id = self.gen_id();
|
||||
block.body.push(Instruction::image_query(
|
||||
spirv::Op::ImageQuerySamples,
|
||||
result_type_id,
|
||||
self.get_type_id(
|
||||
LocalType::Value {
|
||||
vector_size: None,
|
||||
kind: crate::ScalarKind::Sint,
|
||||
width: 4,
|
||||
pointer_space: None,
|
||||
}
|
||||
.into(),
|
||||
),
|
||||
query_id,
|
||||
image_id,
|
||||
));
|
||||
|
||||
query_id
|
||||
let id = self.gen_id();
|
||||
block.body.push(Instruction::unary(
|
||||
spirv::Op::Bitcast,
|
||||
result_type_id,
|
||||
id,
|
||||
query_id,
|
||||
));
|
||||
|
||||
id
|
||||
}
|
||||
};
|
||||
|
||||
@ -1164,7 +1229,7 @@ impl<'w> BlockContext<'w> {
|
||||
value: Handle<crate::Expression>,
|
||||
block: &mut Block,
|
||||
) -> Result<(), Error> {
|
||||
let image_id = self.get_handle_id(image);
|
||||
let image_id = self.get_image_id(image);
|
||||
let coordinates = self.write_image_coordinates(coordinate, array_index, block)?;
|
||||
let value_id = self.cached[value];
|
||||
|
||||
|
2
third_party/rust/naga/src/back/spv/index.rs
vendored
2
third_party/rust/naga/src/back/spv/index.rs
vendored
@ -304,7 +304,7 @@ impl<'w> BlockContext<'w> {
|
||||
F: FnOnce(&mut IdGenerator, &mut Block) -> Word,
|
||||
{
|
||||
// For the out-of-bounds case, we produce a zero value.
|
||||
let null_id = self.writer.get_constant_null(result_type);
|
||||
let null_id = self.writer.write_constant_null(result_type);
|
||||
|
||||
let mut selection = Selection::start(block, result_type);
|
||||
|
||||
|
1
third_party/rust/naga/src/back/spv/mod.rs
vendored
1
third_party/rust/naga/src/back/spv/mod.rs
vendored
@ -466,7 +466,6 @@ enum CachedConstant {
|
||||
ty: LookupType,
|
||||
constituent_ids: Vec<Word>,
|
||||
},
|
||||
ZeroValue(Word),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
2
third_party/rust/naga/src/back/spv/ray.rs
vendored
2
third_party/rust/naga/src/back/spv/ray.rs
vendored
@ -20,7 +20,7 @@ impl<'w> BlockContext<'w> {
|
||||
} => {
|
||||
//Note: composite extract indices and types must match `generate_ray_desc_type`
|
||||
let desc_id = self.cached[descriptor];
|
||||
let acc_struct_id = self.get_handle_id(acceleration_structure);
|
||||
let acc_struct_id = self.get_image_id(acceleration_structure);
|
||||
let width = 4;
|
||||
|
||||
let flag_type_id = self.get_type_id(LookupType::Local(LocalType::Value {
|
||||
|
20
third_party/rust/naga/src/back/spv/writer.rs
vendored
20
third_party/rust/naga/src/back/spv/writer.rs
vendored
@ -356,7 +356,7 @@ impl Writer {
|
||||
crate::TypeInner::RayQuery => None,
|
||||
_ => {
|
||||
let type_id = self.get_type_id(LookupType::Handle(variable.ty));
|
||||
Some(self.get_constant_null(type_id))
|
||||
Some(self.write_constant_null(type_id))
|
||||
}
|
||||
}),
|
||||
);
|
||||
@ -1206,16 +1206,6 @@ impl Writer {
|
||||
.to_words(&mut self.logical_layout.declarations);
|
||||
}
|
||||
|
||||
pub(super) fn get_constant_null(&mut self, type_id: Word) -> Word {
|
||||
let null = CachedConstant::ZeroValue(type_id);
|
||||
if let Some(&id) = self.cached_constants.get(&null) {
|
||||
return id;
|
||||
}
|
||||
let id = self.write_constant_null(type_id);
|
||||
self.cached_constants.insert(null, id);
|
||||
id
|
||||
}
|
||||
|
||||
pub(super) fn write_constant_null(&mut self, type_id: Word) -> Word {
|
||||
let null_id = self.id_gen.next();
|
||||
Instruction::constant_null(type_id, null_id)
|
||||
@ -1236,7 +1226,7 @@ impl Writer {
|
||||
}
|
||||
crate::Expression::ZeroValue(ty) => {
|
||||
let type_id = self.get_type_id(LookupType::Handle(ty));
|
||||
self.get_constant_null(type_id)
|
||||
self.write_constant_null(type_id)
|
||||
}
|
||||
crate::Expression::Compose { ty, ref components } => {
|
||||
let component_ids: Vec<_> = components
|
||||
@ -1299,7 +1289,7 @@ impl Writer {
|
||||
// get wrapped, and we're initializing `WorkGroup` variables.
|
||||
let var_id = self.global_variables[handle.index()].var_id;
|
||||
let var_type_id = self.get_type_id(LookupType::Handle(var.ty));
|
||||
let init_word = self.get_constant_null(var_type_id);
|
||||
let init_word = self.write_constant_null(var_type_id);
|
||||
Instruction::store(var_id, init_word, None)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
@ -1337,7 +1327,7 @@ impl Writer {
|
||||
id
|
||||
};
|
||||
|
||||
let zero_id = self.get_constant_null(uint3_type_id);
|
||||
let zero_id = self.write_constant_null(uint3_type_id);
|
||||
let bool3_type_id = self.get_bool3_type_id();
|
||||
|
||||
let eq_id = self.id_gen.next();
|
||||
@ -1673,7 +1663,7 @@ impl Writer {
|
||||
let init_word = match (global_variable.space, self.zero_initialize_workgroup_memory) {
|
||||
(crate::AddressSpace::Private, _)
|
||||
| (crate::AddressSpace::WorkGroup, super::ZeroInitializeWorkgroupMemoryMode::Native) => {
|
||||
init_word.or_else(|| Some(self.get_constant_null(inner_type_id)))
|
||||
init_word.or_else(|| Some(self.write_constant_null(inner_type_id)))
|
||||
}
|
||||
_ => init_word,
|
||||
};
|
||||
|
42
third_party/rust/naga/src/front/spv/image.rs
vendored
42
third_party/rust/naga/src/front/spv/image.rs
vendored
@ -1,4 +1,4 @@
|
||||
use crate::arena::{Handle, UniqueArena};
|
||||
use crate::arena::{Arena, Handle, UniqueArena};
|
||||
|
||||
use super::{Error, LookupExpression, LookupHelper as _};
|
||||
|
||||
@ -689,20 +689,11 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
|
||||
image: image_lexp.handle,
|
||||
query: crate::ImageQuery::Size { level },
|
||||
};
|
||||
|
||||
let result_type_handle = self.lookup_type.lookup(result_type_id)?.handle;
|
||||
let maybe_scalar_kind = ctx.type_arena[result_type_handle].inner.scalar_kind();
|
||||
|
||||
let expr = if maybe_scalar_kind == Some(crate::ScalarKind::Sint) {
|
||||
crate::Expression::As {
|
||||
expr: ctx.expressions.append(expr, self.span_from_with_op(start)),
|
||||
kind: crate::ScalarKind::Sint,
|
||||
convert: Some(4),
|
||||
}
|
||||
} else {
|
||||
expr
|
||||
let expr = crate::Expression::As {
|
||||
expr: ctx.expressions.append(expr, self.span_from_with_op(start)),
|
||||
kind: crate::ScalarKind::Sint,
|
||||
convert: Some(4),
|
||||
};
|
||||
|
||||
self.lookup_expression.insert(
|
||||
result_id,
|
||||
LookupExpression {
|
||||
@ -711,14 +702,13 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
|
||||
block_id,
|
||||
},
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn parse_image_query_other(
|
||||
&mut self,
|
||||
query: crate::ImageQuery,
|
||||
ctx: &mut super::BlockContext,
|
||||
expressions: &mut Arena<crate::Expression>,
|
||||
block_id: spirv::Word,
|
||||
) -> Result<(), Error> {
|
||||
let start = self.data_offset;
|
||||
@ -734,29 +724,19 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
|
||||
image: image_lexp.handle,
|
||||
query,
|
||||
};
|
||||
|
||||
let result_type_handle = self.lookup_type.lookup(result_type_id)?.handle;
|
||||
let maybe_scalar_kind = ctx.type_arena[result_type_handle].inner.scalar_kind();
|
||||
|
||||
let expr = if maybe_scalar_kind == Some(crate::ScalarKind::Sint) {
|
||||
crate::Expression::As {
|
||||
expr: ctx.expressions.append(expr, self.span_from_with_op(start)),
|
||||
kind: crate::ScalarKind::Sint,
|
||||
convert: Some(4),
|
||||
}
|
||||
} else {
|
||||
expr
|
||||
let expr = crate::Expression::As {
|
||||
expr: expressions.append(expr, self.span_from_with_op(start)),
|
||||
kind: crate::ScalarKind::Sint,
|
||||
convert: Some(4),
|
||||
};
|
||||
|
||||
self.lookup_expression.insert(
|
||||
result_id,
|
||||
LookupExpression {
|
||||
handle: ctx.expressions.append(expr, self.span_from_with_op(start)),
|
||||
handle: expressions.append(expr, self.span_from_with_op(start)),
|
||||
type_id: result_type_id,
|
||||
block_id,
|
||||
},
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
12
third_party/rust/naga/src/front/spv/mod.rs
vendored
12
third_party/rust/naga/src/front/spv/mod.rs
vendored
@ -2695,11 +2695,19 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
|
||||
}
|
||||
Op::ImageQueryLevels => {
|
||||
inst.expect(4)?;
|
||||
self.parse_image_query_other(crate::ImageQuery::NumLevels, ctx, block_id)?;
|
||||
self.parse_image_query_other(
|
||||
crate::ImageQuery::NumLevels,
|
||||
ctx.expressions,
|
||||
block_id,
|
||||
)?;
|
||||
}
|
||||
Op::ImageQuerySamples => {
|
||||
inst.expect(4)?;
|
||||
self.parse_image_query_other(crate::ImageQuery::NumSamples, ctx, block_id)?;
|
||||
self.parse_image_query_other(
|
||||
crate::ImageQuery::NumSamples,
|
||||
ctx.expressions,
|
||||
block_id,
|
||||
)?;
|
||||
}
|
||||
// other ops
|
||||
Op::Select => {
|
||||
|
@ -168,7 +168,6 @@ pub enum Error<'a> {
|
||||
InvalidIdentifierUnderscore(Span),
|
||||
ReservedIdentifierPrefix(Span),
|
||||
UnknownAddressSpace(Span),
|
||||
RepeatedAttribute(Span),
|
||||
UnknownAttribute(Span),
|
||||
UnknownBuiltin(Span),
|
||||
UnknownAccess(Span),
|
||||
@ -431,11 +430,6 @@ impl<'a> Error<'a> {
|
||||
labels: vec![(bad_span, "unknown address space".into())],
|
||||
notes: vec![],
|
||||
},
|
||||
Error::RepeatedAttribute(bad_span) => ParseError {
|
||||
message: format!("repeated attribute: '{}'", &source[bad_span]),
|
||||
labels: vec![(bad_span, "repated attribute".into())],
|
||||
notes: vec![],
|
||||
},
|
||||
Error::UnknownAttribute(bad_span) => ParseError {
|
||||
message: format!("unknown attribute: '{}'", &source[bad_span]),
|
||||
labels: vec![(bad_span, "unknown attribute".into())],
|
||||
|
@ -1937,10 +1937,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
|
||||
|
||||
let (_, arrayed) = ctx.image_data(image, image_span)?;
|
||||
let array_index = arrayed
|
||||
.then(|| {
|
||||
args.min_args += 1;
|
||||
self.expression(args.next()?, ctx.reborrow())
|
||||
})
|
||||
.then(|| self.expression(args.next()?, ctx.reborrow()))
|
||||
.transpose()?;
|
||||
|
||||
let value = self.expression(args.next()?, ctx.reborrow())?;
|
||||
@ -1971,10 +1968,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
|
||||
|
||||
let (class, arrayed) = ctx.image_data(image, image_span)?;
|
||||
let array_index = arrayed
|
||||
.then(|| {
|
||||
args.min_args += 1;
|
||||
self.expression(args.next()?, ctx.reborrow())
|
||||
})
|
||||
.then(|| self.expression(args.next()?, ctx.reborrow()))
|
||||
.transpose()?;
|
||||
|
||||
let level = class
|
||||
|
109
third_party/rust/naga/src/front/wgsl/parse/mod.rs
vendored
109
third_party/rust/naga/src/front/wgsl/parse/mod.rs
vendored
@ -120,33 +120,13 @@ enum Rule {
|
||||
GeneralExpr,
|
||||
}
|
||||
|
||||
struct ParsedAttribute<T> {
|
||||
value: Option<T>,
|
||||
}
|
||||
|
||||
impl<T> Default for ParsedAttribute<T> {
|
||||
fn default() -> Self {
|
||||
Self { value: None }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ParsedAttribute<T> {
|
||||
fn set(&mut self, value: T, name_span: Span) -> Result<(), Error<'static>> {
|
||||
if self.value.is_some() {
|
||||
return Err(Error::RepeatedAttribute(name_span));
|
||||
}
|
||||
self.value = Some(value);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct BindingParser {
|
||||
location: ParsedAttribute<u32>,
|
||||
built_in: ParsedAttribute<crate::BuiltIn>,
|
||||
interpolation: ParsedAttribute<crate::Interpolation>,
|
||||
sampling: ParsedAttribute<crate::Sampling>,
|
||||
invariant: ParsedAttribute<bool>,
|
||||
location: Option<u32>,
|
||||
built_in: Option<crate::BuiltIn>,
|
||||
interpolation: Option<crate::Interpolation>,
|
||||
sampling: Option<crate::Sampling>,
|
||||
invariant: bool,
|
||||
}
|
||||
|
||||
impl BindingParser {
|
||||
@ -159,44 +139,38 @@ impl BindingParser {
|
||||
match name {
|
||||
"location" => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
self.location
|
||||
.set(Parser::non_negative_i32_literal(lexer)?, name_span)?;
|
||||
self.location = Some(Parser::non_negative_i32_literal(lexer)?);
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
}
|
||||
"builtin" => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
let (raw, span) = lexer.next_ident_with_span()?;
|
||||
self.built_in
|
||||
.set(conv::map_built_in(raw, span)?, name_span)?;
|
||||
self.built_in = Some(conv::map_built_in(raw, span)?);
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
}
|
||||
"interpolate" => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
let (raw, span) = lexer.next_ident_with_span()?;
|
||||
self.interpolation
|
||||
.set(conv::map_interpolation(raw, span)?, name_span)?;
|
||||
self.interpolation = Some(conv::map_interpolation(raw, span)?);
|
||||
if lexer.skip(Token::Separator(',')) {
|
||||
let (raw, span) = lexer.next_ident_with_span()?;
|
||||
self.sampling
|
||||
.set(conv::map_sampling(raw, span)?, name_span)?;
|
||||
self.sampling = Some(conv::map_sampling(raw, span)?);
|
||||
}
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
}
|
||||
"invariant" => {
|
||||
self.invariant.set(true, name_span)?;
|
||||
}
|
||||
"invariant" => self.invariant = true,
|
||||
_ => return Err(Error::UnknownAttribute(name_span)),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn finish<'a>(self, span: Span) -> Result<Option<crate::Binding>, Error<'a>> {
|
||||
const fn finish<'a>(self, span: Span) -> Result<Option<crate::Binding>, Error<'a>> {
|
||||
match (
|
||||
self.location.value,
|
||||
self.built_in.value,
|
||||
self.interpolation.value,
|
||||
self.sampling.value,
|
||||
self.invariant.value.unwrap_or_default(),
|
||||
self.location,
|
||||
self.built_in,
|
||||
self.interpolation,
|
||||
self.sampling,
|
||||
self.invariant,
|
||||
) {
|
||||
(None, None, None, None, false) => Ok(None),
|
||||
(Some(location), None, interpolation, sampling, false) => {
|
||||
@ -1016,22 +990,22 @@ impl Parser {
|
||||
ExpectedToken::Token(Token::Separator(',')),
|
||||
));
|
||||
}
|
||||
let (mut size, mut align) = (ParsedAttribute::default(), ParsedAttribute::default());
|
||||
let (mut size, mut align) = (None, None);
|
||||
self.push_rule_span(Rule::Attribute, lexer);
|
||||
let mut bind_parser = BindingParser::default();
|
||||
while lexer.skip(Token::Attribute) {
|
||||
match lexer.next_ident_with_span()? {
|
||||
("size", name_span) => {
|
||||
("size", _) => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
let (value, span) = lexer.capture_span(Self::non_negative_i32_literal)?;
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
size.set((value, span), name_span)?;
|
||||
size = Some((value, span));
|
||||
}
|
||||
("align", name_span) => {
|
||||
("align", _) => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
let (value, span) = lexer.capture_span(Self::non_negative_i32_literal)?;
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
align.set((value, span), name_span)?;
|
||||
align = Some((value, span));
|
||||
}
|
||||
(word, word_span) => bind_parser.parse(lexer, word, word_span)?,
|
||||
}
|
||||
@ -1049,8 +1023,8 @@ impl Parser {
|
||||
name,
|
||||
ty,
|
||||
binding,
|
||||
size: size.value,
|
||||
align: align.value,
|
||||
size,
|
||||
align,
|
||||
});
|
||||
}
|
||||
|
||||
@ -2157,33 +2131,32 @@ impl Parser {
|
||||
) -> Result<(), Error<'a>> {
|
||||
// read attributes
|
||||
let mut binding = None;
|
||||
let mut stage = ParsedAttribute::default();
|
||||
let mut stage = None;
|
||||
let mut workgroup_size = [0u32; 3];
|
||||
let mut early_depth_test = ParsedAttribute::default();
|
||||
let (mut bind_index, mut bind_group) =
|
||||
(ParsedAttribute::default(), ParsedAttribute::default());
|
||||
let mut early_depth_test = None;
|
||||
let (mut bind_index, mut bind_group) = (None, None);
|
||||
|
||||
self.push_rule_span(Rule::Attribute, lexer);
|
||||
while lexer.skip(Token::Attribute) {
|
||||
match lexer.next_ident_with_span()? {
|
||||
("binding", name_span) => {
|
||||
("binding", _) => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
bind_index.set(Self::non_negative_i32_literal(lexer)?, name_span)?;
|
||||
bind_index = Some(Self::non_negative_i32_literal(lexer)?);
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
}
|
||||
("group", name_span) => {
|
||||
("group", _) => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
bind_group.set(Self::non_negative_i32_literal(lexer)?, name_span)?;
|
||||
bind_group = Some(Self::non_negative_i32_literal(lexer)?);
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
}
|
||||
("vertex", name_span) => {
|
||||
stage.set(crate::ShaderStage::Vertex, name_span)?;
|
||||
("vertex", _) => {
|
||||
stage = Some(crate::ShaderStage::Vertex);
|
||||
}
|
||||
("fragment", name_span) => {
|
||||
stage.set(crate::ShaderStage::Fragment, name_span)?;
|
||||
("fragment", _) => {
|
||||
stage = Some(crate::ShaderStage::Fragment);
|
||||
}
|
||||
("compute", name_span) => {
|
||||
stage.set(crate::ShaderStage::Compute, name_span)?;
|
||||
("compute", _) => {
|
||||
stage = Some(crate::ShaderStage::Compute);
|
||||
}
|
||||
("workgroup_size", _) => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
@ -2202,7 +2175,7 @@ impl Parser {
|
||||
}
|
||||
}
|
||||
}
|
||||
("early_depth_test", name_span) => {
|
||||
("early_depth_test", _) => {
|
||||
let conservative = if lexer.skip(Token::Paren('(')) {
|
||||
let (ident, ident_span) = lexer.next_ident_with_span()?;
|
||||
let value = conv::map_conservative_depth(ident, ident_span)?;
|
||||
@ -2211,14 +2184,14 @@ impl Parser {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
early_depth_test.set(crate::EarlyDepthTest { conservative }, name_span)?;
|
||||
early_depth_test = Some(crate::EarlyDepthTest { conservative });
|
||||
}
|
||||
(_, word_span) => return Err(Error::UnknownAttribute(word_span)),
|
||||
}
|
||||
}
|
||||
|
||||
let attrib_span = self.pop_rule_span(lexer);
|
||||
match (bind_group.value, bind_index.value) {
|
||||
match (bind_group, bind_index) {
|
||||
(Some(group), Some(index)) => {
|
||||
binding = Some(crate::ResourceBinding {
|
||||
group,
|
||||
@ -2281,9 +2254,9 @@ impl Parser {
|
||||
(Token::Word("fn"), _) => {
|
||||
let function = self.function_decl(lexer, out, &mut dependencies)?;
|
||||
Some(ast::GlobalDeclKind::Fn(ast::Function {
|
||||
entry_point: stage.value.map(|stage| ast::EntryPoint {
|
||||
entry_point: stage.map(|stage| ast::EntryPoint {
|
||||
stage,
|
||||
early_depth_test: early_depth_test.value,
|
||||
early_depth_test,
|
||||
workgroup_size,
|
||||
}),
|
||||
..function
|
||||
|
67
third_party/rust/naga/src/front/wgsl/tests.rs
vendored
67
third_party/rust/naga/src/front/wgsl/tests.rs
vendored
@ -481,70 +481,3 @@ fn parse_alias() {
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_texture_load_store_expecting_four_args() {
|
||||
for (func, texture) in [
|
||||
(
|
||||
"textureStore",
|
||||
"texture_storage_2d_array<rg11b10float, write>",
|
||||
),
|
||||
("textureLoad", "texture_2d_array<i32>"),
|
||||
] {
|
||||
let error = parse_str(&format!(
|
||||
"
|
||||
@group(0) @binding(0) var tex_los_res: {texture};
|
||||
@compute
|
||||
@workgroup_size(1)
|
||||
fn main(@builtin(global_invocation_id) id: vec3<u32>) {{
|
||||
var color = vec4(1, 1, 1, 1);
|
||||
{func}(tex_los_res, id, color);
|
||||
}}
|
||||
"
|
||||
))
|
||||
.unwrap_err();
|
||||
assert_eq!(
|
||||
error.message(),
|
||||
"wrong number of arguments: expected 4, found 3"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_repeated_attributes() {
|
||||
use crate::{
|
||||
front::wgsl::{error::Error, Frontend},
|
||||
Span,
|
||||
};
|
||||
|
||||
let template_vs = "@vertex fn vs() -> __REPLACE__ vec4<f32> { return vec4<f32>(0.0); }";
|
||||
let template_struct = "struct A { __REPLACE__ data: vec3<f32> }";
|
||||
let template_resource = "__REPLACE__ var tex_los_res: texture_2d_array<i32>;";
|
||||
let template_stage = "__REPLACE__ fn vs() -> vec4<f32> { return vec4<f32>(0.0); }";
|
||||
for (attribute, template) in [
|
||||
("align(16)", template_struct),
|
||||
("binding(0)", template_resource),
|
||||
("builtin(position)", template_vs),
|
||||
("compute", template_stage),
|
||||
("fragment", template_stage),
|
||||
("group(0)", template_resource),
|
||||
("interpolate(flat)", template_vs),
|
||||
("invariant", template_vs),
|
||||
("location(0)", template_vs),
|
||||
("size(16)", template_struct),
|
||||
("vertex", template_stage),
|
||||
("early_depth_test(less_equal)", template_resource),
|
||||
] {
|
||||
let shader = template.replace("__REPLACE__", &format!("@{attribute} @{attribute}"));
|
||||
let name_length = attribute.rfind('(').unwrap_or(attribute.len()) as u32;
|
||||
let span_start = shader.rfind(attribute).unwrap() as u32;
|
||||
let span_end = span_start + name_length;
|
||||
let expected_span = Span::new(span_start, span_end);
|
||||
|
||||
let result = Frontend::new().inner(&shader);
|
||||
assert!(matches!(
|
||||
result.unwrap_err(),
|
||||
Error::RepeatedAttribute(span) if span == expected_span
|
||||
));
|
||||
}
|
||||
}
|
||||
|
3
third_party/rust/naga/src/lib.rs
vendored
3
third_party/rust/naga/src/lib.rs
vendored
@ -1263,7 +1263,8 @@ bitflags::bitflags! {
|
||||
/// An expression that can be evaluated to obtain a value.
|
||||
///
|
||||
/// This is a Single Static Assignment (SSA) scheme similar to SPIR-V.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||
|
14
third_party/rust/naga/src/valid/interface.rs
vendored
14
third_party/rust/naga/src/valid/interface.rs
vendored
@ -33,8 +33,6 @@ pub enum GlobalVariableError {
|
||||
),
|
||||
#[error("Initializer doesn't match the variable type")]
|
||||
InitializerType,
|
||||
#[error("Storage address space doesn't support write-only access")]
|
||||
StorageAddressSpaceWriteOnlyNotSupported,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, thiserror::Error)]
|
||||
@ -409,12 +407,7 @@ impl super::Validator {
|
||||
// A binding array is (mostly) supposed to behave the same as a
|
||||
// series of individually bound resources, so we can (mostly)
|
||||
// validate a `binding_array<T>` as if it were just a plain `T`.
|
||||
crate::TypeInner::BindingArray { base, .. } => match var.space {
|
||||
crate::AddressSpace::Storage { .. }
|
||||
| crate::AddressSpace::Uniform
|
||||
| crate::AddressSpace::Handle => base,
|
||||
_ => return Err(GlobalVariableError::InvalidUsage(var.space)),
|
||||
},
|
||||
crate::TypeInner::BindingArray { base, .. } => base,
|
||||
_ => var.ty,
|
||||
};
|
||||
let type_info = &self.types[inner_ty.index()];
|
||||
@ -423,7 +416,7 @@ impl super::Validator {
|
||||
crate::AddressSpace::Function => {
|
||||
return Err(GlobalVariableError::InvalidUsage(var.space))
|
||||
}
|
||||
crate::AddressSpace::Storage { access } => {
|
||||
crate::AddressSpace::Storage { .. } => {
|
||||
if let Err((ty_handle, disalignment)) = type_info.storage_layout {
|
||||
if self.flags.contains(super::ValidationFlags::STRUCT_LAYOUTS) {
|
||||
return Err(GlobalVariableError::Alignment(
|
||||
@ -433,9 +426,6 @@ impl super::Validator {
|
||||
));
|
||||
}
|
||||
}
|
||||
if access == crate::StorageAccess::STORE {
|
||||
return Err(GlobalVariableError::StorageAddressSpaceWriteOnlyNotSupported);
|
||||
}
|
||||
(TypeFlags::DATA | TypeFlags::HOST_SHAREABLE, true)
|
||||
}
|
||||
crate::AddressSpace::Uniform => {
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"dd1ecc9d26c0bac60aafeb9e404fd076025cc5f4a5bc405adfa08d2ca38608ac","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/binding_model.rs":"d92a2c21642d0bece4ce1a9877d08567a86af4991cfe0bf6ecaaaf8f8b9c8d74","src/command/bind.rs":"aa778a7a125496f31220e8aa06a7eee5c5bc524a29e77cc5a314a178a0813a80","src/command/bundle.rs":"b26eb6cb877a19d203e9d2b8ac3b10e81f6a94b8b68617eac97a3b861cbe102b","src/command/clear.rs":"418ac36738d782ab72e8700aabef802638cdef1c873f4b036aa8a4c521cb9caf","src/command/compute.rs":"8f0ce8f80ad19454c7a0fdaf7a7fbb6d84f2cb0e374346f740a4ebe01beee53d","src/command/draw.rs":"92facdd0e3fd553af590ecbc0de3491f212e237ea66494ff99f67dbf090d10df","src/command/memory_init.rs":"b50d3d20dbf659052f19da2e79469ba6435e06370f19d6ef45e1b1128d9900b7","src/command/mod.rs":"a63937a5b8a441b714329a5e1b0b4dd4b70ae2f39b52da633fd79edbe183edc6","src/command/query.rs":"d39e1b8cb6a054fd31333a916da5d79a6671a724212c90c490c13e55043a1685","src/command/render.rs":"55b7ccbac0bbcb53080901ba11aafb92bff0c53b604cc7f504c00ce3e8c297c7","src/command/transfer.rs":"c777c6e51afb459d2b5416e31071f24e4215c66f456fee3bd8f7395f9d1c5db1","src/conv.rs":"da95b36b7680ae74ebf810ad8f1decf01bd3eeaff44b3c5af1d4b3c3f0e2059a","src/device/global.rs":"a06a5b10cda63dd97f5cd59e2813fd189d2cf59fd4154950a878874d4221cc12","src/device/life.rs":"26ac37c2a54c6fb942e6d2fbdf4d6fa4e3e50f41e1dd003c750f7e20295cbae7","src/device/mod.rs":"dbb98ce046651fd70a26df2030913f7224557eceb5f84198daf433c266356c7c","src/device/queue.rs":"d2692b5c12d05dfaf325d437b5bffe069cfff43228ce40f25147cec2cda428ba","src/device/resource.rs":"cbb1bcd91c5e62a2a98288fa1cd9b5d8eb54cc78fa5ba042adaffe6b6770675a","src/device/trace.rs":"21408dfd2c99e3ce36a77d08ba86cf52f32bb376ed82690bbbf74937bfd42cbe","src/error.rs":"ca37282283985e2b7d184b2ab7ca6f53f726432d920f8d8477bfff6fab9b34e2","src/global.rs":"cf551de97c3eb5acd0c2710da09ebd92cc863ad0bb0f53c0fd4911bf8cd3ad97","src/hal_api.rs":"92a2f0cb80f192693530ed61048919bbad446742c2370bf0944c44b1c5df8362","src/hub.rs":"49f479c3ebed842a4bc8ab2fee00bc02dceb57790fbac8ba33e1bfed795fa675","src/id.rs":"f6245d024586c7fe63ded13b3cb926b940c191bbee56aedc655e8cef74bdd66b","src/identity.rs":"c2e008e652723f7896465bfdafd5a10141cf5866e8c481a8efcf0bdaa9619a6a","src/init_tracker/buffer.rs":"a0ebf54a1e6d269c7b4aa0ac7bb8b04fd2cea3221a1d058ff33cb683b2aea3e9","src/init_tracker/mod.rs":"0867f79f83555390d0982d1dc6dcf0d4340e10cb89aa633d3c3ecc45deb3c78c","src/init_tracker/texture.rs":"37b6584aaca11c407d91f77002dcbb48d8a4876e27edd1b71b7929ef966f901d","src/instance.rs":"1a44acecaba0031be7b2450846f56ec741bafb2e4e9f0fc606e13788e5600083","src/lib.rs":"27ff8dd787d41cf412e90d0c4674aa70db59e608f9eb3be485c0bd18e9f13369","src/pipeline.rs":"669219add15448fdf5fe8bc5e03fd6fd1ada2b45b07047fd8c0a9bbbcdecad8b","src/present.rs":"ebcbf2e3b35d13a8dad191126de5f5006233ba8a0fb186303eafe2aeb412dce3","src/registry.rs":"4098413de7f48e9ff15d0246793be47a0d54c95b4c8594baf9fafd222a90ba84","src/resource.rs":"a03329428f820b43810d82f990c72990a45a6bdf482d3ce4b096b0f99c6c6844","src/storage.rs":"bc70689ba299e9b4d9f4992c4d3f4dd36b1d8e71327595094981fdfd624f811a","src/track/buffer.rs":"dd6f632c6f31b15807148d705c516a8a1a8d72d02b137dd3b9d7c939447917cb","src/track/metadata.rs":"a80bd086ce825f7484ce6318a586c482d06fea0efc9c76bfa0124e480cc8b75e","src/track/mod.rs":"04cd09cf5f26262175e48cc3855b79fbd8988916c4367a55d39a4c95784d249b","src/track/range.rs":"5bbfed6e103b3234d9de8e42057022da6d628c2cc1db6bb51b88f87f2d8adf8b","src/track/stateless.rs":"1d786b5e9558672243ba7d913736561065ef2bd5c6105c935e982486d10841f0","src/track/texture.rs":"7d60dc81ba7f7e2c2819525b90e6e6c7760cb0920e36aeefe98e76cedd49d26e","src/validation.rs":"6be9229cc34ef293ae99cfa520c6ad22bab39b83a53880a4aca36c42c53d40c3"},"package":null}
|
||||
{"files":{"Cargo.toml":"fc7c48cea2d58e3baa0f569d89f2680e92c509e268c8f565cce461d759643569","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/binding_model.rs":"d92a2c21642d0bece4ce1a9877d08567a86af4991cfe0bf6ecaaaf8f8b9c8d74","src/command/bind.rs":"aa778a7a125496f31220e8aa06a7eee5c5bc524a29e77cc5a314a178a0813a80","src/command/bundle.rs":"b26eb6cb877a19d203e9d2b8ac3b10e81f6a94b8b68617eac97a3b861cbe102b","src/command/clear.rs":"418ac36738d782ab72e8700aabef802638cdef1c873f4b036aa8a4c521cb9caf","src/command/compute.rs":"8f0ce8f80ad19454c7a0fdaf7a7fbb6d84f2cb0e374346f740a4ebe01beee53d","src/command/draw.rs":"1cbdeff80fa57663262f92141c5752530e911bad23c5379667b406cb8b57c4f7","src/command/memory_init.rs":"b50d3d20dbf659052f19da2e79469ba6435e06370f19d6ef45e1b1128d9900b7","src/command/mod.rs":"a63937a5b8a441b714329a5e1b0b4dd4b70ae2f39b52da633fd79edbe183edc6","src/command/query.rs":"d39e1b8cb6a054fd31333a916da5d79a6671a724212c90c490c13e55043a1685","src/command/render.rs":"c40036b5d3220ec621903473085ef8b9e0eb9dc51751ddab914d4f67b4852229","src/command/transfer.rs":"c777c6e51afb459d2b5416e31071f24e4215c66f456fee3bd8f7395f9d1c5db1","src/conv.rs":"da95b36b7680ae74ebf810ad8f1decf01bd3eeaff44b3c5af1d4b3c3f0e2059a","src/device/global.rs":"a06a5b10cda63dd97f5cd59e2813fd189d2cf59fd4154950a878874d4221cc12","src/device/life.rs":"c935c15c4c7f929e378a5ea930d0d36b47616a49991c236aaa10d25ce5852d15","src/device/mod.rs":"c150878d8b80b727ba1904725dafd747d6459106196b1cc67d9428dae75b0163","src/device/queue.rs":"b1ef887b92574d2541ef6f572cd14067e2af3a514fa26d547f9c18e2cbd30b92","src/device/resource.rs":"cbb1bcd91c5e62a2a98288fa1cd9b5d8eb54cc78fa5ba042adaffe6b6770675a","src/device/trace.rs":"21408dfd2c99e3ce36a77d08ba86cf52f32bb376ed82690bbbf74937bfd42cbe","src/error.rs":"ca37282283985e2b7d184b2ab7ca6f53f726432d920f8d8477bfff6fab9b34e2","src/global.rs":"cf551de97c3eb5acd0c2710da09ebd92cc863ad0bb0f53c0fd4911bf8cd3ad97","src/hal_api.rs":"92a2f0cb80f192693530ed61048919bbad446742c2370bf0944c44b1c5df8362","src/hub.rs":"49f479c3ebed842a4bc8ab2fee00bc02dceb57790fbac8ba33e1bfed795fa675","src/id.rs":"f6245d024586c7fe63ded13b3cb926b940c191bbee56aedc655e8cef74bdd66b","src/identity.rs":"c2e008e652723f7896465bfdafd5a10141cf5866e8c481a8efcf0bdaa9619a6a","src/init_tracker/buffer.rs":"a0ebf54a1e6d269c7b4aa0ac7bb8b04fd2cea3221a1d058ff33cb683b2aea3e9","src/init_tracker/mod.rs":"0867f79f83555390d0982d1dc6dcf0d4340e10cb89aa633d3c3ecc45deb3c78c","src/init_tracker/texture.rs":"37b6584aaca11c407d91f77002dcbb48d8a4876e27edd1b71b7929ef966f901d","src/instance.rs":"1a44acecaba0031be7b2450846f56ec741bafb2e4e9f0fc606e13788e5600083","src/lib.rs":"27ff8dd787d41cf412e90d0c4674aa70db59e608f9eb3be485c0bd18e9f13369","src/pipeline.rs":"669219add15448fdf5fe8bc5e03fd6fd1ada2b45b07047fd8c0a9bbbcdecad8b","src/present.rs":"ebcbf2e3b35d13a8dad191126de5f5006233ba8a0fb186303eafe2aeb412dce3","src/registry.rs":"4098413de7f48e9ff15d0246793be47a0d54c95b4c8594baf9fafd222a90ba84","src/resource.rs":"a03329428f820b43810d82f990c72990a45a6bdf482d3ce4b096b0f99c6c6844","src/storage.rs":"bc70689ba299e9b4d9f4992c4d3f4dd36b1d8e71327595094981fdfd624f811a","src/track/buffer.rs":"dd6f632c6f31b15807148d705c516a8a1a8d72d02b137dd3b9d7c939447917cb","src/track/metadata.rs":"a80bd086ce825f7484ce6318a586c482d06fea0efc9c76bfa0124e480cc8b75e","src/track/mod.rs":"04cd09cf5f26262175e48cc3855b79fbd8988916c4367a55d39a4c95784d249b","src/track/range.rs":"5bbfed6e103b3234d9de8e42057022da6d628c2cc1db6bb51b88f87f2d8adf8b","src/track/stateless.rs":"1d786b5e9558672243ba7d913736561065ef2bd5c6105c935e982486d10841f0","src/track/texture.rs":"7d60dc81ba7f7e2c2819525b90e6e6c7760cb0920e36aeefe98e76cedd49d26e","src/validation.rs":"6be9229cc34ef293ae99cfa520c6ad22bab39b83a53880a4aca36c42c53d40c3"},"package":null}
|
2
third_party/rust/wgpu-core/Cargo.toml
vendored
2
third_party/rust/wgpu-core/Cargo.toml
vendored
@ -55,7 +55,7 @@ package = "wgpu-hal"
|
||||
[dependencies.naga]
|
||||
version = "0.13.0"
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
|
||||
features = [
|
||||
"clone",
|
||||
"span",
|
||||
|
@ -89,8 +89,8 @@ pub enum RenderCommandError {
|
||||
MissingTextureUsage(#[from] MissingTextureUsageError),
|
||||
#[error(transparent)]
|
||||
PushConstants(#[from] PushConstantUploadError),
|
||||
#[error("Viewport has invalid rect {0:?}; origin and/or size is less than or equal to 0, and/or is not contained in the render target {1:?}")]
|
||||
InvalidViewportRect(Rect<f32>, wgt::Extent3d),
|
||||
#[error("Viewport width {0} and/or height {1} are less than or equal to 0")]
|
||||
InvalidViewportDimension(f32, f32),
|
||||
#[error("Viewport minDepth {0} and/or maxDepth {1} are not in [0, 1]")]
|
||||
InvalidViewportDepth(f32, f32),
|
||||
#[error("Scissor {0:?} is not contained in the render target {1:?}")]
|
||||
|
21
third_party/rust/wgpu-core/src/command/render.rs
vendored
21
third_party/rust/wgpu-core/src/command/render.rs
vendored
@ -960,13 +960,7 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> {
|
||||
|
||||
(is_depth_read_only, is_stencil_read_only) = at.depth_stencil_read_only(ds_aspects)?;
|
||||
|
||||
let usage = if is_depth_read_only
|
||||
&& is_stencil_read_only
|
||||
&& device
|
||||
.downlevel
|
||||
.flags
|
||||
.contains(wgt::DownlevelFlags::READ_ONLY_DEPTH_STENCIL)
|
||||
{
|
||||
let usage = if is_depth_read_only && is_stencil_read_only {
|
||||
hal::TextureUses::DEPTH_STENCIL_READ | hal::TextureUses::RESOURCE
|
||||
} else {
|
||||
hal::TextureUses::DEPTH_STENCIL_WRITE
|
||||
@ -1727,16 +1721,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
depth_max,
|
||||
} => {
|
||||
let scope = PassErrorScope::SetViewport;
|
||||
if rect.x < 0.0
|
||||
|| rect.y < 0.0
|
||||
|| rect.w <= 0.0
|
||||
|| rect.h <= 0.0
|
||||
|| rect.x + rect.w > info.extent.width as f32
|
||||
|| rect.y + rect.h > info.extent.height as f32
|
||||
{
|
||||
return Err(RenderCommandError::InvalidViewportRect(
|
||||
*rect,
|
||||
info.extent,
|
||||
if rect.w <= 0.0 || rect.h <= 0.0 {
|
||||
return Err(RenderCommandError::InvalidViewportDimension(
|
||||
rect.w, rect.h,
|
||||
))
|
||||
.map_pass_err(scope);
|
||||
}
|
||||
|
26
third_party/rust/wgpu-core/src/device/life.rs
vendored
26
third_party/rust/wgpu-core/src/device/life.rs
vendored
@ -219,9 +219,6 @@ struct ActiveSubmission<A: hal::Api> {
|
||||
mapped: Vec<id::Valid<id::BufferId>>,
|
||||
|
||||
encoders: Vec<EncoderInFlight<A>>,
|
||||
|
||||
/// List of queue "on_submitted_work_done" closures to be called once this
|
||||
/// submission has completed.
|
||||
work_done_closures: SmallVec<[SubmittedWorkDoneClosure; 1]>,
|
||||
}
|
||||
|
||||
@ -307,12 +304,6 @@ pub(super) struct LifetimeTracker<A: hal::Api> {
|
||||
/// Buffers the user has asked us to map, and which are not used by any
|
||||
/// queue submission still in flight.
|
||||
ready_to_map: Vec<id::Valid<id::BufferId>>,
|
||||
|
||||
/// Queue "on_submitted_work_done" closures that were initiated for while there is no
|
||||
/// currently pending submissions. These cannot be immeidately invoked as they
|
||||
/// must happen _after_ all mapped buffer callbacks are mapped, so we defer them
|
||||
/// here until the next time the device is maintained.
|
||||
work_done_closures: SmallVec<[SubmittedWorkDoneClosure; 1]>,
|
||||
}
|
||||
|
||||
impl<A: hal::Api> LifetimeTracker<A> {
|
||||
@ -325,7 +316,6 @@ impl<A: hal::Api> LifetimeTracker<A> {
|
||||
active: Vec::new(),
|
||||
free_resources: NonReferencedResources::new(),
|
||||
ready_to_map: Vec::new(),
|
||||
work_done_closures: SmallVec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,7 +405,7 @@ impl<A: hal::Api> LifetimeTracker<A> {
|
||||
.position(|a| a.index > last_done)
|
||||
.unwrap_or(self.active.len());
|
||||
|
||||
let mut work_done_closures: SmallVec<_> = self.work_done_closures.drain(..).collect();
|
||||
let mut work_done_closures = SmallVec::new();
|
||||
for a in self.active.drain(..done_count) {
|
||||
log::trace!("Active submission {} is done", a.index);
|
||||
self.free_resources.extend(a.last_resources);
|
||||
@ -455,16 +445,18 @@ impl<A: hal::Api> LifetimeTracker<A> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_work_done_closure(&mut self, closure: SubmittedWorkDoneClosure) {
|
||||
pub fn add_work_done_closure(
|
||||
&mut self,
|
||||
closure: SubmittedWorkDoneClosure,
|
||||
) -> Option<SubmittedWorkDoneClosure> {
|
||||
match self.active.last_mut() {
|
||||
Some(active) => {
|
||||
active.work_done_closures.push(closure);
|
||||
None
|
||||
}
|
||||
// We must defer the closure until all previously occuring map_async closures
|
||||
// have fired. This is required by the spec.
|
||||
None => {
|
||||
self.work_done_closures.push(closure);
|
||||
}
|
||||
// Note: we can't immediately invoke the closure, since it assumes
|
||||
// nothing is currently locked in the hubs.
|
||||
None => Some(closure),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
third_party/rust/wgpu-core/src/device/mod.rs
vendored
3
third_party/rust/wgpu-core/src/device/mod.rs
vendored
@ -181,9 +181,6 @@ impl UserClosures {
|
||||
fn fire(self) {
|
||||
// Note: this logic is specifically moved out of `handle_mapping()` in order to
|
||||
// have nothing locked by the time we execute users callback code.
|
||||
|
||||
// Mappings _must_ be fired before submissions, as the spec requires all mapping callbacks that are registered before
|
||||
// a on_submitted_work_done callback to be fired before the on_submitted_work_done callback.
|
||||
for (operation, status) in self.mappings {
|
||||
operation.callback.call(status);
|
||||
}
|
||||
|
17
third_party/rust/wgpu-core/src/device/queue.rs
vendored
17
third_party/rust/wgpu-core/src/device/queue.rs
vendored
@ -1435,12 +1435,17 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
closure: SubmittedWorkDoneClosure,
|
||||
) -> Result<(), InvalidQueue> {
|
||||
//TODO: flush pending writes
|
||||
let hub = A::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (device_guard, mut token) = hub.devices.read(&mut token);
|
||||
match device_guard.get(queue_id) {
|
||||
Ok(device) => device.lock_life(&mut token).add_work_done_closure(closure),
|
||||
Err(_) => return Err(InvalidQueue),
|
||||
let closure_opt = {
|
||||
let hub = A::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (device_guard, mut token) = hub.devices.read(&mut token);
|
||||
match device_guard.get(queue_id) {
|
||||
Ok(device) => device.lock_life(&mut token).add_work_done_closure(closure),
|
||||
Err(_) => return Err(InvalidQueue),
|
||||
}
|
||||
};
|
||||
if let Some(closure) = closure_opt {
|
||||
closure.call();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
4
third_party/rust/wgpu-hal/Cargo.toml
vendored
4
third_party/rust/wgpu-hal/Cargo.toml
vendored
@ -64,7 +64,7 @@ optional = true
|
||||
[dependencies.naga]
|
||||
version = "0.13.0"
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
|
||||
features = ["clone"]
|
||||
|
||||
[dependencies.profiling]
|
||||
@ -83,7 +83,7 @@ env_logger = "0.10"
|
||||
[dev-dependencies.naga]
|
||||
version = "0.13.0"
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "7a19f3af909202c7eafd36633b5584bfbb353ecb"
|
||||
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
|
||||
features = ["wgsl-in"]
|
||||
|
||||
[dev-dependencies.winit]
|
||||
|
@ -94,8 +94,7 @@ impl super::Adapter {
|
||||
| wgt::Features::POLYGON_MODE_LINE
|
||||
| wgt::Features::CLEAR_TEXTURE
|
||||
| wgt::Features::TEXTURE_FORMAT_16BIT_NORM
|
||||
| wgt::Features::ADDRESS_MODE_CLAMP_TO_ZERO
|
||||
| wgt::Features::ADDRESS_MODE_CLAMP_TO_BORDER;
|
||||
| wgt::Features::ADDRESS_MODE_CLAMP_TO_ZERO;
|
||||
let mut downlevel = wgt::DownlevelFlags::BASE_VERTEX
|
||||
| wgt::DownlevelFlags::READ_ONLY_DEPTH_STENCIL
|
||||
| wgt::DownlevelFlags::UNRESTRICTED_INDEX_BUFFER
|
||||
@ -133,8 +132,6 @@ impl super::Adapter {
|
||||
features |= wgt::Features::TIMESTAMP_QUERY;
|
||||
features |= wgt::Features::PIPELINE_STATISTICS_QUERY;
|
||||
features |= wgt::Features::SHADER_PRIMITIVE_INDEX;
|
||||
features |= wgt::Features::DEPTH32FLOAT_STENCIL8;
|
||||
features |= wgt::Features::RG11B10UFLOAT_RENDERABLE;
|
||||
}
|
||||
|
||||
if feature_level >= FL10_1 {
|
||||
|
@ -242,6 +242,7 @@ impl super::Adapter {
|
||||
| wgt::Features::ADDRESS_MODE_CLAMP_TO_BORDER
|
||||
| wgt::Features::ADDRESS_MODE_CLAMP_TO_ZERO
|
||||
| wgt::Features::POLYGON_MODE_LINE
|
||||
| wgt::Features::POLYGON_MODE_POINT
|
||||
| wgt::Features::VERTEX_WRITABLE_STORAGE
|
||||
| wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
|
||||
| wgt::Features::TIMESTAMP_QUERY
|
||||
|
10
third_party/rust/wgpu-hal/src/dx12/conv.rs
vendored
10
third_party/rust/wgpu-hal/src/dx12/conv.rs
vendored
@ -213,12 +213,12 @@ pub fn map_topology(
|
||||
|
||||
pub fn map_polygon_mode(mode: wgt::PolygonMode) -> d3d12_ty::D3D12_FILL_MODE {
|
||||
match mode {
|
||||
wgt::PolygonMode::Fill => d3d12_ty::D3D12_FILL_MODE_SOLID,
|
||||
wgt::PolygonMode::Point => {
|
||||
log::error!("Point rasterization is not supported");
|
||||
d3d12_ty::D3D12_FILL_MODE_WIREFRAME
|
||||
}
|
||||
wgt::PolygonMode::Line => d3d12_ty::D3D12_FILL_MODE_WIREFRAME,
|
||||
wgt::PolygonMode::Point => panic!(
|
||||
"{:?} is not enabled for this backend",
|
||||
wgt::Features::POLYGON_MODE_POINT
|
||||
),
|
||||
wgt::PolygonMode::Fill => d3d12_ty::D3D12_FILL_MODE_SOLID,
|
||||
}
|
||||
}
|
||||
|
||||
|
14
third_party/rust/wgpu-hal/src/gles/conv.rs
vendored
14
third_party/rust/wgpu-hal/src/gles/conv.rs
vendored
@ -279,18 +279,8 @@ pub fn map_primitive_topology(topology: wgt::PrimitiveTopology) -> u32 {
|
||||
}
|
||||
|
||||
pub(super) fn map_primitive_state(state: &wgt::PrimitiveState) -> super::PrimitiveState {
|
||||
match state.polygon_mode {
|
||||
wgt::PolygonMode::Fill => {}
|
||||
wgt::PolygonMode::Line => panic!(
|
||||
"{:?} is not enabled for this backend",
|
||||
wgt::Features::POLYGON_MODE_LINE
|
||||
),
|
||||
wgt::PolygonMode::Point => panic!(
|
||||
"{:?} is not enabled for this backend",
|
||||
wgt::Features::POLYGON_MODE_POINT
|
||||
),
|
||||
}
|
||||
|
||||
//Note: state.polygon_mode is not supported, see `Features::POLYGON_MODE_LINE` and
|
||||
//`Features::POLYGON_MODE_POINT`
|
||||
super::PrimitiveState {
|
||||
//Note: we are flipping the front face, so that
|
||||
// the Y-flip in the generated GLSL keeps the same visibility.
|
||||
|
17
third_party/rust/wgpu-hal/src/vulkan/instance.rs
vendored
17
third_party/rust/wgpu-hal/src/vulkan/instance.rs
vendored
@ -228,7 +228,8 @@ impl super::Instance {
|
||||
if cfg!(target_os = "macos") {
|
||||
// VK_EXT_metal_surface
|
||||
extensions.push(ext::MetalSurface::name());
|
||||
extensions.push(ash::vk::KhrPortabilityEnumerationFn::name());
|
||||
extensions
|
||||
.push(CStr::from_bytes_with_nul(b"VK_KHR_portability_enumeration\0").unwrap());
|
||||
}
|
||||
|
||||
if flags.contains(crate::InstanceFlags::DEBUG) {
|
||||
@ -656,15 +657,6 @@ impl crate::Instance<super::Api> for super::Instance {
|
||||
#[cfg(not(target_os = "android"))]
|
||||
let android_sdk_version = 0;
|
||||
|
||||
let mut flags = vk::InstanceCreateFlags::empty();
|
||||
|
||||
// Avoid VUID-VkInstanceCreateInfo-flags-06559: Only ask the instance to
|
||||
// enumerate incomplete Vulkan implementations (which we need on Mac) if
|
||||
// we managed to find the extension that provides the flag.
|
||||
if extensions.contains(&ash::vk::KhrPortabilityEnumerationFn::name()) {
|
||||
flags |= vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR;
|
||||
}
|
||||
|
||||
let vk_instance = {
|
||||
let str_pointers = layers
|
||||
.iter()
|
||||
@ -675,8 +667,11 @@ impl crate::Instance<super::Api> for super::Instance {
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
const VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR: u32 = 0x00000001;
|
||||
let create_info = vk::InstanceCreateInfo::builder()
|
||||
.flags(flags)
|
||||
.flags(vk::InstanceCreateFlags::from_raw(
|
||||
VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR,
|
||||
))
|
||||
.application_info(&app_info)
|
||||
.enabled_layer_names(&str_pointers[..layers.len()])
|
||||
.enabled_extension_names(&str_pointers[layers.len()..]);
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"3e6c7a81b7f5b26b82b7a8a423eda073864e457083fe884b5ba53bda62e68cc9","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/assertions.rs":"3fe98027aa73970c8ab7874a3e13dbfd6faa87df2081beb5c83aeec4c60f372f","src/lib.rs":"963d72ccc233e5121b0cba2df6d6002d27022d898a5634dbc1c3f4ef03c4b1b9","src/math.rs":"4d03039736dd6926feb139bc68734cb59df34ede310427bbf059e5c925e0af3b"},"package":null}
|
||||
{"files":{"Cargo.toml":"3e6c7a81b7f5b26b82b7a8a423eda073864e457083fe884b5ba53bda62e68cc9","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/assertions.rs":"3fe98027aa73970c8ab7874a3e13dbfd6faa87df2081beb5c83aeec4c60f372f","src/lib.rs":"539e99813685991a2e57e84b503c9a144d1b9ae24b36f321114f15d5b2867fec","src/math.rs":"4d03039736dd6926feb139bc68734cb59df34ede310427bbf059e5c925e0af3b"},"package":null}
|
5
third_party/rust/wgpu-types/src/lib.rs
vendored
5
third_party/rust/wgpu-types/src/lib.rs
vendored
@ -679,6 +679,7 @@ bitflags::bitflags! {
|
||||
/// This allows only drawing the vertices of polygons/triangles instead of filled
|
||||
///
|
||||
/// Supported platforms:
|
||||
/// - DX12
|
||||
/// - Vulkan
|
||||
///
|
||||
/// This is a native only feature.
|
||||
@ -1269,8 +1270,8 @@ bitflags::bitflags! {
|
||||
const INDIRECT_EXECUTION = 1 << 2;
|
||||
/// Supports non-zero `base_vertex` parameter to indexed draw calls.
|
||||
const BASE_VERTEX = 1 << 3;
|
||||
/// Supports reading from a depth/stencil texture while using it as a read-only
|
||||
/// depth/stencil attachment.
|
||||
/// Supports reading from a depth/stencil buffer while using as a read-only depth/stencil
|
||||
/// attachment.
|
||||
///
|
||||
/// The WebGL2 and GLES backends do not support RODS.
|
||||
const READ_ONLY_DEPTH_STENCIL = 1 << 4;
|
||||
|
Loading…
x
Reference in New Issue
Block a user