Bug 1846558: build(webgpu): bump wgpu to f71a1bc736fde37509262ca03e91d8f56a13aeb5 r=webgpu-reviewers,supply-chain-reviewers,jimb

Note that while WGPU's adapter option for a power preference has added
a new `None` variant as the new default, we preserve previous behavior
of specifying `LowPower` by default. This is because we're not sure we
want this behavior yet. See
[[https://bugzilla.mozilla.org/show_bug.cgi?id=1841840#c3 | bug 1841840,
comment 3]].

Depends on D185058

Differential Revision: https://phabricator.services.mozilla.com/D185059
This commit is contained in:
Erich Gubler 2023-08-07 15:40:14 +00:00
parent f62220b2a5
commit 49dcf1005c
60 changed files with 1918 additions and 1133 deletions

View File

@ -25,19 +25,14 @@ git = "https://github.com/franziskuskiefer/cose-rust"
rev = "43c22248d136c8b38fe42ea709d08da6355cf04b"
replace-with = "vendored-sources"
[source."git+https://github.com/gfx-rs/metal-rs.git?rev=a6a0446"]
git = "https://github.com/gfx-rs/metal-rs.git"
rev = "a6a0446"
replace-with = "vendored-sources"
[source."git+https://github.com/gfx-rs/naga?rev=409239c0e2313bfd0dc4fd64f8c3021185ccef1b"]
[source."git+https://github.com/gfx-rs/naga?rev=bac2d82a430fbfcf100ee22b7c3bc12f3d593079"]
git = "https://github.com/gfx-rs/naga"
rev = "409239c0e2313bfd0dc4fd64f8c3021185ccef1b"
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
replace-with = "vendored-sources"
[source."git+https://github.com/gfx-rs/wgpu?rev=1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"]
[source."git+https://github.com/gfx-rs/wgpu?rev=09b010b26af6876ce84991576a168a572172f08d"]
git = "https://github.com/gfx-rs/wgpu"
rev = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
replace-with = "vendored-sources"
[source."git+https://github.com/glandium/prost?rev=95964e9d33df3c2a9c3f14285e262867cab6f96b"]

21
Cargo.lock generated
View File

@ -3350,8 +3350,9 @@ dependencies = [
[[package]]
name = "metal"
version = "0.25.0"
source = "git+https://github.com/gfx-rs/metal-rs.git?rev=a6a0446#a6a04463db388e8fd3e99095ab4fbb87cbe9d69c"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318"
dependencies = [
"bitflags 2.999.999",
"block",
@ -3726,8 +3727,8 @@ checksum = "a2983372caf4480544083767bf2d27defafe32af49ab4df3a0b7fc90793a3664"
[[package]]
name = "naga"
version = "0.12.0"
source = "git+https://github.com/gfx-rs/naga?rev=409239c0e2313bfd0dc4fd64f8c3021185ccef1b#409239c0e2313bfd0dc4fd64f8c3021185ccef1b"
version = "0.13.0"
source = "git+https://github.com/gfx-rs/naga?rev=bac2d82a430fbfcf100ee22b7c3bc12f3d593079#bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
dependencies = [
"bit-set",
"bitflags 2.999.999",
@ -6288,8 +6289,8 @@ dependencies = [
[[package]]
name = "wgpu-core"
version = "0.16.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=1161a22f4fbb4fc204eb06f2ac4243f83e0e980d#1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
version = "0.17.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=09b010b26af6876ce84991576a168a572172f08d#09b010b26af6876ce84991576a168a572172f08d"
dependencies = [
"arrayvec",
"bit-vec",
@ -6311,8 +6312,8 @@ dependencies = [
[[package]]
name = "wgpu-hal"
version = "0.16.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=1161a22f4fbb4fc204eb06f2ac4243f83e0e980d#1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
version = "0.17.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=09b010b26af6876ce84991576a168a572172f08d#09b010b26af6876ce84991576a168a572172f08d"
dependencies = [
"android_system_properties",
"arrayvec",
@ -6347,8 +6348,8 @@ dependencies = [
[[package]]
name = "wgpu-types"
version = "0.16.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=1161a22f4fbb4fc204eb06f2ac4243f83e0e980d#1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
version = "0.17.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=09b010b26af6876ce84991576a168a572172f08d#09b010b26af6876ce84991576a168a572172f08d"
dependencies = [
"bitflags 2.999.999",
"js-sys",

View File

@ -306,6 +306,8 @@ ipc::IPCResult WebGPUParent::RecvInstanceRequestAdapter(
if (aOptions.mPowerPreference.WasPassed()) {
options.power_preference = static_cast<ffi::WGPUPowerPreference>(
aOptions.mPowerPreference.Value());
} else {
options.power_preference = ffi::WGPUPowerPreference_LowPower;
}
options.force_fallback_adapter = aOptions.mForceFallbackAdapter;

View File

@ -17,7 +17,7 @@ default = []
[dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
#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 = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
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 = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
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 = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
features = ["vulkan"]
[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
[dependencies.wgh]
package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu"
rev = "1161a22f4fbb4fc204eb06f2ac4243f83e0e980d"
rev = "09b010b26af6876ce84991576a168a572172f08d"
[dependencies]
bincode = "1"

View File

@ -20,11 +20,11 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: commit 1161a22f4fbb4fc204eb06f2ac4243f83e0e980d
release: commit 09b010b26af6876ce84991576a168a572172f08d
# Revision to pull in
# Must be a long or short commit SHA (long preferred)
revision: 1161a22f4fbb4fc204eb06f2ac4243f83e0e980d
revision: 09b010b26af6876ce84991576a168a572172f08d
license: ['MIT', 'Apache-2.0']

View File

@ -2118,6 +2118,11 @@ who = "Teodor Tanasoaia <ttanasoaia@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.24.0 -> 0.25.0"
[[audits.metal]]
who = "Erich Gubler <egubler@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.25.0 -> 0.26.0"
[[audits.midir]]
who = "Bobby Holley <bobbyholley@gmail.com>"
criteria = "safe-to-deploy"
@ -2234,6 +2239,11 @@ who = "Nicolas Silva <nical@fastmail.com>"
criteria = "safe-to-deploy"
delta = "0.11.0@git:f59668ccfaf7bdb3a7e43d84363a21c77357b2fe -> 0.12.0@git:b99d58ea435090e561377949f428bce2c18451bb"
[[audits.naga]]
who = "Erich Gubler <egubler@mozilla.com"
criteria = "safe-to-deploy"
delta = "0.12.0@git:409239c0e2313bfd0dc4fd64f8c3021185ccef1b -> 0.13.0@git:bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
[[audits.naga]]
who = "Nicolas Silva <nical@fastmail.com>"
criteria = "safe-to-deploy"
@ -3896,6 +3906,11 @@ who = "Nicolas Silva <nical@fastmail.com>"
criteria = "safe-to-deploy"
delta = "0.15.0@git:f3bf0f782e4dfc561d48e758e1f1e04f77860925 -> 0.16.0@git:25cb9f61e9a6be572ee42536bbe57aa5f759a700"
[[audits.wgpu-core]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "0.16.0@git:1161a22f4fbb4fc204eb06f2ac4243f83e0e980d -> 0.17.0@git:09b010b26af6876ce84991576a168a572172f08d"
[[audits.wgpu-core]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
@ -3989,6 +4004,11 @@ who = "Nicolas Silva <nical@fastmail.com>"
criteria = "safe-to-deploy"
delta = "0.15.1@git:f3bf0f782e4dfc561d48e758e1f1e04f77860925 -> 0.16.0@git:25cb9f61e9a6be572ee42536bbe57aa5f759a700"
[[audits.wgpu-hal]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "0.16.0@git:1161a22f4fbb4fc204eb06f2ac4243f83e0e980d -> 0.17.0@git:09b010b26af6876ce84991576a168a572172f08d"
[[audits.wgpu-hal]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
@ -4082,6 +4102,11 @@ who = "Nicolas Silva <nical@fastmail.com>"
criteria = "safe-to-deploy"
delta = "0.15.0@git:f3bf0f782e4dfc561d48e758e1f1e04f77860925 -> 0.16.0@git:25cb9f61e9a6be572ee42536bbe57aa5f759a700"
[[audits.wgpu-types]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "0.16.0@git:1161a22f4fbb4fc204eb06f2ac4243f83e0e980d -> 0.17.0@git:09b010b26af6876ce84991576a168a572172f08d"
[[audits.wgpu-types]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"

View File

@ -100,9 +100,6 @@ notes = "This was originally servo code which Bobby Holley put on crates.io some
audit-as-crates-io = false
notes = "This is a first-party crate which is also published to crates.io. We certify audits for this crate as part of the documented release process, but that step happens after the version bump lands on central so we don't enforce it here."
[policy.metal]
audit-as-crates-io = false
[policy.midir]
audit-as-crates-io = true
notes = "This is a pinned version of the upstream code, presumably to get a fix that hadn't been released yet. We should consider switching to the latest official release."

View File

@ -31,9 +31,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -75,9 +72,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -122,9 +116,6 @@
[:type="i32";inputSource="storage_r";vectorize=4]
expected: FAIL
[:type="i32";inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:type="i32";inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -218,9 +209,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -244,7 +232,6 @@
[:name="LogicalAndArith_ShortCircuit"]
expected: FAIL
[cts.https.html?q=webgpu:examples:gpu,with_texture_compression,etc2:*]
# TODO: Currently has issues being followed up with; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1836479>.
disabled: true
@ -305,9 +292,6 @@
[:type="i32";inputSource="storage_r";vectorize=4]
expected: FAIL
[:type="i32";inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:type="i32";inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -400,9 +384,6 @@
[:type="i32";inputSource="storage_r";vectorize=4]
expected: FAIL
[:type="i32";inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:type="i32";inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -501,7 +482,6 @@
[:name="SEAndMemberAccess"]
expected: FAIL
[cts.https.html?q=webgpu:idl,constants,flags:BufferUsage,count:*]
[cts.https.html?q=webgpu:idl,constants,flags:TextureUsage,count:*]
@ -533,9 +513,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:idl,constants,flags:ShaderStage,count:*]
@ -555,9 +532,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,evaluation_order:binary_logical:*]
[:name="BothSE"]

View File

@ -32,9 +32,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -79,9 +76,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -173,9 +167,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -217,9 +208,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -261,9 +249,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -308,9 +293,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -352,9 +334,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -398,9 +377,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -500,9 +476,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -547,9 +520,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -582,9 +552,6 @@
[:inputSource="storage_r";vectorize_rhs=4]
expected: FAIL
[:inputSource="storage_rw";vectorize_rhs=2]
expected: FAIL
[:inputSource="storage_rw";vectorize_rhs=3]
expected: FAIL
@ -626,9 +593,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -670,9 +634,6 @@
[:inputSource="storage_r";vectorize_lhs=4]
expected: FAIL
[:inputSource="storage_rw";vectorize_lhs=2]
expected: FAIL
[:inputSource="storage_rw";vectorize_lhs=3]
expected: FAIL
@ -764,9 +725,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -86,9 +86,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -130,9 +127,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -178,9 +172,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -229,9 +220,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -273,9 +261,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -326,9 +311,6 @@
[:inputSource="storage_rw";overload="scalar"]
expected: FAIL
[:inputSource="storage_rw";overload="vec2"]
expected: FAIL
[:inputSource="storage_rw";overload="vec3"]
expected: FAIL
@ -367,9 +349,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -418,9 +397,6 @@
[:inputSource="storage_rw";overload="scalar"]
expected: FAIL
[:inputSource="storage_rw";overload="vec2"]
expected: FAIL
[:inputSource="storage_rw";overload="vec3"]
expected: FAIL
@ -462,9 +438,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -512,9 +485,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -50,9 +50,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -33,9 +33,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -53,9 +50,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,cosh:f32:*]
[:inputSource="const";vectorize="_undef_"]
@ -88,9 +82,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -137,9 +128,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -181,9 +169,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -225,9 +210,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -274,9 +256,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -320,9 +299,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -369,9 +345,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -418,9 +391,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -462,9 +432,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -511,9 +478,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -561,9 +525,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -23,9 +23,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,distance:f32:*]
# TODO: Currently has issues being followed up with; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1836479>.
@ -38,9 +35,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,distance:f32_vec2:*]
# TODO: Currently has issues being followed up with; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1836479>.
@ -59,9 +53,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,dpdx:f32:*]
@ -106,9 +97,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -33,9 +33,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -82,9 +79,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -129,9 +123,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -184,9 +175,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -281,9 +269,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -382,9 +367,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -428,9 +410,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -478,9 +457,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -6,9 +6,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,ldexp:f16:*]
@ -50,9 +47,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -67,9 +61,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,length:f16:*]
@ -77,9 +68,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:*]
@ -149,9 +137,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,frexp:scalar_f16:*]
@ -189,9 +174,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -238,9 +220,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -34,9 +34,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -78,9 +75,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -157,9 +151,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -223,9 +214,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -274,9 +262,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -335,9 +320,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -383,9 +365,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -427,9 +406,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -23,9 +23,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,modf:f16_vec4_fract:*]
@ -63,9 +60,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -99,9 +93,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,modf:f32_vec4_fract:*]
[:inputSource="const"]
@ -125,9 +116,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,pow:abstract_float:*]
@ -135,9 +123,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,normalize:f16:*]
@ -150,17 +135,11 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,normalize:f32_vec3:*]
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,modf:f16_vec2_whole:*]
@ -184,15 +163,9 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,modf:f16_vec3_fract:*]
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,normalize:f32_vec4:*]
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL

View File

@ -31,9 +31,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -78,9 +75,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -178,9 +172,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -222,9 +213,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -242,9 +230,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,radians:abstract_float:*]
@ -255,9 +240,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,round:f16:*]
@ -368,9 +350,6 @@
[:inputSource="storage_r";component="u";overload="vec4"]
expected: FAIL
[:inputSource="storage_rw";component="b";overload="vec2"]
expected: FAIL
[:inputSource="storage_rw";component="b";overload="vec3"]
expected: FAIL
@ -550,9 +529,6 @@
[:inputSource="storage_r";component="u";overload="vec4"]
expected: FAIL
[:inputSource="storage_rw";component="b";overload="scalar"]
expected: FAIL
[:inputSource="storage_rw";component="b";overload="vec2"]
expected: FAIL
@ -612,9 +588,6 @@
[:inputSource="uniform"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:*]
@ -649,9 +622,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -34,9 +34,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -89,9 +86,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -135,9 +129,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -184,9 +175,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -228,9 +216,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -275,9 +260,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -381,9 +363,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL

View File

@ -5,7 +5,6 @@
# [Try test log]: https://treeherder.mozilla.org/logviewer?job_id=420831452&repo=try&lineNumber=2010-2019
disabled: true
[cts.https.html?q=webgpu:shader,execution,memory_model,coherence:corw1:*]
# TODO: Currently has issues being followed up with; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1836479>.
disabled: true
@ -24,9 +23,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,trunc:f32:*]
[:inputSource="const";vectorize="_undef_"]
@ -59,9 +55,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -109,9 +102,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -137,9 +127,6 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,workgroupBarrier:stage:*]
@ -191,9 +178,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -249,9 +233,6 @@
[:inputSource="storage_r";vectorize=4]
expected: FAIL
[:inputSource="storage_rw";vectorize="_undef_"]
expected: FAIL
[:inputSource="storage_rw";vectorize=2]
expected: FAIL
@ -266,23 +247,14 @@
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,unpack4x8unorm:unpack:*]
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:*]
[cts.https.html?q=webgpu:shader,execution,expression,call,builtin,unpack4x8snorm:unpack:*]
[:inputSource="const"]
expected: FAIL
[:inputSource="storage_rw"]
expected: FAIL

