Misc Repo Cleanup Tasks (#4579)

* Misc Repo Cleanup Tasks

* Dependency Trimming

* Dep cleanup

* Restrict libfuzzer

* Flip cfg

* mod fuzz
This commit is contained in:
Connor Fitzgerald 2023-10-27 00:15:51 -04:00 committed by GitHub
parent 61bca7e0aa
commit 2a9fdf9aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 353 additions and 651 deletions

View File

@ -1,13 +1,11 @@
[bans]
multiple-versions = "deny"
skip-tree = [
{ name = "cts_runner" },
{ name = "player" },
{ name = "wgpu-info" },
{ name = "windows-sys", version = "0.45" },
{ name = "winit", version = "0.27.5" },
{ name = "rustc_version", version = "0.2.3" },
]
skip = [
{ name = "wgpu" },
{ name = "fastrand" }
]
wildcards = "deny"
@ -27,6 +25,10 @@ allow = [
[sources]
allow-git = [
# Waiting on releases; used in examples only
"https://github.com/SiegeEngine/ddsfile",
"https://github.com/Razaekel/noise-rs",
"https://github.com/grovesNL/glow",
"https://github.com/gfx-rs/metal-rs",
]

View File

@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Issues with shaders
url: https://github.com/gfx-rs/naga/issues/new/choose
about: Issues with or enhancements for the shader translation.
- name: Question about wgpu
url: https://github.com/gfx-rs/wgpu/discussions/new
about: Any questions about how to use wgpu should go here.

255
Cargo.lock generated
View File

@ -223,35 +223,6 @@ dependencies = [
"libloading 0.7.4",
]
[[package]]
name = "async-executor"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0"
dependencies = [
"async-lock",
"async-task",
"concurrent-queue",
"fastrand 2.0.1",
"futures-lite",
"slab",
]
[[package]]
name = "async-lock"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
dependencies = [
"event-listener",
]
[[package]]
name = "async-task"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1"
[[package]]
name = "async-trait"
version = "0.1.74"
@ -588,15 +559,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642"
[[package]]
name = "concurrent-queue"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
@ -703,7 +665,7 @@ dependencies = [
"criterion-plot",
"is-terminal",
"itertools",
"num-traits 0.2.17",
"num-traits",
"once_cell",
"oorandom",
"plotters",
@ -864,13 +826,13 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "ddsfile"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "594ecd967c2f40db5dde8da4c356975fc1fe030e951c7c3962f6dc2e80042e87"
version = "0.5.2-unstable"
source = "git+https://github.com/SiegeEngine/ddsfile.git?rev=9b597930edc00502391cbb1a39708dadde0fd0ff#9b597930edc00502391cbb1a39708dadde0fd0ff"
dependencies = [
"bitflags 1.3.2",
"byteorder",
"enum_primitive",
"enum-primitive-derive",
"num-traits",
]
[[package]]
@ -1136,12 +1098,14 @@ dependencies = [
]
[[package]]
name = "enum_primitive"
version = "0.1.1"
name = "enum-primitive-derive"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180"
checksum = "c375b9c5eadb68d0a6efee2999fef292f45854c3444c86f09d8ab086ba942b0e"
dependencies = [
"num-traits 0.1.43",
"num-traits",
"quote",
"syn 1.0.109",
]
[[package]]
@ -1173,12 +1137,6 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "event-listener"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "expat-sys"
version = "2.1.6"
@ -1198,12 +1156,6 @@ dependencies = [
"instant",
]
[[package]]
name = "fastrand"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fdeflate"
version = "0.3.0"
@ -1333,9 +1285,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335"
dependencies = [
"futures-channel",
"futures-core",
@ -1348,9 +1300,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
dependencies = [
"futures-core",
"futures-sink",
@ -1358,15 +1310,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
[[package]]
name = "futures-executor"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
dependencies = [
"futures-core",
"futures-task",
@ -1386,9 +1338,9 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"
[[package]]
name = "futures-lite"
@ -1396,7 +1348,7 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
dependencies = [
"fastrand 1.9.0",
"fastrand",
"futures-core",
"futures-io",
"memchr",
@ -1407,9 +1359,9 @@ dependencies = [
[[package]]
name = "futures-macro"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
dependencies = [
"proc-macro2",
"quote",
@ -1418,21 +1370,21 @@ dependencies = [
[[package]]
name = "futures-sink"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
[[package]]
name = "futures-task"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
[[package]]
name = "futures-util"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
dependencies = [
"futures-channel",
"futures-core",
@ -1446,17 +1398,6 @@ dependencies = [
"slab",
]
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.10"
@ -1466,7 +1407,7 @@ dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasi",
"wasm-bindgen",
]
@ -1736,7 +1677,7 @@ dependencies = [
"byteorder",
"color_quant",
"num-rational",
"num-traits 0.2.17",
"num-traits",
"png",
]
@ -1866,6 +1807,17 @@ version = "0.2.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
[[package]]
name = "libfuzzer-sys"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7"
dependencies = [
"arbitrary",
"cc",
"once_cell",
]
[[package]]
name = "libloading"
version = "0.7.4"
@ -2010,7 +1962,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
dependencies = [
"libc",
"log",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasi",
"windows-sys 0.48.0",
]
@ -2030,7 +1982,7 @@ dependencies = [
"hlsl-snapshots",
"indexmap",
"log",
"num-traits 0.2.17",
"num-traits",
"petgraph",
"pp-rs",
"ron",
@ -2055,13 +2007,22 @@ dependencies = [
"naga",
]
[[package]]
name = "naga-fuzz"
version = "0.0.0"
dependencies = [
"arbitrary",
"libfuzzer-sys",
"naga",
]
[[package]]
name = "nanorand"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom 0.2.10",
"getrandom",
]
[[package]]
@ -2165,11 +2126,10 @@ dependencies = [
[[package]]
name = "noise"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ba869e17168793186c10ca82c7079a4ffdeac4f1a7d9e755b9491c028180e40"
source = "git+https://github.com/Razaekel/noise-rs.git?rev=c6942d4fb70af26db4441edcf41f90fa115333f2#c6942d4fb70af26db4441edcf41f90fa115333f2"
dependencies = [
"num-traits 0.2.17",
"rand 0.7.3",
"num-traits",
"rand",
"rand_xorshift",
]
@ -2191,8 +2151,8 @@ checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
"autocfg",
"num-integer",
"num-traits 0.2.17",
"rand 0.8.5",
"num-traits",
"rand",
]
[[package]]
@ -2202,7 +2162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits 0.2.17",
"num-traits",
]
[[package]]
@ -2213,16 +2173,7 @@ checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg",
"num-integer",
"num-traits 0.2.17",
]
[[package]]
name = "num-traits"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
dependencies = [
"num-traits 0.2.17",
"num-traits",
]
[[package]]
@ -2524,7 +2475,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45"
dependencies = [
"num-traits 0.2.17",
"num-traits",
"plotters-backend",
"plotters-svg",
"wasm-bindgen",
@ -2585,12 +2536,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "presser"
version = "0.3.1"
@ -2631,45 +2576,13 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
"rand_core",
]
[[package]]
@ -2678,22 +2591,13 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "rand_xorshift"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
dependencies = [
"rand_core 0.5.1",
"rand_core",
]
[[package]]
@ -2843,9 +2747,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.20"
version = "0.38.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
dependencies = [
"bitflags 2.4.1",
"errno",
@ -2944,9 +2848,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.189"
version = "1.0.190"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7"
dependencies = [
"serde_derive",
]
@ -2962,9 +2866,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.189"
version = "1.0.190"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
dependencies = [
"proc-macro2",
"quote",
@ -3130,7 +3034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830"
dependencies = [
"bitflags 1.3.2",
"num-traits 0.2.17",
"num-traits",
"serde",
]
@ -3487,7 +3391,7 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
dependencies = [
"getrandom 0.2.10",
"getrandom",
"serde",
]
@ -3537,12 +3441,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@ -3835,7 +3733,6 @@ dependencies = [
name = "wgpu-example"
version = "0.18.0"
dependencies = [
"async-executor",
"console_error_panic_hook",
"console_log",
"env_logger",
@ -4072,7 +3969,7 @@ dependencies = [
"console_log",
"env_logger",
"futures-intrusive",
"getrandom 0.2.10",
"getrandom",
"log",
"pollster",
"wasm-bindgen-futures",

View File

@ -5,9 +5,12 @@ members = [
"deno_webgpu",
# default members
"d3d12",
"examples/*",
"naga",
"naga-cli",
"naga",
"naga/fuzz",
"naga/hlsl-snapshots",
"player",
"tests",
"wgpu-core",
@ -17,13 +20,14 @@ members = [
"wgpu-types",
"wgpu",
]
exclude = [
"d3d12",
]
exclude = []
default-members = [
"d3d12",
"examples/*",
"naga",
"naga-cli",
"naga",
"naga/fuzz",
"naga/hlsl-snapshots",
"player",
"tests",
"wgpu-core",
@ -42,7 +46,7 @@ license = "MIT OR Apache-2.0"
homepage = "https://wgpu.rs/"
repository = "https://github.com/gfx-rs/wgpu"
version = "0.18.0"
authors = ["wgpu developers"]
authors = ["gfx-rs developers"]
[workspace.dependencies.wgc]
package = "wgpu-core"
@ -66,7 +70,6 @@ version = "0.14.0"
[workspace.dependencies]
anyhow = "1.0"
arrayvec = "0.7"
async-executor = "1"
bitflags = "2"
bit-vec = "0.6"
bytemuck = { version = "1.14", features = ["derive"] }
@ -74,7 +77,8 @@ cfg_aliases = "0.1"
cfg-if = "1"
codespan-reporting = "0.11"
ctor = "0.2"
ddsfile = "0.5"
# https://github.com/SiegeEngine/ddsfile/issues/15 (Updated dependencies)
ddsfile = { version = "0.5.2-unstable", git = "https://github.com/SiegeEngine/ddsfile.git", rev = "9b597930edc00502391cbb1a39708dadde0fd0ff" }
env_logger = "0.10"
flume = "0.11"
futures-lite = "1"
@ -91,7 +95,8 @@ log = "0.4"
nanorand = { version = "0.7", default-features = false, features = ["wyrand"] }
nv-flip = "0.1"
num-traits = { version = "0.2" }
noise = "0.8"
# https://github.com/Razaekel/noise-rs/issues/335 (Updated dependencies)
noise = { version = "0.8", git = "https://github.com/Razaekel/noise-rs.git", rev = "c6942d4fb70af26db4441edcf41f90fa115333f2" }
obj = "0.10"
once_cell = "1"
# parking_lot 0.12 switches from `winapi` to `windows`; permit either
@ -163,7 +168,7 @@ deno_core = "0.214.0"
deno_url = "0.119.0"
deno_web = "0.150.0"
deno_webidl = "0.119.0"
deno_webgpu = { path = "./deno_webgpu" }
deno_webgpu = { version = "0.85.0", path = "./deno_webgpu" }
tokio = "1.33.0"
termcolor = "1.3.0"

View File

@ -21,6 +21,7 @@ The repository hosts the following libraries:
- [![Crates.io](https://img.shields.io/crates/v/wgpu-hal.svg?label=wgpu-hal)](https://crates.io/crates/wgpu-hal) [![docs.rs](https://docs.rs/wgpu-hal/badge.svg)](https://docs.rs/wgpu-hal/) - Internal unsafe GPU API abstraction layer.
- [![Crates.io](https://img.shields.io/crates/v/wgpu-types.svg?label=wgpu-types)](https://crates.io/crates/wgpu-types) [![docs.rs](https://docs.rs/wgpu-types/badge.svg)](https://docs.rs/wgpu-types/) - Rust types shared between all crates.
- [![Crates.io](https://img.shields.io/crates/v/naga.svg?label=naga)](https://crates.io/crates/naga) [![docs.rs](https://docs.rs/naga/badge.svg)](https://docs.rs/naga/) - Stand-alone shader translation library.
- [![Crates.io](https://img.shields.io/crates/v/d3d12.svg?label=d3d12)](https://crates.io/crates/d3d12) [![docs.rs](https://docs.rs/d3d12/badge.svg)](https://docs.rs/d3d12/) - Collection of thin abstractions over d3d12.
- [![Crates.io](https://img.shields.io/crates/v/deno_webgpu.svg?label=deno_webgpu)](https://crates.io/crates/deno_webgpu) - WebGPU implementation for the Deno JavaScript/TypeScript runtime
The following binaries:
@ -120,7 +121,7 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
### MSRV policy
Due to complex dependants, we have two MSRV policies:
- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**.
- `d3d12`, `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**.
- The rest of the workspace has the MSRV of **1.70**.
It is enforced on CI (in "/.github/workflows/ci.yml") with `CORE_MSRV` and `REPO_MSRV` variable.

12
d3d12/.gitignore vendored
View File

@ -1,12 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
.idea/

View File

@ -1,28 +1,45 @@
[package]
name = "d3d12"
version = "0.7.0"
authors = [
"gfx-rs developers",
]
authors = ["gfx-rs developers"]
description = "Low level D3D12 API wrapper"
repository = "https://github.com/gfx-rs/d3d12-rs"
repository = "https://github.com/gfx-rs/wgpu/tree/trunk/d3d12"
keywords = ["windows", "graphics"]
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/d3d12"
categories = ["api-bindings", "graphics", "memory-management", "os::windows-apis"]
categories = [
"api-bindings",
"graphics",
"memory-management",
"os::windows-apis",
]
edition = "2018"
[features]
implicit-link = []
[dependencies]
[target.'cfg(windows)'.dependencies]
bitflags = "2"
# libloading 0.8 switches from `winapi` to `windows-sys`; permit either
libloading = { version = ">=0.7,<0.9", optional = true }
[dependencies.winapi]
[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
features = ["dxgi1_2","dxgi1_3","dxgi1_4","dxgi1_5","dxgi1_6","dxgidebug","d3d12","d3d12sdklayers","d3dcommon","d3dcompiler","dxgiformat","synchapi","winerror"]
features = [
"dxgi1_2",
"dxgi1_3",
"dxgi1_4",
"dxgi1_5",
"dxgi1_6",
"dxgidebug",
"d3d12",
"d3d12sdklayers",
"d3dcommon",
"d3dcompiler",
"dxgiformat",
"synchapi",
"winerror",
]
[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
targets = ["x86_64-pc-windows-msvc"]

View File

@ -1,6 +1,5 @@
# d3d12-rs
[![Crates.io](https://img.shields.io/crates/v/d3d12.svg)](https://crates.io/crates/d3d12)
[![Docs.rs](https://docs.rs/d3d12/badge.svg)](https://docs.rs/d3d12)
[![Matrix](https://img.shields.io/matrix/gfx:matrix.org)](https://matrix.to/#/#gfx:matrix.org)
Rust wrapper for raw D3D12 access.

View File

@ -1,29 +0,0 @@
skip_branch_with_pr: true
branches:
except:
- staging.tmp
environment:
global:
PATH: '%PATH%;C:\msys64\mingw64\bin;C:\msys64\usr\bin;%USERPROFILE%\.cargo\bin'
RUST_BACKTRACE: full
matrix:
- CHANNEL: stable
TARGET: x86_64-pc-windows-msvc
skip_commits:
files:
- bors.toml
- '*.md'
install:
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- rustup-init -yv --default-toolchain %CHANNEL% --default-host %TARGET%
- rustc -vV
- cargo -vV
build: false
test_script:
- cargo check
- cargo check --features libloading
- cargo check --features implicit-link
- cargo check --all-features

View File

@ -1,5 +0,0 @@
status = [
"continuous-integration/appveyor/branch"
]
timeout_sec = 18000 # 5 hours

View File

View File

@ -17,7 +17,7 @@ impl<T: Interface> ComPtr<T> {
pub unsafe fn from_raw(raw: *mut T) -> Self {
if !raw.is_null() {
(&*(raw as *mut IUnknown)).AddRef();
(*(raw as *mut IUnknown)).AddRef();
}
ComPtr(raw)
}
@ -65,7 +65,9 @@ impl<T: Interface> ComPtr<T> {
impl<T: Interface> Clone for ComPtr<T> {
fn clone(&self) -> Self {
debug_assert!(!self.is_null());
unsafe { self.as_unknown().AddRef(); }
unsafe {
self.as_unknown().AddRef();
}
ComPtr(self.0)
}
}
@ -73,7 +75,9 @@ impl<T: Interface> Clone for ComPtr<T> {
impl<T: Interface> Drop for ComPtr<T> {
fn drop(&mut self) {
if !self.0.is_null() {
unsafe { self.as_unknown().Release(); }
unsafe {
self.as_unknown().Release();
}
}
}
}

View File

@ -19,7 +19,7 @@ pub enum CmdListType {
// VideoProcess = d3d12::D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS,
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClearFlags: u32 {
const DEPTH = d3d12::D3D12_CLEAR_FLAG_DEPTH;

View File

@ -20,7 +20,7 @@ pub enum DescriptorHeapType {
Dsv = d3d12::D3D12_DESCRIPTOR_HEAP_TYPE_DSV,
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DescriptorHeapFlags: u32 {
const SHADER_VISIBLE = d3d12::D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
@ -253,7 +253,7 @@ pub enum RootSignatureVersion {
V1_1 = d3d12::D3D_ROOT_SIGNATURE_VERSION_1_1,
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RootSignatureFlags: u32 {
const ALLOW_IA_INPUT_LAYOUT = d3d12::D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;

View File

@ -9,7 +9,7 @@ use winapi::{
Interface,
};
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FactoryCreationFlags: u32 {
const DEBUG = dxgi1_3::DXGI_CREATE_FACTORY_DEBUG;
@ -336,7 +336,7 @@ impl FactoryMedia {
}
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SwapChainPresentFlags: u32 {
const DXGI_PRESENT_DO_NOT_SEQUENCE = dxgi::DXGI_PRESENT_DO_NOT_SEQUENCE;

View File

@ -29,7 +29,7 @@ pub enum MemoryPool {
L1 = d3d12::D3D12_MEMORY_POOL_L1,
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HeapFlags: u32 {
const NONE = d3d12::D3D12_HEAP_FLAG_NONE;

View File

@ -1,5 +1,9 @@
#[macro_use]
extern crate bitflags;
#![cfg(windows)]
#![allow(
clippy::missing_safety_doc,
clippy::too_many_arguments,
clippy::not_unsafe_ptr_arg_deref
)]
use std::{convert::TryFrom, ffi::CStr};
use winapi::{

View File

@ -1,17 +1,22 @@
//! Pipeline state
use crate::{com::ComPtr, Blob, D3DResult, Error};
use std::{ffi::{self, c_void}, ops::Deref, ptr, marker::PhantomData};
use std::{
ffi::{self, c_void},
marker::PhantomData,
ops::Deref,
ptr,
};
use winapi::um::{d3d12, d3dcompiler};
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PipelineStateFlags: u32 {
const TOOL_DEBUG = d3d12::D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG;
}
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ShaderCompileFlags: u32 {
const DEBUG = d3dcompiler::D3DCOMPILE_DEBUG;
@ -28,25 +33,34 @@ bitflags! {
pub struct Shader<'a>(d3d12::D3D12_SHADER_BYTECODE, PhantomData<&'a c_void>);
impl<'a> Shader<'a> {
pub fn null() -> Self {
Shader(d3d12::D3D12_SHADER_BYTECODE {
Shader(
d3d12::D3D12_SHADER_BYTECODE {
BytecodeLength: 0,
pShaderBytecode: ptr::null(),
}, PhantomData)
},
PhantomData,
)
}
pub fn from_raw(data: &'a [u8]) -> Self {
Shader(d3d12::D3D12_SHADER_BYTECODE {
Shader(
d3d12::D3D12_SHADER_BYTECODE {
BytecodeLength: data.len() as _,
pShaderBytecode: data.as_ptr() as _,
}, PhantomData)
},
PhantomData,
)
}
// `blob` may not be null.
pub fn from_blob(blob: &'a Blob) -> Self {
Shader(d3d12::D3D12_SHADER_BYTECODE {
Shader(
d3d12::D3D12_SHADER_BYTECODE {
BytecodeLength: unsafe { blob.GetBufferSize() },
pShaderBytecode: unsafe { blob.GetBufferPointer() },
}, PhantomData)
},
PhantomData,
)
}
/// Compile a shader from raw HLSL.
@ -92,18 +106,24 @@ impl<'a> Deref for Shader<'a> {
pub struct CachedPSO<'a>(d3d12::D3D12_CACHED_PIPELINE_STATE, PhantomData<&'a c_void>);
impl<'a> CachedPSO<'a> {
pub fn null() -> Self {
CachedPSO(d3d12::D3D12_CACHED_PIPELINE_STATE {
CachedPSO(
d3d12::D3D12_CACHED_PIPELINE_STATE {
CachedBlobSizeInBytes: 0,
pCachedBlob: ptr::null(),
}, PhantomData)
},
PhantomData,
)
}
// `blob` may not be null.
pub fn from_blob(blob: &'a Blob) -> Self {
CachedPSO(d3d12::D3D12_CACHED_PIPELINE_STATE {
CachedPSO(
d3d12::D3D12_CACHED_PIPELINE_STATE {
CachedBlobSizeInBytes: unsafe { blob.GetBufferSize() },
pCachedBlob: unsafe { blob.GetBufferPointer() },
}, PhantomData)
},
PhantomData,
)
}
}

View File

@ -8,7 +8,7 @@ pub enum Priority {
GlobalRealtime = d3d12::D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME,
}
bitflags! {
bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CommandQueueFlags: u32 {
const DISABLE_GPU_TIMEOUT = d3d12::D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT;

View File

@ -40,6 +40,7 @@ workspace = true
features = ["dx11", "dx12"]
[target.'cfg(windows)'.dependencies.wgpu-hal]
version = "0.18.0"
path = "../wgpu-hal"
features = ["windows_rs"]

View File

@ -14,10 +14,12 @@ harness = false
[dependencies]
bytemuck.workspace = true
nanorand.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-test.workspace = true
[dev-dependencies]
wgpu-test.workspace = true

View File

@ -261,13 +261,7 @@ impl wgpu_example::framework::Example for Example {
/// render is called each frame, dispatching compute groups proportional
/// a TriangleList draw call for all NUM_PARTICLES at 3 vertices each
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
// create render pass descriptor and its color attachments
let color_attachments = [Some(wgpu::RenderPassColorAttachment {
view,

View File

@ -16,10 +16,12 @@ bytemuck.workspace = true
nanorand.workspace = true
glam.workspace = true
png.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -286,13 +286,7 @@ impl wgpu_example::framework::Example for Example {
//empty
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let delta = 0.01;
for bunny in self.bunnies.iter_mut() {
bunny.position[0] += bunny.velocity[0] * delta;

View File

@ -19,9 +19,6 @@ winit.workspace = true
wgpu.workspace = true
wgpu-test.workspace = true
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
async-executor.workspace = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook.workspace = true
console_log.workspace = true

View File

@ -1,4 +1,3 @@
use std::future::Future;
#[cfg(target_arch = "wasm32")]
use std::str::FromStr;
#[cfg(not(target_arch = "wasm32"))]
@ -58,13 +57,7 @@ pub trait Example: 'static + Sized {
queue: &wgpu::Queue,
);
fn update(&mut self, event: WindowEvent);
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
spawner: &Spawner,
);
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue);
}
struct Setup {
@ -273,7 +266,6 @@ fn start<E: Example>(
offscreen_canvas_setup,
}: Setup,
) {
let spawner = Spawner::new();
let mut config = surface
.get_default_config(&adapter, size.width, size.height)
.expect("Surface isn't supported by the adapter.");
@ -299,9 +291,6 @@ fn start<E: Example>(
};
match event {
event::Event::RedrawEventsCleared => {
#[cfg(not(target_arch = "wasm32"))]
spawner.run_until_stalled();
window.request_redraw();
}
event::Event::WindowEvent {
@ -378,7 +367,7 @@ fn start<E: Example>(
..wgpu::TextureViewDescriptor::default()
});
example.render(&view, &device, &queue, &spawner);
example.render(&view, &device, &queue);
frame.present();
@ -402,44 +391,6 @@ fn start<E: Example>(
});
}
#[cfg(not(target_arch = "wasm32"))]
pub struct Spawner<'a> {
executor: async_executor::LocalExecutor<'a>,
}
#[cfg(not(target_arch = "wasm32"))]
impl<'a> Spawner<'a> {
fn new() -> Self {
Self {
executor: async_executor::LocalExecutor::new(),
}
}
#[allow(dead_code)]
pub fn spawn_local(&self, future: impl Future<Output = ()> + 'a) {
self.executor.spawn(future).detach();
}
fn run_until_stalled(&self) {
while self.executor.try_tick() {}
}
}
#[cfg(target_arch = "wasm32")]
pub struct Spawner {}
#[cfg(target_arch = "wasm32")]
impl Spawner {
fn new() -> Self {
Self {}
}
#[allow(dead_code)]
pub fn spawn_local(&self, future: impl Future<Output = ()> + 'static) {
wasm_bindgen_futures::spawn_local(future);
}
}
#[cfg(not(target_arch = "wasm32"))]
pub fn run<E: Example>(title: &str) {
let setup = pollster::block_on(setup::<E>(title));
@ -561,8 +512,7 @@ impl<E: Example + WasmNotSend + WasmNotSync> From<ExampleTestParams<E>> for GpuT
);
{
let spawner = Spawner::new();
example.render(&dst_view, &ctx.device, &ctx.queue, &spawner);
example.render(&dst_view, &ctx.device, &ctx.queue);
// Handle specific case for bunnymark
#[allow(deprecated)]
@ -581,7 +531,7 @@ impl<E: Example + WasmNotSend + WasmNotSync> From<ExampleTestParams<E>> for GpuT
// Step 3 extra frames
for _ in 0..3 {
example.render(&dst_view, &ctx.device, &ctx.queue, &spawner);
example.render(&dst_view, &ctx.device, &ctx.queue);
}
}
}

View File

@ -12,10 +12,12 @@ path = "src/main.rs"
harness = false
[dependencies]
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -250,13 +250,7 @@ impl wgpu_example::framework::Example for Example {
fn update(&mut self, _event: winit::event::WindowEvent) {}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor {
label: Some("primary"),
});

View File

@ -14,10 +14,12 @@ harness = false
[dependencies]
bytemuck.workspace = true
glam.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-test.workspace = true
[dev-dependencies]
wgpu-test.workspace = true

View File

@ -1,5 +1,5 @@
use bytemuck::{Pod, Zeroable};
use std::{borrow::Cow, f32::consts, future::Future, mem, pin::Pin, task};
use std::{borrow::Cow, f32::consts, mem};
use wgpu::util::DeviceExt;
#[repr(C)]
@ -80,28 +80,6 @@ fn create_texels(size: usize) -> Vec<u8> {
.collect()
}
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
///
/// Given a future `inner` of an `Option<E>` for some error type `E`,
/// wait for the future to be ready, and panic if its value is `Some`.
///
/// This can be done simpler with `FutureExt`, but we don't want to add
/// a dependency just for this small case.
struct ErrorFuture<F> {
inner: F,
}
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
inner.poll(cx).map(|error| {
if let Some(e) = error {
panic!("Rendering {e}");
}
})
}
}
struct Example {
vertex_buf: wgpu::Buffer,
index_buf: wgpu::Buffer,
@ -352,14 +330,7 @@ impl wgpu_example::framework::Example for Example {
queue.write_buffer(&self.uniform_buf, 0, bytemuck::cast_slice(mx_ref));
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
spawner: &wgpu_example::framework::Spawner,
) {
device.push_error_scope(wgpu::ErrorFilter::Validation);
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let mut encoder =
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
{
@ -397,11 +368,6 @@ impl wgpu_example::framework::Example for Example {
}
queue.submit(Some(encoder.finish()));
// If an error occurs, report it and panic.
spawner.spawn_local(ErrorFuture {
inner: device.pop_error_scope(),
});
}
}

View File

@ -26,5 +26,7 @@ log.workspace = true
wasm-bindgen-futures.workspace = true
[dev-dependencies]
wasm-bindgen-test.workspace = true
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -27,5 +27,7 @@ wasm-bindgen-futures.workspace = true
web-sys = { workspace = true, features = ["Document"] }
[dev-dependencies]
wasm-bindgen-test.workspace = true
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -14,10 +14,12 @@ harness = false
[dependencies]
bytemuck.workspace = true
glam.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -467,13 +467,7 @@ impl wgpu_example::framework::Example for Example {
queue.write_buffer(&self.uniform_buf, 0, bytemuck::cast_slice(mx_ref));
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let mut encoder =
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
{

View File

@ -15,7 +15,6 @@ harness = false
bytemuck.workspace = true
glam.workspace = true
log.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
@ -23,3 +22,5 @@ winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -251,13 +251,7 @@ impl wgpu_example::framework::Example for Example {
Example::create_multisampled_framebuffer(device, config, self.sample_count);
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
if self.rebuild_bundle {
self.bundle = Example::create_bundle(
device,

View File

@ -27,5 +27,7 @@ wasm-bindgen-futures.workspace = true
web-sys = { workspace = true, features = ["Document"] }
[dev-dependencies]
wasm-bindgen-test.workspace = true
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -14,7 +14,6 @@ harness = false
[dependencies]
bytemuck.workspace = true
glam.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
@ -22,3 +21,5 @@ winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -703,13 +703,7 @@ impl wgpu_example::framework::Example for Example {
self.forward_depth = Self::create_depth_texture(config, device);
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
// update uniforms
for entity in self.entities.iter_mut() {
if entity.rotation_speed != 0.0 {

View File

@ -17,10 +17,12 @@ ddsfile.workspace = true
glam.workspace = true
obj.workspace = true
log.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -391,13 +391,7 @@ impl wgpu_example::framework::Example for Example {
self.camera.screen_size = (config.width, config.height);
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let mut encoder =
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });

View File

@ -13,10 +13,12 @@ harness = false
[dependencies]
bytemuck.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -177,13 +177,7 @@ impl wgpu_example::framework::Example for Example {
// empty
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let mut encoder =
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
{

View File

@ -33,5 +33,7 @@ web-sys = { workspace = true, features = [
] }
[dev-dependencies]
wasm-bindgen-test.workspace = true
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -13,10 +13,12 @@ harness = false
[dependencies]
bytemuck.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -361,13 +361,7 @@ impl wgpu_example::framework::Example for Example {
fn update(&mut self, _event: winit::event::WindowEvent) {
// noop
}
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor {
label: Some("primary"),
});

View File

@ -26,6 +26,7 @@ log.workspace = true
wasm-bindgen-futures.workspace = true
[dev-dependencies]
wasm-bindgen-test.workspace = true
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -16,10 +16,12 @@ bytemuck.workspace = true
nanorand.workspace = true
glam.workspace = true
noise.workspace = true
wasm-bindgen-test.workspace = true
wgpu-example.workspace = true
wgpu.workspace = true
winit.workspace = true
[dev-dependencies]
wgpu-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test.workspace = true

View File

@ -691,13 +691,7 @@ impl wgpu_example::framework::Example for Example {
}
#[allow(clippy::eq_op)]
fn render(
&mut self,
view: &wgpu::TextureView,
device: &wgpu::Device,
queue: &wgpu::Queue,
_spawner: &wgpu_example::framework::Spawner,
) {
fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
// Increment frame count regardless of if we draw.
self.current_frame += 1;
let back_color = wgpu::Color {

View File

@ -1,11 +1,10 @@
[package]
name = "naga-cli"
version = "0.14.0"
authors = ["Naga Developers"]
authors = ["gfx-rs developers"]
edition = "2021"
description = "Shader translation command line tool"
homepage = "https://github.com/gfx-rs/naga"
repository = "https://github.com/gfx-rs/naga"
repository = "https://github.com/gfx-rs/wgpu/tree/trunk/naga-cli"
keywords = ["shader", "SPIR-V", "GLSL", "MSL"]
license = "MIT OR Apache-2.0"

View File

@ -1,94 +0,0 @@
name: CI
on: [push, pull_request]
env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
MSRV: 1.65
jobs:
check-msrv:
name: Check MSRV and minimal-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install MSRV toolchain
run: rustup toolchain install $MSRV --no-self-update --profile=minimal --component clippy
- name: Install nightly toolchain
run: rustup toolchain install nightly --no-self-update --profile=minimal
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
# -Z avoid-dev-deps doesn't work
- run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z minimal-versions
- name: Test all features
run: cargo +$MSRV clippy --all-features --workspace -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Default test
# Our intention here is to test `naga` with no features enabled. But
# since `cli` is the default package, a plain `cargo test` will build
# `naga` with the features requested in `cli/Cargo.toml`. Passing
# `--package naga` causes us to use the default features in the
# top-level `Cargo.toml` instead.
run: cargo nextest run --package naga
- name: Test all features
run: cargo llvm-cov --lcov --output-path lcov.info nextest --all-features --workspace
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
- name: Check snapshots
run: git diff --exit-code -- tests/out
check:
name: Check benchmarks and naga-fuzz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check benchmarks
run: cargo check --benches
- name: Check naga-fuzz
run: |
cd fuzz
cargo check
documentation:
name: Documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v3
- run: cargo doc -p naga --all-features --document-private-items
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo fmt -- --check

View File

@ -1,11 +1,10 @@
[package]
name = "naga"
version = "0.14.0"
authors = ["Naga Developers"]
authors = ["gfx-rs developers"]
edition = "2021"
description = "Shader translation infrastructure"
homepage = "https://github.com/gfx-rs/naga"
repository = "https://github.com/gfx-rs/naga"
repository = "https://github.com/gfx-rs/wgpu/tree/trunk/naga"
keywords = ["shader", "SPIR-V", "GLSL", "MSL"]
license = "MIT OR Apache-2.0"
exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"]
@ -66,7 +65,7 @@ criterion = { version = "0.5", features = [] }
bincode = "1"
diff = "0.1"
env_logger = "0.10"
hlsl-snapshots = { path = "./hlsl-snapshots" }
hlsl-snapshots = { version = "0.1.0", path = "./hlsl-snapshots" }
# Require at least version 0.7.1 of ron, this version changed how floating points are
# serialized by forcing them to always have the decimal part, this makes it backwards
# incompatible with our tests because we do a syntatic diff and not a semantic one.

View File

@ -9,18 +9,15 @@ license = "MIT OR Apache-2.0"
[package.metadata]
cargo-fuzz = true
[dependencies]
[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies]
arbitrary = { version = "1.0.2", features = ["derive"] }
libfuzzer-sys = "0.4"
[dependencies.naga]
[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies.naga]
path = ".."
version = "0.14.0"
features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in", "validate"]
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "spv_parser"
path = "fuzz_targets/spv_parser.rs"

View File

@ -1,4 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
mod fuzz {
use arbitrary::Arbitrary;
use libfuzzer_sys::fuzz_target;
use naga::{
@ -44,3 +46,4 @@ fuzz_target!(|data: (OptionsProxy, String)| {
let mut parser = Frontend::default();
let _result = parser.parse(&options.into(), &source);
});
}

View File

@ -1,10 +1,14 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
mod fuzz {
use libfuzzer_sys::fuzz_target;
fuzz_target!(|module: naga::Module| {
use naga::valid as v;
// Check if the module validates without errors.
//TODO: may also fuzz the flags and capabilities
let mut validator = v::Validator::new(v::ValidationFlags::all(), v::Capabilities::default());
let mut validator =
v::Validator::new(v::ValidationFlags::all(), v::Capabilities::default());
let _result = validator.validate(&module);
});
}

View File

@ -1,4 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
mod fuzz {
use libfuzzer_sys::fuzz_target;
use naga::front::spv::{Frontend, Options};
@ -7,3 +9,4 @@ fuzz_target!(|data: Vec<u32>| {
let options = Options::default();
let _result = Frontend::new(data.into_iter(), &options).parse();
});
}

View File

@ -1,4 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
mod fuzz {
use libfuzzer_sys::fuzz_target;
use naga::front::wgsl::Frontend;
@ -6,3 +8,4 @@ fuzz_target!(|data: String| {
// Ensure the parser can handle potentially malformed strings without crashing.
let _result = Frontend::new().parse(&data);
});
}

View File

@ -55,11 +55,11 @@ web-sys = { workspace = true }
[dev-dependencies]
naga = { workspace = true, features = ["wgsl-in"] }
wasm-bindgen-test.workspace = true
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
image.workspace = true
js-sys.workspace = true
wasm-bindgen-futures.workspace = true
wasm-bindgen-test.workspace = true
wasm-bindgen.workspace = true
web-sys = { workspace = true, features = ["CanvasRenderingContext2d", "Blob"] }

View File

@ -10,9 +10,13 @@ cfg_if::cfg_if! {
// even with the `fragile-send-sync-non-atomic-wasm` enabled.
pub trait RunTestSendSync {}
impl<T> RunTestSendSync for T {}
pub trait RunTestSend {}
impl<T> RunTestSend for T {}
} else {
pub type RunTestAsync = Arc<dyn Fn(TestingContext) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>> + Send + Sync>;
pub type RunTestAsync = Arc<dyn Fn(TestingContext) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>;
pub trait RunTestSend: Send {}
impl<T> RunTestSend for T where T: Send {}
pub trait RunTestSendSync: Send + Sync {}
impl<T> RunTestSendSync for T where T: Send + Sync {}
}
@ -97,7 +101,7 @@ impl GpuTestConfiguration {
pub fn run_async<F, R>(self, test: F) -> Self
where
F: Fn(TestingContext) -> R + RunTestSendSync + 'static,
R: Future<Output = ()> + RunTestSendSync + 'static,
R: Future<Output = ()> + RunTestSend + 'static,
{
Self {
test: Some(Arc::new(move |ctx| Box::pin(test(ctx)))),

View File

@ -11,7 +11,7 @@ use crate::{
config::GpuTestConfiguration, params::TestInfo, report::AdapterReport, run::execute_test,
};
type NativeTestFuture = Pin<Box<dyn Future<Output = ()> + Send + Sync>>;
type NativeTestFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
struct NativeTest {
name: String,

View File

@ -27,15 +27,14 @@ static CROSS_DEVICE_BIND_GROUP_USAGE: GpuTestConfiguration = GpuTestConfiguratio
});
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[test]
fn request_device_error_on_native() {
pollster::block_on(request_device_error_message());
}
#[gpu_test]
static REQUEST_DEVICE_ERROR_MESSAGE_NATIVE: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|_ctx| request_device_error_message());
/// Check that `RequestDeviceError`s produced have some diagnostic information.
///
/// Note: this is a wasm *and* native test. On wasm it is run directly; on native, indirectly
#[wasm_bindgen_test::wasm_bindgen_test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
async fn request_device_error_message() {
// Not using initialize_test() because that doesn't let us catch the error
// nor .await anything

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-core"
version = "0.18.0"
authors = ["wgpu developers"]
authors = ["gfx-rs developers"]
edition = "2021"
description = "WebGPU core logic on wgpu-hal"
homepage = "https://wgpu.rs/"

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-hal"
version = "0.18.0"
authors = ["wgpu developers"]
authors = ["gfx-rs developers"]
edition = "2021"
description = "WebGPU hardware abstraction layer"
homepage = "https://wgpu.rs/"
@ -138,7 +138,9 @@ winapi = { version = "0.3", features = [
"winuser",
"dcomp",
] }
d3d12 = { path = "../d3d12/", features = ["libloading"], optional = true }
d3d12 = { path = "../d3d12/", version = "0.7.0", optional = true, features = [
"libloading",
] }
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
# backend: Metal

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-types"
version = "0.18.0"
authors = ["wgpu developers"]
authors = ["gfx-rs developers"]
edition = "2021"
description = "WebGPU types"
homepage = "https://wgpu.rs/"