File diff suppressed because one or more lines are too long

View File

@ -1,54 +0,0 @@
name: ci
on: [pull_request, push]
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Cdebuginfo=0 --deny=warnings"
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
channel: [stable, nightly]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/cargo@v1
- name: Select Rust channel
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}
override: true
- name: Rust Version Info
run: rustc --version && cargo --version
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{ matrix.channel }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{ matrix.channel }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-${{ matrix.channel }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: cargo check
run: cargo check --all-features
- name: Run all tests
run: cargo test --all-features

1516
third_party/rust/metal/Cargo.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,8 @@
[package]
edition = "2021"
name = "metal"
version = "0.25.0"
authors = ["GFX Developers"]
version = "0.26.0"
authors = ["gfx-rs developers"]
exclude = [
"guide/**/*",
"examples/texture/**/*",
@ -90,36 +90,55 @@ required-features = ["dispatch"]
[[example]]
name = "fence"
[dependencies]
bitflags = "2"
block = "0.1.6"
core-graphics-types = "0.1"
foreign-types = "0.5"
log = "0.4"
paste = "1"
[dependencies.bitflags]
version = "2"
[dependencies.block]
version = "0.1.6"
[dependencies.core-graphics-types]
version = "0.1"
[dependencies.dispatch]
version = "0.2"
optional = true
[dependencies.foreign-types]
version = "0.5"
[dependencies.log]
version = "0.4"
[dependencies.objc]
version = "0.2.4"
features = ["objc_exception"]
[dev-dependencies]
cocoa = "0.24.0"
cty = "0.2.1"
glam = "0.22"
png = "0.17"
rand = "0.8"
sema = "0.1.4"
winit = "0.27"
[dependencies.paste]
version = "1"
[dev-dependencies.cocoa]
version = "0.24.0"
[dev-dependencies.cty]
version = "0.2.1"
[dev-dependencies.glam]
version = "0.22"
[dev-dependencies.png]
version = "0.17"
[dev-dependencies.rand]
version = "0.8"
[dev-dependencies.sema]
version = "0.1.4"
[dev-dependencies.winit]
version = "0.27"
[features]
default = ["link"]
link = []
mps = []
private = []
[workspace]
members = ["examples/texture"]

View File

@ -3,9 +3,13 @@ use objc::rc::autoreleasepool;
use std::path::PathBuf;
const NUM_SAMPLES: u64 = 2;
const NUM_ELEMENTS: u64 = 64 * 64;
fn main() {
let num_elements = std::env::args()
.nth(1)
.map(|s| s.parse::<u32>().unwrap())
.unwrap_or(64 * 64);
autoreleasepool(|| {
let device = Device::system_default().expect("No device found");
let mut cpu_start = 0;
@ -26,29 +30,29 @@ fn main() {
let compute_pass_descriptor = ComputePassDescriptor::new();
handle_compute_pass_sample_buffer_attachment(
&compute_pass_descriptor,
compute_pass_descriptor,
&counter_sample_buffer,
);
let encoder =
command_buffer.compute_command_encoder_with_descriptor(&compute_pass_descriptor);
command_buffer.compute_command_encoder_with_descriptor(compute_pass_descriptor);
let pipeline_state = create_pipeline_state(&device);
encoder.set_compute_pipeline_state(&pipeline_state);
let (buffer, sum) = create_input_and_output_buffers(&device);
let (buffer, sum) = create_input_and_output_buffers(&device, num_elements);
encoder.set_buffer(0, Some(&buffer), 0);
encoder.set_buffer(1, Some(&sum), 0);
let width = 16;
let num_threads = pipeline_state.thread_execution_width();
let thread_group_count = MTLSize {
width,
width: ((num_elements as NSUInteger + num_threads) / num_threads),
height: 1,
depth: 1,
};
let thread_group_size = MTLSize {
width: (NUM_ELEMENTS + width) / width,
width: num_threads,
height: 1,
depth: 1,
};
@ -56,7 +60,7 @@ fn main() {
encoder.dispatch_thread_groups(thread_group_count, thread_group_size);
encoder.end_encoding();
resolve_samples_into_buffer(&command_buffer, &counter_sample_buffer, &destination_buffer);
resolve_samples_into_buffer(command_buffer, &counter_sample_buffer, &destination_buffer);
command_buffer.commit();
command_buffer.wait_until_completed();
@ -68,7 +72,7 @@ fn main() {
println!("Compute shader sum: {}", unsafe { *ptr });
unsafe {
assert_eq!(NUM_ELEMENTS as u32, *ptr);
assert_eq!(num_elements, *ptr);
}
handle_timestamps(&destination_buffer, cpu_start, cpu_end, gpu_start, gpu_end);
@ -100,7 +104,7 @@ fn handle_compute_pass_sample_buffer_attachment(
.object_at(0)
.unwrap();
sample_buffer_attachment_descriptor.set_sample_buffer(&counter_sample_buffer);
sample_buffer_attachment_descriptor.set_sample_buffer(counter_sample_buffer);
sample_buffer_attachment_descriptor.set_start_of_encoder_sample_index(0);
sample_buffer_attachment_descriptor.set_end_of_encoder_sample_index(1);
}
@ -112,9 +116,9 @@ fn resolve_samples_into_buffer(
) {
let blit_encoder = command_buffer.new_blit_command_encoder();
blit_encoder.resolve_counters(
&counter_sample_buffer,
counter_sample_buffer,
crate::NSRange::new(0_u64, NUM_SAMPLES),
&destination_buffer,
destination_buffer,
0_u64,
);
blit_encoder.end_encoding();
@ -152,15 +156,18 @@ fn create_counter_sample_buffer(device: &Device) -> CounterSampleBuffer {
let timestamp_counter = counter_sets.iter().find(|cs| cs.name() == "timestamp");
counter_sample_buffer_desc
.set_counter_set(&timestamp_counter.expect("No timestamp counter found"));
.set_counter_set(timestamp_counter.expect("No timestamp counter found"));
device
.new_counter_sample_buffer_with_descriptor(&counter_sample_buffer_desc)
.unwrap()
}
fn create_input_and_output_buffers(device: &Device) -> (metal::Buffer, metal::Buffer) {
let data = [1u32; 64 * 64];
fn create_input_and_output_buffers(
device: &Device,
num_elements: u32,
) -> (metal::Buffer, metal::Buffer) {
let data = vec![1u32; num_elements as usize];
let buffer = device.new_buffer_with_data(
unsafe { std::mem::transmute(data.as_ptr()) },
@ -183,6 +190,5 @@ fn create_input_and_output_buffers(device: &Device) -> (metal::Buffer, metal::Bu
fn microseconds_between_begin(begin: u64, end: u64, gpu_time_span: u64, cpu_time_span: u64) -> f64 {
let time_span = (end as f64) - (begin as f64);
let nanoseconds = time_span / (gpu_time_span as f64) * (cpu_time_span as f64);
let microseconds = nanoseconds / 1000.0;
return microseconds;
nanoseconds / 1000.0
}

View File

@ -1 +0,0 @@
out.png

View File

@ -266,13 +266,7 @@ impl ArgumentRef {
}
pub fn is_active(&self) -> bool {
unsafe {
match msg_send![self, isActive] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isActive] }
}
pub fn buffer_alignment(&self) -> NSUInteger {

View File

@ -130,13 +130,7 @@ impl DepthStencilDescriptorRef {
}
pub fn depth_write_enabled(&self) -> bool {
unsafe {
match msg_send![self, isDepthWriteEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isDepthWriteEnabled] }
}
pub fn set_depth_write_enabled(&self, enabled: bool) {

View File

@ -1580,54 +1580,24 @@ impl DeviceRef {
}
pub fn is_low_power(&self) -> bool {
unsafe {
match msg_send![self, isLowPower] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isLowPower] }
}
pub fn is_headless(&self) -> bool {
unsafe {
match msg_send![self, isHeadless] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isHeadless] }
}
pub fn is_removable(&self) -> bool {
unsafe {
match msg_send![self, isRemovable] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isRemovable] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_raytracing(&self) -> bool {
unsafe {
match msg_send![self, supportsRaytracing] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsRaytracing] }
}
pub fn has_unified_memory(&self) -> bool {
unsafe {
match msg_send![self, hasUnifiedMemory] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send![self, hasUnifiedMemory] }
}
pub fn recommended_max_working_set_size(&self) -> u64 {
@ -1639,95 +1609,41 @@ impl DeviceRef {
}
pub fn supports_feature_set(&self, feature: MTLFeatureSet) -> bool {
unsafe {
match msg_send![self, supportsFeatureSet: feature] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsFeatureSet: feature] }
}
pub fn supports_family(&self, family: MTLGPUFamily) -> bool {
unsafe {
match msg_send![self, supportsFamily: family] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsFamily: family] }
}
pub fn supports_vertex_amplification_count(&self, count: NSUInteger) -> bool {
unsafe {
match msg_send![self, supportsVertexAmplificationCount: count] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsVertexAmplificationCount: count] }
}
pub fn supports_texture_sample_count(&self, count: NSUInteger) -> bool {
unsafe {
match msg_send![self, supportsTextureSampleCount: count] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsTextureSampleCount: count] }
}
pub fn supports_shader_barycentric_coordinates(&self) -> bool {
unsafe {
match msg_send![self, supportsShaderBarycentricCoordinates] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsShaderBarycentricCoordinates] }
}
pub fn supports_function_pointers(&self) -> bool {
unsafe {
match msg_send![self, supportsFunctionPointers] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsFunctionPointers] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_dynamic_libraries(&self) -> bool {
unsafe {
match msg_send![self, supportsDynamicLibraries] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsDynamicLibraries] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_counter_sampling(&self, sampling_point: MTLCounterSamplingPoint) -> bool {
unsafe {
match msg_send![self, supportsCounterSampling: sampling_point] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsCounterSampling: sampling_point] }
}
pub fn d24_s8_supported(&self) -> bool {
unsafe {
match msg_send![self, isDepth24Stencil8PixelFormatSupported] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isDepth24Stencil8PixelFormatSupported] }
}
pub fn new_fence(&self) -> Fence {
@ -2066,68 +1982,32 @@ impl DeviceRef {
}
pub fn raster_order_groups_supported(&self) -> bool {
unsafe {
match msg_send![self, rasterOrderGroupsSupported] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, rasterOrderGroupsSupported] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_32bit_float_filtering(&self) -> bool {
unsafe {
match msg_send![self, supports32BitFloatFiltering] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supports32BitFloatFiltering] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_32bit_MSAA(&self) -> bool {
unsafe {
match msg_send![self, supports32BitMSAA] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supports32BitMSAA] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_query_texture_LOD(&self) -> bool {
unsafe {
match msg_send![self, supportsQueryTextureLOD] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsQueryTextureLOD] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_BC_texture_compression(&self) -> bool {
unsafe {
match msg_send![self, supportsBCTextureCompression] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsBCTextureCompression] }
}
/// Only available on (macos(11.0), ios(14.0))
pub fn supports_pull_model_interpolation(&self) -> bool {
unsafe {
match msg_send![self, supportsPullModelInterpolation] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportsPullModelInterpolation] }
}
pub fn new_argument_encoder(

View File

@ -32,13 +32,7 @@ impl IndirectCommandBufferDescriptorRef {
}
pub fn inherit_buffers(&self) -> bool {
unsafe {
match msg_send![self, inheritBuffers] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, inheritBuffers] }
}
pub fn set_inherit_buffers(&self, inherit: bool) {
@ -46,13 +40,7 @@ impl IndirectCommandBufferDescriptorRef {
}
pub fn inherit_pipeline_state(&self) -> bool {
unsafe {
match msg_send![self, inheritPipelineState] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, inheritPipelineState] }
}
pub fn set_inherit_pipeline_state(&self, inherit: bool) {

View File

@ -214,6 +214,46 @@ macro_rules! try_objc {
};
}
macro_rules! msg_send_bool {
($obj:expr, $name:ident) => {{
match msg_send![$obj, $name] {
YES => true,
NO => false,
#[cfg(not(target_arch = "aarch64"))]
_ => unreachable!(),
}
}};
($obj:expr, $name:ident : $arg:expr) => {{
match msg_send![$obj, $name: $arg] {
YES => true,
NO => false,
#[cfg(not(target_arch = "aarch64"))]
_ => unreachable!(),
}
}};
}
macro_rules! msg_send_bool_error_check {
($obj:expr, $name:ident: $arg:expr) => {{
let mut err: *mut Object = ptr::null_mut();
let result: BOOL = msg_send![$obj, $name:$arg
error:&mut err];
if !err.is_null() {
let desc: *mut Object = msg_send![err, localizedDescription];
let c_msg: *const c_char = msg_send![desc, UTF8String];
let message = CStr::from_ptr(c_msg).to_string_lossy().into_owned();
Err(message)
} else {
match result {
YES => Ok(true),
NO => Ok(false),
#[cfg(not(target_arch = "aarch64"))]
_ => unreachable!(),
}
}
}};
}
/// See <https://developer.apple.com/documentation/foundation/nsarray>
pub struct NSArray<T> {
_phantom: PhantomData<T>,
@ -425,13 +465,7 @@ impl MetalLayerRef {
}
pub fn presents_with_transaction(&self) -> bool {
unsafe {
match msg_send![self, presentsWithTransaction] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, presentsWithTransaction] }
}
pub fn set_presents_with_transaction(&self, transaction: bool) {
@ -439,13 +473,7 @@ impl MetalLayerRef {
}
pub fn display_sync_enabled(&self) -> bool {
unsafe {
match msg_send![self, displaySyncEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, displaySyncEnabled] }
}
pub fn set_display_sync_enabled(&self, enabled: bool) {
@ -486,13 +514,7 @@ impl MetalLayerRef {
/// [framebufferOnly Apple Docs](https://developer.apple.com/documentation/metal/mtltexture/1515749-framebufferonly?language=objc)
pub fn framebuffer_only(&self) -> bool {
unsafe {
match msg_send![self, framebufferOnly] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool!(self, framebufferOnly) }
}
pub fn set_framebuffer_only(&self, framebuffer_only: bool) {
@ -500,13 +522,7 @@ impl MetalLayerRef {
}
pub fn is_opaque(&self) -> bool {
unsafe {
match msg_send![self, isOpaque] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool!(self, isOpaque) }
}
pub fn set_opaque(&self, opaque: bool) {
@ -514,13 +530,7 @@ impl MetalLayerRef {
}
pub fn wants_extended_dynamic_range_content(&self) -> bool {
unsafe {
match msg_send![self, wantsExtendedDynamicRangeContent] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, wantsExtendedDynamicRangeContent] }
}
pub fn set_wants_extended_dynamic_range_content(

View File

@ -50,35 +50,17 @@ impl VertexAttributeRef {
}
pub fn is_active(&self) -> bool {
unsafe {
match msg_send![self, isActive] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isActive] }
}
/// Only available on (macos(10.12), ios(10.0)
pub fn is_patch_data(&self) -> bool {
unsafe {
match msg_send![self, isPatchData] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isPatchData] }
}
/// Only available on (macos(10.12), ios(10.0)
pub fn is_patch_control_point_data(&self) -> bool {
unsafe {
match msg_send![self, isPatchControlPointData] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isPatchControlPointData] }
}
}
@ -109,35 +91,17 @@ impl AttributeRef {
}
pub fn is_active(&self) -> bool {
unsafe {
match msg_send![self, isActive] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isActive] }
}
/// Only available on (macos(10.12), ios(10.0))
pub fn is_patch_data(&self) -> bool {
unsafe {
match msg_send![self, isPatchData] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isPatchData] }
}
/// Only available on (macos(10.12), ios(10.0))
pub fn is_patch_control_point_data(&self) -> bool {
unsafe {
match msg_send![self, isPatchControlPointData] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isPatchControlPointData] }
}
}
@ -181,13 +145,7 @@ impl FunctionConstantRef {
}
pub fn required(&self) -> bool {
unsafe {
match msg_send![self, required] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, required] }
}
}
@ -486,13 +444,7 @@ impl CompileOptionsRef {
}
pub fn is_fast_math_enabled(&self) -> bool {
unsafe {
match msg_send![self, fastMathEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, fastMathEnabled] }
}
pub fn set_fast_math_enabled(&self, enabled: bool) {
@ -576,13 +528,7 @@ impl CompileOptionsRef {
/// Only available on (macos(11.0), macCatalyst(14.0), ios(13.0))
pub fn preserve_invariance(&self) -> bool {
unsafe {
match msg_send![self, preserveInvariance] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, preserveInvariance] }
}
/// Only available on (macos(11.0), macCatalyst(14.0), ios(13.0))
@ -670,7 +616,6 @@ impl LibraryRef {
nsstring_as_str(name).to_string()
})
.collect();
let () = msg_send![names, release];
ret
}
}
@ -782,24 +727,7 @@ impl DynamicLibraryRef {
}
pub fn serialize_to_url(&self, url: &URLRef) -> Result<bool, String> {
unsafe {
let mut err: *mut Object = ptr::null_mut();
let result: BOOL = msg_send![self, serializeToURL:url
error:&mut err];
if !err.is_null() {
// FIXME: copy pasta
let desc: *mut Object = msg_send![err, localizedDescription];
let c_msg: *const c_char = msg_send![desc, UTF8String];
let message = CStr::from_ptr(c_msg).to_string_lossy().into_owned();
Err(message)
} else {
match result {
YES => Ok(true),
NO => Ok(false),
_ => unreachable!(),
}
}
}
unsafe { msg_send_bool_error_check![self, serializeToURL: url] }
}
}
@ -865,22 +793,7 @@ impl BinaryArchiveRef {
descriptor: &ComputePipelineDescriptorRef,
) -> Result<bool, String> {
unsafe {
let mut err: *mut Object = ptr::null_mut();
let result: BOOL = msg_send![self, addComputePipelineFunctionsWithDescriptor:descriptor
error:&mut err];
if !err.is_null() {
// FIXME: copy pasta
let desc: *mut Object = msg_send![err, localizedDescription];
let c_msg: *const c_char = msg_send![desc, UTF8String];
let message = CStr::from_ptr(c_msg).to_string_lossy().into_owned();
Err(message)
} else {
match result {
YES => Ok(true),
NO => Ok(false),
_ => unreachable!(),
}
}
msg_send_bool_error_check![self, addComputePipelineFunctionsWithDescriptor: descriptor]
}
}
@ -889,22 +802,7 @@ impl BinaryArchiveRef {
descriptor: &RenderPipelineDescriptorRef,
) -> Result<bool, String> {
unsafe {
let mut err: *mut Object = ptr::null_mut();
let result: BOOL = msg_send![self, addRenderPipelineFunctionsWithDescriptor:descriptor
error:&mut err];
if !err.is_null() {
// FIXME: copy pasta
let desc: *mut Object = msg_send![err, localizedDescription];
let c_msg: *const c_char = msg_send![desc, UTF8String];
let message = CStr::from_ptr(c_msg).to_string_lossy().into_owned();
Err(message)
} else {
match result {
YES => Ok(true),
NO => Ok(false),
_ => unreachable!(),
}
}
msg_send_bool_error_check![self, addRenderPipelineFunctionsWithDescriptor: descriptor]
}
}
@ -927,6 +825,7 @@ impl BinaryArchiveRef {
match result {
YES => Ok(true),
NO => Ok(false),
#[cfg(not(target_arch = "aarch64"))]
_ => unreachable!(),
}
}

View File

@ -125,13 +125,7 @@ impl ComputePipelineDescriptorRef {
}
pub fn thread_group_size_is_multiple_of_thread_execution_width(&self) -> bool {
unsafe {
match msg_send![self, threadGroupSizeIsMultipleOfThreadExecutionWidth] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, threadGroupSizeIsMultipleOfThreadExecutionWidth] }
}
pub fn set_thread_group_size_is_multiple_of_thread_execution_width(
@ -158,13 +152,7 @@ impl ComputePipelineDescriptorRef {
/// API_AVAILABLE(ios(13.0),macos(11.0));
pub fn support_indirect_command_buffers(&self) -> bool {
unsafe {
match msg_send![self, supportIndirectCommandBuffers] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportIndirectCommandBuffers] }
}
/// API_AVAILABLE(ios(13.0),macos(11.0));
@ -174,13 +162,7 @@ impl ComputePipelineDescriptorRef {
/// API_AVAILABLE(macos(11.0), ios(14.0));
pub fn support_adding_binary_functions(&self) -> bool {
unsafe {
match msg_send![self, supportAddingBinaryFunctions] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportAddingBinaryFunctions] }
}
/// API_AVAILABLE(macos(11.0), ios(14.0));
@ -305,13 +287,7 @@ impl ComputePipelineStateRef {
/// Only available on (ios(13.0), macos(11.0))
pub fn support_indirect_command_buffers(&self) -> bool {
unsafe {
match msg_send![self, supportIndirectCommandBuffers] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportIndirectCommandBuffers] }
}
/// Only available on (macos(11.0), ios(14.0))

View File

@ -94,13 +94,7 @@ impl RenderPipelineColorAttachmentDescriptorRef {
}
pub fn is_blending_enabled(&self) -> bool {
unsafe {
match msg_send![self, isBlendingEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isBlendingEnabled] }
}
pub fn set_blending_enabled(&self, enabled: bool) {
@ -291,13 +285,7 @@ impl MeshRenderPipelineDescriptorRef {
}
pub fn is_alpha_to_coverage_enabled(&self) -> bool {
unsafe {
match msg_send![self, isAlphaToCoverageEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isAlphaToCoverageEnabled] }
}
pub fn set_alpha_to_coverage_enabled(&self, enabled: bool) {
@ -305,13 +293,7 @@ impl MeshRenderPipelineDescriptorRef {
}
pub fn is_alpha_to_one_enabled(&self) -> bool {
unsafe {
match msg_send![self, isAlphaToOneEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isAlphaToOneEnabled] }
}
pub fn set_alpha_to_one_enabled(&self, enabled: bool) {
@ -319,13 +301,7 @@ impl MeshRenderPipelineDescriptorRef {
}
pub fn is_rasterization_enabled(&self) -> bool {
unsafe {
match msg_send![self, isRasterizationEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isRasterizationEnabled] }
}
pub fn set_rasterization_enabled(&self, enabled: bool) {
@ -420,13 +396,7 @@ impl MeshRenderPipelineDescriptorRef {
}
pub fn mesh_threadgroup_size_is_multiple_of_thread_execution_width(&self) -> bool {
unsafe {
match msg_send![self, isMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth] }
}
pub fn set_mesh_threadgroup_size_is_multiple_of_thread_execution_width(
@ -456,14 +426,10 @@ impl MeshRenderPipelineDescriptorRef {
pub fn object_threadgroup_size_is_multiple_of_thread_execution_width(&self) -> bool {
unsafe {
match msg_send![
msg_send_bool![
self,
isObjectThreadgroupSizeIsMultipleOfThreadExecutionWidth
] {
YES => true,
NO => false,
_ => unreachable!(),
}
]
}
}
@ -592,13 +558,7 @@ impl RenderPipelineDescriptorRef {
}
pub fn is_alpha_to_coverage_enabled(&self) -> bool {
unsafe {
match msg_send![self, isAlphaToCoverageEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isAlphaToCoverageEnabled] }
}
pub fn set_alpha_to_coverage_enabled(&self, enabled: bool) {
@ -606,13 +566,7 @@ impl RenderPipelineDescriptorRef {
}
pub fn is_alpha_to_one_enabled(&self) -> bool {
unsafe {
match msg_send![self, isAlphaToOneEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isAlphaToOneEnabled] }
}
pub fn set_alpha_to_one_enabled(&self, enabled: bool) {
@ -620,13 +574,7 @@ impl RenderPipelineDescriptorRef {
}
pub fn is_rasterization_enabled(&self) -> bool {
unsafe {
match msg_send![self, isRasterizationEnabled] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isRasterizationEnabled] }
}
pub fn set_rasterization_enabled(&self, enabled: bool) {
@ -676,13 +624,7 @@ impl RenderPipelineDescriptorRef {
}
pub fn support_indirect_command_buffers(&self) -> bool {
unsafe {
match msg_send![self, supportIndirectCommandBuffers] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, supportIndirectCommandBuffers] }
}
pub fn set_support_indirect_command_buffers(&self, support: bool) {

View File

@ -177,12 +177,6 @@ impl ResourceRef {
/// Only available on macos(10.13), ios(10.0)
pub fn is_aliasable(&self) -> bool {
unsafe {
match msg_send![self, isAliasable] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isAliasable] }
}
}

View File

@ -255,13 +255,7 @@ impl TextureRef {
/// [framebufferOnly Apple Docs](https://developer.apple.com/documentation/metal/mtltexture/1515749-framebufferonly?language=objc)
pub fn framebuffer_only(&self) -> bool {
unsafe {
match msg_send![self, isFramebufferOnly] {
YES => true,
NO => false,
_ => unreachable!(),
}
}
unsafe { msg_send_bool![self, isFramebufferOnly] }
}
pub fn get_bytes(

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.63"
name = "naga"
version = "0.12.0"
version = "0.13.0"
authors = ["Naga Developers"]
exclude = [
"bin/**/*",
@ -100,11 +100,11 @@ optional = true
[dev-dependencies]
bincode = "1"
diff = "0.1"
env_logger = "0.9"
ron = "~0.7.1"
env_logger = "0.10"
ron = "0.8.0"
[dev-dependencies.criterion]
version = "0.3"
version = "0.5"
features = []
[dev-dependencies.hlsl-snapshots]

View File

@ -1 +1 @@
{"files":{"Cargo.toml":"71bf931670156f0491a1c62dea17effcd6b0eaa0049457c90c7df4857eea2d7d","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/binding_model.rs":"d92a2c21642d0bece4ce1a9877d08567a86af4991cfe0bf6ecaaaf8f8b9c8d74","src/command/bind.rs":"aa778a7a125496f31220e8aa06a7eee5c5bc524a29e77cc5a314a178a0813a80","src/command/bundle.rs":"00ac15c8c70cf58437a0f66472e6c8b73200c6ec15e2062adabd151bebc9b2fc","src/command/clear.rs":"b61144473752e363dfe9c15951702865921b568c8ee5136af7aa4237f015c383","src/command/compute.rs":"96ca2d55d9ba5f1067c701df25eb5e655557b17a45f306e3d8d31bd196839868","src/command/draw.rs":"14a0319da47e4995c2ad97f1102998b0d4beb2f6d07df8a0cb6f08023185ce7a","src/command/memory_init.rs":"b50d3d20dbf659052f19da2e79469ba6435e06370f19d6ef45e1b1128d9900b7","src/command/mod.rs":"c7b7a4dd50636694a835e48f6a65dba8cf873168a02758fae73d6c04d48dfc45","src/command/query.rs":"e12108706de23a2925d180f96dcb870d167c1d4033903d306435395284b7a0d5","src/command/render.rs":"b72e27b8a615551bb3320ceaac3e285e082522cd0524e9960e8628aa3d4b10d6","src/command/transfer.rs":"c777c6e51afb459d2b5416e31071f24e4215c66f456fee3bd8f7395f9d1c5db1","src/conv.rs":"9654736318f9efdf15695eacaf64218febf01cb945b764ce6a966cbd41345a79","src/device/global.rs":"9c6427309a415f8053fa89d6dbcdd32a8dcd605040d7610c1907ed4eb23a7d90","src/device/life.rs":"c935c15c4c7f929e378a5ea930d0d36b47616a49991c236aaa10d25ce5852d15","src/device/mod.rs":"f0f8da084e0959ea1ec19438eda1dcf80325ef117ab1dec777a776e5b45fcef2","src/device/queue.rs":"b1ef887b92574d2541ef6f572cd14067e2af3a514fa26d547f9c18e2cbd30b92","src/device/resource.rs":"55bf87b8bcf0199221b558c11d58028ad2b2563ee525ead648c792aacf811b84","src/device/trace.rs":"f69aa6af36a6defcf391ddb6cf12a56e37e00b4595e95c284cd7fd400394349c","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":"915b8942542a5032a3036440824bf361cabd1792cbf2ac9a1f3c6a8534412906","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":"24057a2bc40c5e77a440fb432f0007e0b67cf41b8056394cff97208447d06513"},"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":"00ac15c8c70cf58437a0f66472e6c8b73200c6ec15e2062adabd151bebc9b2fc","src/command/clear.rs":"b61144473752e363dfe9c15951702865921b568c8ee5136af7aa4237f015c383","src/command/compute.rs":"96ca2d55d9ba5f1067c701df25eb5e655557b17a45f306e3d8d31bd196839868","src/command/draw.rs":"14a0319da47e4995c2ad97f1102998b0d4beb2f6d07df8a0cb6f08023185ce7a","src/command/memory_init.rs":"b50d3d20dbf659052f19da2e79469ba6435e06370f19d6ef45e1b1128d9900b7","src/command/mod.rs":"c7b7a4dd50636694a835e48f6a65dba8cf873168a02758fae73d6c04d48dfc45","src/command/query.rs":"e12108706de23a2925d180f96dcb870d167c1d4033903d306435395284b7a0d5","src/command/render.rs":"b72e27b8a615551bb3320ceaac3e285e082522cd0524e9960e8628aa3d4b10d6","src/command/transfer.rs":"c777c6e51afb459d2b5416e31071f24e4215c66f456fee3bd8f7395f9d1c5db1","src/conv.rs":"a21506ce183e7989df0e8db29d8cd6f9884b3531d004a0e5193e3aa0b73b10c8","src/device/global.rs":"a06a5b10cda63dd97f5cd59e2813fd189d2cf59fd4154950a878874d4221cc12","src/device/life.rs":"c935c15c4c7f929e378a5ea930d0d36b47616a49991c236aaa10d25ce5852d15","src/device/mod.rs":"f0f8da084e0959ea1ec19438eda1dcf80325ef117ab1dec777a776e5b45fcef2","src/device/queue.rs":"b1ef887b92574d2541ef6f572cd14067e2af3a514fa26d547f9c18e2cbd30b92","src/device/resource.rs":"cbb1bcd91c5e62a2a98288fa1cd9b5d8eb54cc78fa5ba042adaffe6b6770675a","src/device/trace.rs":"f69aa6af36a6defcf391ddb6cf12a56e37e00b4595e95c284cd7fd400394349c","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":"363484220e0936eabd79098631a1b646173632ed01126aaf56f65b300bf6df92","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}

View File

@ -12,7 +12,7 @@
[package]
edition = "2021"
name = "wgpu-core"
version = "0.16.0"
version = "0.17.0"
authors = ["wgpu developers"]
description = "WebGPU core logic on wgpu-hal"
homepage = "https://wgpu.rs/"
@ -47,15 +47,15 @@ smallvec = "1"
thiserror = "1"
[dependencies.hal]
version = "0.16"
version = "0.17"
path = "../wgpu-hal"
default_features = false
package = "wgpu-hal"
[dependencies.naga]
version = "0.12.0"
version = "0.13.0"
git = "https://github.com/gfx-rs/naga"
rev = "409239c0e2313bfd0dc4fd64f8c3021185ccef1b"
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
features = [
"clone",
"span",
@ -80,7 +80,7 @@ features = ["serde_derive"]
optional = true
[dependencies.wgt]
version = "0.16"
version = "0.17"
path = "../wgpu-types"
package = "wgpu-types"
@ -121,7 +121,7 @@ vulkan = ["hal/vulkan"]
wgsl = ["naga/wgsl-in"]
[target."cfg(all(target_arch = \"wasm32\", not(target_os = \"emscripten\")))".dependencies.web-sys]
version = "0.3.60"
version = "0.3.64"
features = [
"HtmlCanvasElement",
"OffscreenCanvas",

View File

@ -131,6 +131,31 @@ pub fn map_texture_usage(
u
}
pub fn map_texture_usage_from_hal(uses: hal::TextureUses) -> wgt::TextureUsages {
let mut u = wgt::TextureUsages::empty();
u.set(
wgt::TextureUsages::COPY_SRC,
uses.contains(hal::TextureUses::COPY_SRC),
);
u.set(
wgt::TextureUsages::COPY_DST,
uses.contains(hal::TextureUses::COPY_DST),
);
u.set(
wgt::TextureUsages::TEXTURE_BINDING,
uses.contains(hal::TextureUses::RESOURCE),
);
u.set(
wgt::TextureUsages::STORAGE_BINDING,
uses.contains(hal::TextureUses::STORAGE_READ | hal::TextureUses::STORAGE_READ_WRITE),
);
u.set(
wgt::TextureUsages::RENDER_ATTACHMENT,
uses.contains(hal::TextureUses::COLOR_TARGET),
);
u
}
pub fn check_texture_dimension_size(
dimension: wgt::TextureDimension,
wgt::Extent3d {

View File

@ -58,10 +58,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
hal_caps.formats.sort_by_key(|f| !f.is_srgb());
let usages = conv::map_texture_usage_from_hal(hal_caps.usage);
Ok(wgt::SurfaceCapabilities {
formats: hal_caps.formats,
present_modes: hal_caps.present_modes,
alpha_modes: hal_caps.composite_alpha_modes,
usages,
})
})
}

View File

@ -1285,8 +1285,7 @@ impl<A: HalApi> Device<A> {
inner: Box::new(inner),
})
})?;
let interface =
validation::Interface::new(&module, &info, self.features, self.limits.clone());
let interface = validation::Interface::new(&module, &info, self.limits.clone());
let hal_shader = hal::ShaderInput::Naga(hal::NagaShader { module, info });
let hal_desc = hal::ShaderModuleDescriptor {

View File

@ -896,6 +896,17 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
// hardware GPU (integrated or discrete).
PowerPreference::LowPower => integrated.or(discrete).or(other).or(virt).or(cpu),
PowerPreference::HighPerformance => discrete.or(integrated).or(other).or(virt).or(cpu),
PowerPreference::None => {
let option_min = |a: Option<usize>, b: Option<usize>| {
if let (Some(a), Some(b)) = (a, b) {
Some(a.min(b))
} else {
a.or(b)
}
};
// Pick the lowest id of these types
option_min(option_min(discrete, integrated), other)
}
};
let mut selected = preferred_gpu.unwrap_or(0);

View File

@ -1,5 +1,4 @@
use crate::{binding_model::BindEntryMap, FastHashMap, FastHashSet};
use naga::valid::GlobalUse;
use std::{collections::hash_map::Entry, fmt};
use thiserror::Error;
use wgt::{BindGroupLayoutEntry, BindingType};
@ -112,7 +111,7 @@ struct SpecializationConstant {
struct EntryPoint {
inputs: Vec<Varying>,
outputs: Vec<Varying>,
resources: Vec<(naga::Handle<Resource>, GlobalUse)>,
resources: Vec<naga::Handle<Resource>>,
#[allow(unused)]
spec_constants: Vec<SpecializationConstant>,
sampling_pairs: FastHashSet<(naga::Handle<Resource>, naga::Handle<Resource>)>,
@ -121,7 +120,6 @@ struct EntryPoint {
#[derive(Debug)]
pub struct Interface {
features: wgt::Features,
limits: wgt::Limits,
resources: naga::Arena<Resource>,
entry_points: FastHashMap<(naga::ShaderStage, String), EntryPoint>,
@ -174,11 +172,6 @@ pub enum BindingError {
Missing,
#[error("Visibility flags don't include the shader stage")]
Invisible,
#[error("The shader requires the load/store access flags {required:?} but only {allowed:?} is allowed")]
WrongUsage {
required: GlobalUse,
allowed: GlobalUse,
},
#[error("Type on the shader side does not match the pipeline binding")]
WrongType,
#[error("Storage class {binding:?} doesn't match the shader {shader:?}")]
@ -206,9 +199,9 @@ pub enum BindingError {
#[error("Texture format {0:?} is not supported for storage use")]
BadStorageFormat(wgt::TextureFormat),
#[error(
"Storage texture usage {0:?} doesn't have a matching supported `StorageTextureAccess`"
"Storage texture with access {0:?} doesn't have a matching supported `StorageTextureAccess`"
)]
UnsupportedTextureStorageAccess(GlobalUse),
UnsupportedTextureStorageAccess(naga::StorageAccess),
}
#[derive(Clone, Debug, Error)]
@ -379,43 +372,32 @@ fn map_storage_format_from_naga(format: naga::StorageFormat) -> wgt::TextureForm
}
impl Resource {
fn check_binding_use(
&self,
entry: &BindGroupLayoutEntry,
shader_usage: GlobalUse,
) -> Result<(), BindingError> {
let allowed_usage = match self.ty {
fn check_binding_use(&self, entry: &BindGroupLayoutEntry) -> Result<(), BindingError> {
match self.ty {
ResourceType::Buffer { size } => {
let (allowed_usage, min_size) = match entry.ty {
let min_size = match entry.ty {
BindingType::Buffer {
ty,
has_dynamic_offset: _,
min_binding_size,
} => {
let (class, global_use) = match ty {
wgt::BufferBindingType::Uniform => {
(naga::AddressSpace::Uniform, GlobalUse::READ)
}
let class = match ty {
wgt::BufferBindingType::Uniform => naga::AddressSpace::Uniform,
wgt::BufferBindingType::Storage { read_only } => {
let mut global_use = GlobalUse::READ | GlobalUse::QUERY;
global_use.set(GlobalUse::WRITE, !read_only);
let mut naga_access = naga::StorageAccess::LOAD;
naga_access.set(naga::StorageAccess::STORE, !read_only);
(
naga::AddressSpace::Storage {
access: naga_access,
},
global_use,
)
naga::AddressSpace::Storage {
access: naga_access,
}
}
};
if !address_space_matches(self.class, class) {
if self.class != class {
return Err(BindingError::WrongAddressSpace {
binding: class,
shader: self.class,
});
}
(global_use, min_binding_size)
min_binding_size
}
_ => return Err(BindingError::WrongType),
};
@ -425,13 +407,10 @@ impl Resource {
}
_ => (),
}
allowed_usage
}
ResourceType::Sampler { comparison } => match entry.ty {
BindingType::Sampler(ty) => {
if (ty == wgt::SamplerBindingType::Comparison) == comparison {
GlobalUse::READ
} else {
if (ty == wgt::SamplerBindingType::Comparison) != comparison {
return Err(BindingError::WrongSamplerComparison);
}
}
@ -480,29 +459,26 @@ impl Resource {
}
}
}
let (expected_class, usage) = match entry.ty {
let expected_class = match entry.ty {
BindingType::Texture {
sample_type,
view_dimension: _,
multisampled: multi,
} => {
let class = match sample_type {
wgt::TextureSampleType::Float { .. } => naga::ImageClass::Sampled {
kind: naga::ScalarKind::Float,
multi,
},
wgt::TextureSampleType::Sint => naga::ImageClass::Sampled {
kind: naga::ScalarKind::Sint,
multi,
},
wgt::TextureSampleType::Uint => naga::ImageClass::Sampled {
kind: naga::ScalarKind::Uint,
multi,
},
wgt::TextureSampleType::Depth => naga::ImageClass::Depth { multi },
};
(class, GlobalUse::READ | GlobalUse::QUERY)
}
} => match sample_type {
wgt::TextureSampleType::Float { .. } => naga::ImageClass::Sampled {
kind: naga::ScalarKind::Float,
multi,
},
wgt::TextureSampleType::Sint => naga::ImageClass::Sampled {
kind: naga::ScalarKind::Sint,
multi,
},
wgt::TextureSampleType::Uint => naga::ImageClass::Sampled {
kind: naga::ScalarKind::Uint,
multi,
},
wgt::TextureSampleType::Depth => naga::ImageClass::Depth { multi },
},
BindingType::StorageTexture {
access,
format,
@ -510,26 +486,15 @@ impl Resource {
} => {
let naga_format = map_storage_format_to_naga(format)
.ok_or(BindingError::BadStorageFormat(format))?;
let (naga_access, usage) = match access {
wgt::StorageTextureAccess::ReadOnly => (
naga::StorageAccess::LOAD,
GlobalUse::READ | GlobalUse::QUERY,
),
wgt::StorageTextureAccess::WriteOnly => (
naga::StorageAccess::STORE,
GlobalUse::WRITE | GlobalUse::QUERY,
),
wgt::StorageTextureAccess::ReadWrite => {
(naga::StorageAccess::all(), GlobalUse::all())
}
let naga_access = match access {
wgt::StorageTextureAccess::ReadOnly => naga::StorageAccess::LOAD,
wgt::StorageTextureAccess::WriteOnly => naga::StorageAccess::STORE,
wgt::StorageTextureAccess::ReadWrite => naga::StorageAccess::all(),
};
(
naga::ImageClass::Storage {
format: naga_format,
access: naga_access,
},
usage,
)
naga::ImageClass::Storage {
format: naga_format,
access: naga_access,
}
}
_ => return Err(BindingError::WrongType),
};
@ -539,31 +504,19 @@ impl Resource {
shader: class,
});
}
usage
}
};
if allowed_usage.contains(shader_usage) {
Ok(())
} else {
Err(BindingError::WrongUsage {
required: shader_usage,
allowed: allowed_usage,
})
}
Ok(())
}
fn derive_binding_type(
&self,
shader_usage: GlobalUse,
features: wgt::Features,
) -> Result<BindingType, BindingError> {
fn derive_binding_type(&self) -> Result<BindingType, BindingError> {
Ok(match self.ty {
ResourceType::Buffer { size } => BindingType::Buffer {
ty: match self.class {
naga::AddressSpace::Uniform => wgt::BufferBindingType::Uniform,
naga::AddressSpace::Storage { .. } => wgt::BufferBindingType::Storage {
read_only: !shader_usage.contains(GlobalUse::WRITE),
naga::AddressSpace::Storage { access } => wgt::BufferBindingType::Storage {
read_only: access == naga::StorageAccess::LOAD,
},
_ => return Err(BindingError::WrongType),
},
@ -606,19 +559,15 @@ impl Resource {
view_dimension,
multisampled: multi,
},
naga::ImageClass::Storage { format, .. } => BindingType::StorageTexture {
access: if !shader_usage.contains(GlobalUse::READ) {
wgt::StorageTextureAccess::WriteOnly
} else if !features
.contains(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES)
{
return Err(BindingError::UnsupportedTextureStorageAccess(
shader_usage,
));
} else if shader_usage.contains(GlobalUse::WRITE) {
wgt::StorageTextureAccess::ReadWrite
} else {
wgt::StorageTextureAccess::ReadOnly
naga::ImageClass::Storage { format, access } => BindingType::StorageTexture {
access: {
const LOAD_STORE: naga::StorageAccess = naga::StorageAccess::all();
match access {
naga::StorageAccess::LOAD => wgt::StorageTextureAccess::ReadOnly,
naga::StorageAccess::STORE => wgt::StorageTextureAccess::WriteOnly,
LOAD_STORE => wgt::StorageTextureAccess::ReadWrite,
_ => unreachable!(),
}
},
view_dimension,
format: {
@ -880,12 +829,7 @@ impl Interface {
list.push(varying);
}
pub fn new(
module: &naga::Module,
info: &naga::valid::ModuleInfo,
features: wgt::Features,
limits: wgt::Limits,
) -> Self {
pub fn new(module: &naga::Module, info: &naga::valid::ModuleInfo, limits: wgt::Limits) -> Self {
let mut resources = naga::Arena::new();
let mut resource_mapping = FastHashMap::default();
for (var_handle, var) in module.global_variables.iter() {
@ -949,11 +893,8 @@ impl Interface {
for (var_handle, var) in module.global_variables.iter() {
let usage = info[var_handle];
if usage.is_empty() {
continue;
}
if var.binding.is_some() {
ep.resources.push((resource_mapping[&var_handle], usage));
if !usage.is_empty() && var.binding.is_some() {
ep.resources.push(resource_mapping[&var_handle]);
}
}
@ -968,7 +909,6 @@ impl Interface {
}
Self {
features,
limits,
resources,
entry_points,
@ -1000,7 +940,7 @@ impl Interface {
.ok_or(StageError::MissingEntryPoint(pair.1))?;
// check resources visibility
for &(handle, usage) in entry_point.resources.iter() {
for &handle in entry_point.resources.iter() {
let res = &self.resources[handle];
let result = match given_layouts {
Some(layouts) => {
@ -1026,13 +966,13 @@ impl Interface {
Err(BindingError::Invisible)
}
})
.and_then(|entry| res.check_binding_use(entry, usage))
.and_then(|entry| res.check_binding_use(entry))
}
None => derived_layouts
.get_mut(res.bind.group as usize)
.ok_or(BindingError::Missing)
.and_then(|set| {
let ty = res.derive_binding_type(usage, self.features)?;
let ty = res.derive_binding_type()?;
match set.entry(res.bind.binding) {
Entry::Occupied(e) if e.get().ty != ty => {
return Err(BindingError::InconsistentlyDerivedType)
@ -1237,72 +1177,3 @@ impl Interface {
Ok(outputs)
}
}
fn address_space_matches(shader: naga::AddressSpace, binding: naga::AddressSpace) -> bool {
match (shader, binding) {
(
naga::AddressSpace::Storage {
access: access_shader,
},
naga::AddressSpace::Storage {
access: access_pipeline,
},
) => {
// Allow read- and write-only usages to match read-write layouts:
(access_shader & access_pipeline) == access_shader
}
(a, b) => a == b,
}
}
#[cfg(test)]
mod test {
use super::address_space_matches;
#[test]
fn address_space_matches_correctly() {
assert!(address_space_matches(
naga::AddressSpace::Uniform,
naga::AddressSpace::Uniform
));
assert!(!address_space_matches(
naga::AddressSpace::Uniform,
naga::AddressSpace::Storage {
access: naga::StorageAccess::LOAD
}
));
let test_cases = [
(naga::StorageAccess::LOAD, naga::StorageAccess::LOAD, true),
(naga::StorageAccess::STORE, naga::StorageAccess::LOAD, false),
(naga::StorageAccess::LOAD, naga::StorageAccess::STORE, false),
(naga::StorageAccess::STORE, naga::StorageAccess::STORE, true),
(
naga::StorageAccess::LOAD | naga::StorageAccess::STORE,
naga::StorageAccess::LOAD | naga::StorageAccess::STORE,
true,
),
(
naga::StorageAccess::STORE,
naga::StorageAccess::LOAD | naga::StorageAccess::STORE,
true,
),
(
naga::StorageAccess::LOAD,
naga::StorageAccess::LOAD | naga::StorageAccess::STORE,
true,
),
];
for (shader, binding, expect_match) in test_cases {
assert_eq!(
expect_match,
address_space_matches(
naga::AddressSpace::Storage { access: shader },
naga::AddressSpace::Storage { access: binding }
)
);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.60"
name = "wgpu-hal"
version = "0.16.0"
version = "0.17.0"
authors = ["wgpu developers"]
description = "WebGPU hardware abstraction layer"
homepage = "https://wgpu.rs/"
@ -62,9 +62,9 @@ version = "0.12.3"
optional = true
[dependencies.naga]
version = "0.12.0"
version = "0.13.0"
git = "https://github.com/gfx-rs/naga"
rev = "409239c0e2313bfd0dc4fd64f8c3021185ccef1b"
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
features = ["clone"]
[dependencies.profiling]
@ -72,21 +72,24 @@ version = "1"
default-features = false
[dependencies.wgt]
version = "0.16"
version = "0.17"
path = "../wgpu-types"
package = "wgpu-types"
[dev-dependencies]
cfg-if = "1"
env_logger = "0.10"
winit = "0.27.1"
[dev-dependencies.naga]
version = "0.12.0"
version = "0.13.0"
git = "https://github.com/gfx-rs/naga"
rev = "409239c0e2313bfd0dc4fd64f8c3021185ccef1b"
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
features = ["wgsl-in"]
[dev-dependencies.winit]
version = "0.28.6"
features = ["android-native-activity"]
[features]
default = ["link"]
dx11 = [
@ -104,6 +107,7 @@ dx12 = [
"naga/hlsl-out",
"d3d12",
"bit-set",
"libloading",
"range-alloc",
"winapi/std",
"winapi/winbase",
@ -140,11 +144,11 @@ vulkan = [
windows_rs = ["gpu-allocator"]
[target."cfg(all(target_arch = \"wasm32\", not(target_os = \"emscripten\")))".dependencies]
js-sys = "0.3.63"
wasm-bindgen = "0.2.86"
js-sys = "0.3.64"
wasm-bindgen = "0.2.87"
[target."cfg(all(target_arch = \"wasm32\", not(target_os = \"emscripten\")))".dependencies.web-sys]
version = "0.3.61"
version = "0.3.64"
features = [
"Window",
"HtmlCanvasElement",
@ -161,8 +165,7 @@ version = "0.1"
optional = true
[target."cfg(any(target_os=\"macos\", target_os=\"ios\"))".dependencies.metal]
git = "https://github.com/gfx-rs/metal-rs.git"
rev = "a6a0446"
version = "0.26.0"
default_features = false
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.ash]

View File

@ -7,6 +7,7 @@ use super::result::HResult as _;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum DxgiFactoryType {
#[cfg(feature = "dx11")]
Factory1,
Factory2,
Factory4,

View File

@ -746,11 +746,13 @@ impl crate::Surface<Api> for Surface {
unsafe { swap_chain.SetMaximumFrameLatency(config.swap_chain_size) };
let waitable = unsafe { swap_chain.GetFrameLatencyWaitableObject() };
let mut resources = vec![d3d12::Resource::null(); config.swap_chain_size as usize];
for (i, res) in resources.iter_mut().enumerate() {
let mut resources = Vec::with_capacity(config.swap_chain_size as usize);
for i in 0..config.swap_chain_size {
let mut resource = d3d12::Resource::null();
unsafe {
swap_chain.GetBuffer(i as _, &d3d12_ty::ID3D12Resource::uuidof(), res.mut_void())
swap_chain.GetBuffer(i, &d3d12_ty::ID3D12Resource::uuidof(), resource.mut_void())
};
resources.push(resource);
}
self.swap_chain = Some(SwapChain {

View File

@ -606,7 +606,7 @@ impl super::Adapter {
// Drop the GL guard so we can move the context into AdapterShared
// ( on Wasm the gl handle is just a ref so we tell clippy to allow
// dropping the ref )
#[allow(clippy::drop_ref)]
#[cfg_attr(target_arch = "wasm32", allow(clippy::drop_ref))]
drop(gl);
Some(crate::ExposedAdapter {

View File

@ -49,10 +49,7 @@ impl super::CommandBuffer {
fn add_push_constant_data(&mut self, data: &[u32]) -> Range<u32> {
let data_raw = unsafe {
std::slice::from_raw_parts(
data.as_ptr() as *const _,
data.len() * mem::size_of::<u32>(),
)
std::slice::from_raw_parts(data.as_ptr() as *const _, mem::size_of_val(data))
};
let start = self.data_bytes.len();
assert!(start < u32::MAX as usize);

View File

@ -222,7 +222,7 @@ impl super::Device {
index: BoundsCheckPolicy::Unchecked,
buffer: BoundsCheckPolicy::Unchecked,
image_load: image_check,
image_store: image_check,
image_store: BoundsCheckPolicy::Unchecked,
binding_array: BoundsCheckPolicy::Unchecked,
};

View File

@ -60,7 +60,7 @@ pub mod dx12;
/// A dummy API implementation.
pub mod empty;
/// GLES API internals.
#[cfg(all(feature = "gles"))]
#[cfg(feature = "gles")]
pub mod gles;
/// Metal API internals.
#[cfg(all(feature = "metal", any(target_os = "macos", target_os = "ios")))]

View File

@ -100,7 +100,7 @@ impl super::Device {
index: bounds_check_policy,
buffer: bounds_check_policy,
image_load: bounds_check_policy,
image_store: bounds_check_policy,
image_store: naga::proc::BoundsCheckPolicy::Unchecked,
// TODO: support bounds checks on binding arrays
binding_array: naga::proc::BoundsCheckPolicy::Unchecked,
},

View File

@ -13,6 +13,7 @@ fn depth_stencil_required_flags() -> vk::FormatFeatureFlags {
fn indexing_features() -> wgt::Features {
wgt::Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING
| wgt::Features::UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING
| wgt::Features::PARTIALLY_BOUND_BINDING_ARRAY
}
/// Aggregate of the `vk::PhysicalDevice*Features` structs used by `gfx`.
@ -234,11 +235,11 @@ impl PhysicalDeviceFeatures {
robustness2: if enabled_extensions.contains(&vk::ExtRobustness2Fn::name()) {
// Note: enabling `robust_buffer_access2` isn't requires, strictly speaking
// since we can enable `robust_buffer_access` all the time. But it improves
// program portability, so we opt into it anyway.
// program portability, so we opt into it if they are supported.
Some(
vk::PhysicalDeviceRobustness2FeaturesEXT::builder()
.robust_buffer_access2(private_caps.robust_buffer_access)
.robust_image_access2(private_caps.robust_image_access)
.robust_buffer_access2(private_caps.robust_buffer_access2)
.robust_image_access2(private_caps.robust_image_access2)
.build(),
)
} else {
@ -720,7 +721,7 @@ impl PhysicalDeviceCapabilities {
max_bind_groups: limits
.max_bound_descriptor_sets
.min(crate::MAX_BIND_GROUPS as u32),
max_bindings_per_bind_group: 640,
max_bindings_per_bind_group: wgt::Limits::default().max_bindings_per_bind_group,
max_dynamic_uniform_buffers_per_pipeline_layout: limits
.max_descriptor_set_uniform_buffers_dynamic,
max_dynamic_storage_buffers_per_pipeline_layout: limits
@ -1063,6 +1064,16 @@ impl super::Instance {
.image_robustness
.map_or(false, |ext| ext.robust_image_access != 0),
},
robust_buffer_access2: phd_features
.robustness2
.as_ref()
.map(|r| r.robust_buffer_access2 == 1)
.unwrap_or_default(),
robust_image_access2: phd_features
.robustness2
.as_ref()
.map(|r| r.robust_image_access2 == 1)
.unwrap_or_default(),
zero_initialize_workgroup_memory: phd_features
.zero_initialize_workgroup_memory
.map_or(false, |ext| {
@ -1201,12 +1212,6 @@ impl super::Adapter {
None
};
let image_checks = if self.private_caps.robust_image_access {
naga::proc::BoundsCheckPolicy::Unchecked
} else {
naga::proc::BoundsCheckPolicy::Restrict
};
let naga_options = {
use naga::back::spv;
@ -1268,8 +1273,12 @@ impl super::Adapter {
} else {
naga::proc::BoundsCheckPolicy::Restrict
},
image_load: image_checks,
image_store: image_checks,
image_load: if self.private_caps.robust_image_access {
naga::proc::BoundsCheckPolicy::Unchecked
} else {
naga::proc::BoundsCheckPolicy::Restrict
},
image_store: naga::proc::BoundsCheckPolicy::Unchecked,
// TODO: support bounds checks on binding arrays
binding_array: naga::proc::BoundsCheckPolicy::Unchecked,
},

View File

@ -215,6 +215,8 @@ impl super::Instance {
if cfg!(target_os = "macos") {
// VK_EXT_metal_surface
extensions.push(ext::MetalSurface::name());
extensions
.push(CStr::from_bytes_with_nul(b"VK_KHR_portability_enumeration\0").unwrap());
}
if flags.contains(crate::InstanceFlags::DEBUG) {
@ -648,8 +650,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(vk::InstanceCreateFlags::empty())
.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()..]);

View File

@ -189,6 +189,8 @@ struct PrivateCapabilities {
non_coherent_map_mask: wgt::BufferAddress,
robust_buffer_access: bool,
robust_image_access: bool,
robust_buffer_access2: bool,
robust_image_access2: bool,
zero_initialize_workgroup_memory: bool,
}

View File

@ -1 +1 @@
{"files":{"Cargo.toml":"867246c956f8b7867ccc4b468c1d289e74392922ef6e7bf51e039effe71ee35a","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/assertions.rs":"3fe98027aa73970c8ab7874a3e13dbfd6faa87df2081beb5c83aeec4c60f372f","src/lib.rs":"5c7f5536fc144346ef36b9cb424ef580269d74da624fab341c51d6f5658f2b6d","src/math.rs":"4d03039736dd6926feb139bc68734cb59df34ede310427bbf059e5c925e0af3b"},"package":null}
{"files":{"Cargo.toml":"3e6c7a81b7f5b26b82b7a8a423eda073864e457083fe884b5ba53bda62e68cc9","LICENSE.APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE.MIT":"c7fea58d1cfe49634cd92e54fc10a9d871f4b275321a4cd8c09e449122caaeb4","src/assertions.rs":"3fe98027aa73970c8ab7874a3e13dbfd6faa87df2081beb5c83aeec4c60f372f","src/lib.rs":"a37ed56b53ef8dcd8e3420b25186b3a7416b951b234290e37887770e32ad7e61","src/math.rs":"4d03039736dd6926feb139bc68734cb59df34ede310427bbf059e5c925e0af3b"},"package":null}

View File

@ -12,7 +12,7 @@
[package]
edition = "2021"
name = "wgpu-types"
version = "0.16.0"
version = "0.17.0"
authors = ["wgpu developers"]
description = "WebGPU types"
homepage = "https://wgpu.rs/"
@ -44,7 +44,7 @@ features = ["serde_derive"]
optional = true
[dev-dependencies]
serde_json = "1.0.96"
serde_json = "1.0.104"
[dev-dependencies.serde]
version = "1"
@ -57,10 +57,10 @@ strict_asserts = []
trace = ["serde"]
[target."cfg(target_arch = \"wasm32\")".dependencies]
js-sys = "0.3.63"
js-sys = "0.3.64"
[target."cfg(target_arch = \"wasm32\")".dependencies.web-sys]
version = "0.3.60"
version = "0.3.64"
features = [
"ImageBitmap",
"HtmlVideoElement",

View File

@ -130,16 +130,18 @@ impl Backend {
/// Corresponds to [WebGPU `GPUPowerPreference`](
/// https://gpuweb.github.io/gpuweb/#enumdef-gpupowerpreference).
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)]
#[cfg_attr(feature = "trace", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
pub enum PowerPreference {
/// Adapter that uses the least possible power. This is often an integrated GPU.
#[default]
LowPower = 0,
/// Power usage is not considered when choosing an adapter.
None = 0,
/// Adapter that uses the least possible power. This is often an integrated GPU.
LowPower = 1,
/// Adapter that has the highest performance. This is often a discrete GPU.
HighPerformance = 1,
HighPerformance = 2,
}
bitflags::bitflags! {
@ -576,7 +578,7 @@ bitflags::bitflags! {
///
/// This is a native only feature.
const UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING = 1 << 39;
/// Allows the user to create bind groups continaing arrays with less bindings than the BindGroupLayout.
/// Allows the user to create bind groups containing arrays with less bindings than the BindGroupLayout.
///
/// This is a native only feature.
const PARTIALLY_BOUND_BINDING_ARRAY = 1 << 40;
@ -845,7 +847,7 @@ pub struct Limits {
pub max_texture_array_layers: u32,
/// Amount of bind groups that can be attached to a pipeline at the same time. Defaults to 4. Higher is "better".
pub max_bind_groups: u32,
/// Maximum binding index allowed in `create_bind_group_layout`. Defaults to 640.
/// Maximum binding index allowed in `create_bind_group_layout`. Defaults to 1000.
pub max_bindings_per_bind_group: u32,
/// Amount of uniform buffer bindings that can be dynamic in a single pipeline. Defaults to 8. Higher is "better".
pub max_dynamic_uniform_buffers_per_pipeline_layout: u32,
@ -929,7 +931,7 @@ impl Default for Limits {
max_texture_dimension_3d: 2048,
max_texture_array_layers: 256,
max_bind_groups: 4,
max_bindings_per_bind_group: 640,
max_bindings_per_bind_group: 1000,
max_dynamic_uniform_buffers_per_pipeline_layout: 8,
max_dynamic_storage_buffers_per_pipeline_layout: 4,
max_sampled_textures_per_shader_stage: 16,
@ -966,7 +968,7 @@ impl Limits {
max_texture_dimension_3d: 256,
max_texture_array_layers: 256,
max_bind_groups: 4,
max_bindings_per_bind_group: 640,
max_bindings_per_bind_group: 1000,
max_dynamic_uniform_buffers_per_pipeline_layout: 8,
max_dynamic_storage_buffers_per_pipeline_layout: 4,
max_sampled_textures_per_shader_stage: 16,
@ -1619,7 +1621,7 @@ impl BlendState {
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub struct ColorTargetState {
/// The [`TextureFormat`] of the image that this pipeline will render to. Must match the the format
/// The [`TextureFormat`] of the image that this pipeline will render to. Must match the format
/// of the corresponding color attachment in [`CommandEncoder::begin_render_pass`][CEbrp]
///
/// [CEbrp]: ../wgpu/struct.CommandEncoder.html#method.begin_render_pass
@ -3931,7 +3933,7 @@ impl Eq for DepthBiasState {}
#[cfg_attr(feature = "trace", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct DepthStencilState {
/// Format of the depth/stencil buffer, must be special depth format. Must match the the format
/// Format of the depth/stencil buffer, must be special depth format. Must match the format
/// of the depth/stencil attachment in [`CommandEncoder::begin_render_pass`][CEbrp].
///
/// [CEbrp]: ../wgpu/struct.CommandEncoder.html#method.begin_render_pass
@ -4584,6 +4586,10 @@ pub struct SurfaceCapabilities {
///
/// Will return at least one element, CompositeAlphaMode::Opaque or CompositeAlphaMode::Inherit.
pub alpha_modes: Vec<CompositeAlphaMode>,
/// Bitflag of supported texture usages for the surface to use with the given adapter.
///
/// The usage TextureUsages::RENDER_ATTACHMENT is guaranteed.
pub usages: TextureUsages,
}
impl Default for SurfaceCapabilities {
@ -4592,6 +4598,7 @@ impl Default for SurfaceCapabilities {
formats: Vec::new(),
present_modes: Vec::new(),
alpha_modes: vec![CompositeAlphaMode::Opaque],
usages: TextureUsages::RENDER_ATTACHMENT,
}
}
}
@ -4643,7 +4650,7 @@ impl<V: Clone> SurfaceConfiguration<V> {
}
}
/// Status of the recieved surface image.
/// Status of the received surface image.
#[repr(C)]
#[derive(Debug)]
pub enum SurfaceStatus {
@ -6302,9 +6309,9 @@ pub enum Dx12Compiler {
/// However, it requires both `dxcompiler.dll` and `dxil.dll` to be shipped with the application.
/// These files can be downloaded from <https://github.com/microsoft/DirectXShaderCompiler/releases>.
Dxc {
/// Path to the `dxcompiler.dll` file. Passing `None` will use standard platform specific dll loading rules.
/// Path to the `dxil.dll` file, or path to the directory containing `dxil.dll` file. Passing `None` will use standard platform specific dll loading rules.
dxil_path: Option<PathBuf>,
/// Path to the `dxil.dll` file. Passing `None` will use standard platform specific dll loading rules.
/// Path to the `dxcompiler.dll` file, or path to the directory containing `dxcompiler.dll` file. Passing `None` will use standard platform specific dll loading rules.
dxc_path: Option<PathBuf>,
},
}