From c36ad13ca924579c2861fc5b78057b2698e9805e Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 30 Apr 2021 01:38:49 -0400 Subject: [PATCH] Update gfx, implement support for ImageView Info struct --- .github/workflows/check.yml | 5 +- Cargo.lock | 317 ++++++++++++++++--------------- Cargo.toml | 3 + libportability-gfx/Cargo.toml | 18 +- libportability-gfx/src/handle.rs | 9 +- libportability-gfx/src/impls.rs | 48 ++++- libportability-gfx/src/lib.rs | 15 ++ 7 files changed, 241 insertions(+), 174 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 865caeb..2810e17 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,7 +2,7 @@ name: Check on: push: - branches-ignore: [staging.tmp] + branches: [master, staging] pull_request: branches-ignore: [staging.tmp] @@ -71,3 +71,6 @@ jobs: name: Install make run: choco install make - run: make all + - if: matrix.channel == 'nightly' + name: Check nightly feature + run: cd libportability-gfx && cargo check --features nightly diff --git a/Cargo.lock b/Cargo.lock index ea5c279..a4a56d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] @@ -23,11 +23,11 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "ash" -version = "0.31.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38" +checksum = "06063a002a77d2734631db74e8f4ce7148b77fe522e6bca46f2ae7774fd48112" dependencies = [ - "libloading 0.6.5", + "libloading 0.7.0", ] [[package]] @@ -58,9 +58,9 @@ dependencies = [ [[package]] name = "bit-vec" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" @@ -76,31 +76,25 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.61" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" dependencies = [ "jobserver", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -117,15 +111,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "cocoa" version = "0.14.0" @@ -221,8 +206,9 @@ dependencies = [ [[package]] name = "d3d12" -version = "0.3.2" -source = "git+https://github.com/gfx-rs/d3d12-rs?rev=be19a243b86e0bafb9937d661fc8eabb3e42b44e#be19a243b86e0bafb9937d661fc8eabb3e42b44e" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091ed1b25fe47c7ff129fc440c23650b6114f36aa00bc7212cc8041879294428" dependencies = [ "bitflags", "libloading 0.7.0", @@ -235,14 +221,14 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" dependencies = [ - "libloading 0.6.5", + "libloading 0.6.7", ] [[package]] name = "env_logger" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" +checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f" dependencies = [ "atty", "humantime", @@ -283,19 +269,19 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.15" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", "libc", "wasi", ] [[package]] name = "gfx-auxil" -version = "0.8.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.9.0" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "fxhash", "gfx-hal", @@ -304,8 +290,8 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "arrayvec", "bitflags", @@ -325,8 +311,8 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "arrayvec", "bit-set", @@ -346,8 +332,8 @@ dependencies = [ [[package]] name = "gfx-backend-empty" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "gfx-hal", "log", @@ -356,8 +342,8 @@ dependencies = [ [[package]] name = "gfx-backend-gl" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.1" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "arrayvec", "bitflags", @@ -377,8 +363,8 @@ dependencies = [ [[package]] name = "gfx-backend-metal" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.1" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "arrayvec", "bitflags", @@ -393,6 +379,7 @@ dependencies = [ "naga", "objc", "parking_lot", + "profiling", "range-alloc", "raw-window-handle", "storage-map", @@ -400,8 +387,8 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "arrayvec", "ash", @@ -409,18 +396,20 @@ dependencies = [ "core-graphics-types", "gfx-hal", "inplace_it", + "libloading 0.7.0", "log", "objc", "parking_lot", "raw-window-handle", + "renderdoc-sys", "smallvec", "winapi", ] [[package]] name = "gfx-hal" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" dependencies = [ "bitflags", "naga", @@ -461,9 +450,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.7.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b" +checksum = "4b80b98efaa8a34fce11d60dd2ce2760d5d83c373cbcc73bb87c2a3a84a54108" dependencies = [ "js-sys", "slotmap", @@ -502,9 +491,9 @@ checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -533,36 +522,36 @@ checksum = "90953f308a79fe6d62a4643e51f848fbfddcd05975a38e69fdf4ab86a7baf7ca" [[package]] name = "instant" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "jobserver" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c" dependencies = [ "wasm-bindgen", ] [[package]] name = "khronos-egl" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8cc4d128654d2191681ab98140c4d99e4bd9333efe1526e033586a5a061e1e" +checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" dependencies = [ "libc", "libloading 0.7.0", @@ -594,17 +583,17 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.80" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" [[package]] name = "libloading" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1090080fe06ec2648d0da3881d9453d97e71a45f00eb179af7fdd7e3f686fdb0" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -614,26 +603,26 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] [[package]] name = "lock_api" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" dependencies = [ "scopeguard", ] [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -653,9 +642,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] name = "memmap" @@ -669,8 +658,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.21.0" -source = "git+https://github.com/gfx-rs/metal-rs?rev=439c986eb7a9b91e88b61def2daa66e4043fcbef#439c986eb7a9b91e88b61def2daa66e4043fcbef" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c12e48c737ee9a55e8bb2352bcde588f79ae308d3529ee888f7cc0f469b5777" dependencies = [ "bitflags", "block", @@ -682,8 +672,8 @@ dependencies = [ [[package]] name = "naga" -version = "0.3.1" -source = "git+https://github.com/gfx-rs/naga?tag=gfx-15#196523de7820d4907a14bd22517c4d572d26b0be" +version = "0.4.0" +source = "git+https://github.com/gfx-rs/naga?tag=gfx-24#ba422f10f83e7c33cebb9c53a8df2b8e4df4de98" dependencies = [ "bit-set", "bitflags", @@ -691,6 +681,7 @@ dependencies = [ "log", "num-traits", "petgraph", + "rose_tree", "spirv_headers", "thiserror", ] @@ -734,9 +725,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api", @@ -745,12 +736,11 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", + "cfg-if", "instant", "libc", "redox_syscall", @@ -793,7 +783,7 @@ version = "0.1.0" dependencies = [ "copyless", "env_logger", - "gfx-auxil", + "fxhash", "gfx-backend-dx11", "gfx-backend-dx12", "gfx-backend-empty", @@ -801,7 +791,9 @@ dependencies = [ "gfx-backend-metal", "gfx-backend-vulkan", "gfx-hal", + "lazy_static 1.4.0", "log", + "profiling", "raw-window-handle", "renderdoc", ] @@ -815,35 +807,40 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] [[package]] -name = "quote" -version = "1.0.7" +name = "profiling" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "c3a66d5e88679f2720126c11ee29da07a08f094eac52306b066edd7d393752d6" + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.7.3" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ - "getrandom", "libc", "rand_chacha", "rand_core", @@ -852,9 +849,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", "rand_core", @@ -862,18 +859,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ "getrandom", ] [[package]] name = "rand_hc" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ "rand_core", ] @@ -881,7 +878,7 @@ dependencies = [ [[package]] name = "range-alloc" version = "0.1.2" -source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf" +source = "git+https://github.com/gfx-rs/gfx#889fb69e679bd4114d2ade372957398b0e4854a5" [[package]] name = "raw-window-handle" @@ -894,27 +891,29 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +dependencies = [ + "bitflags", +] [[package]] name = "regex" -version = "1.4.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", "regex-syntax", - "thread_local", ] [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" @@ -939,6 +938,21 @@ dependencies = [ "wio", ] +[[package]] +name = "renderdoc-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" + +[[package]] +name = "rose_tree" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284de9dae38774e2813aaabd7e947b4a6fe9b8c58c2309f754a487cdd50de1c2" +dependencies = [ + "petgraph", +] + [[package]] name = "scopeguard" version = "1.1.0" @@ -963,15 +977,15 @@ checksum = "c46a3482db8f247956e464d783693ece164ca056e6e67563ee5505bdb86452cd" [[package]] name = "smallvec" -version = "1.4.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "spirv_cross" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06db6bd7b6518f761593783e2896eefe55e90455efc5f44511078ce0426ed418" +checksum = "60647fadbf83c4a72f0d7ea67a7ca3a81835cf442b8deae5c134c3e0055b2e14" dependencies = [ "cc", "js-sys", @@ -999,9 +1013,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.48" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" dependencies = [ "proc-macro2", "quote", @@ -1010,11 +1024,11 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", "libc", "rand", "redox_syscall", @@ -1024,47 +1038,38 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static 1.4.0", -] - [[package]] name = "thunderdome" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae" +checksum = "87b4947742c93ece24a0032141d9caa3d853752e694a57e35029dd2bd08673e0" [[package]] name = "token_store" @@ -1074,31 +1079,31 @@ checksum = "a686838375fc11103b9c1529c6508320b7bd5e2401cd62831ca51b3e82e61849" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" dependencies = [ "bumpalo", "lazy_static 1.4.0", @@ -1111,9 +1116,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1121,9 +1126,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c" dependencies = [ "proc-macro2", "quote", @@ -1134,9 +1139,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" [[package]] name = "wayland-client" @@ -1209,9 +1214,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index b2a86e1..d64d8ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,6 @@ panic = "abort" #gfx-backend-dx12 = { path = "../gfx/src/backend/dx12" } #gfx-backend-dx11 = { path = "../gfx/src/backend/dx11" } #gfx-backend-metal = { path = "../gfx/src/backend/metal" } + +[patch.crates-io] +#naga = { path = "../naga" } diff --git a/libportability-gfx/Cargo.toml b/libportability-gfx/Cargo.toml index 8920030..5133522 100644 --- a/libportability-gfx/Cargo.toml +++ b/libportability-gfx/Cargo.toml @@ -15,16 +15,22 @@ name = "portability_gfx" [features] default = [] dispatch = [] -nightly = ["gfx-auxil"] -metal-capture = ["gfx-backend-metal/auto-capture"] +nightly = ["fxhash", "lazy_static"] [dependencies] copyless = "0.1.1" env_logger = { version = "0.8", optional = true } +fxhash = { version = "0.2", optional = true } +lazy_static = { version = "1", optional = true } log = { version = "0.4", features = ["release_max_level_error"] } renderdoc = { version = "0.3", optional = true } raw-window-handle = "0.3" +[dependencies.profiling] +version = "1.0.1" +default-features = false +#features = ["profile-with-tracy"] + [dependencies.hal] package = "gfx-hal" git = "https://github.com/gfx-rs/gfx" @@ -46,12 +52,10 @@ optional = true [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.gfx-backend-metal] git = "https://github.com/gfx-rs/gfx" +#features = ["cross"] optional = true [target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))'.dependencies.gfx-backend-gl] git = "https://github.com/gfx-rs/gfx" -optional = true - -[dependencies.gfx-auxil] -git = "https://github.com/gfx-rs/gfx" -optional = true +#features = ["cross"] +optional = true \ No newline at end of file diff --git a/libportability-gfx/src/handle.rs b/libportability-gfx/src/handle.rs index 690de2e..d81ac23 100644 --- a/libportability-gfx/src/handle.rs +++ b/libportability-gfx/src/handle.rs @@ -1,11 +1,8 @@ use crate::VK_NULL_HANDLE; #[cfg(feature = "nightly")] -use std::sync::{Arc, Mutex}; +use std::{collections::HashMap, hash::BuildHasherDefault, sync::{Arc, Mutex}}; use std::{borrow, fmt, ops}; -#[cfg(feature = "nightly")] -use gfx_auxil::FastHashMap; - use copyless::{BoxAllocation, BoxHelper}; #[cfg(feature = "nightly")] @@ -13,8 +10,8 @@ use lazy_static::lazy_static; #[cfg(feature = "nightly")] lazy_static! { - static ref REGISTRY: Arc>> = - Arc::new(Mutex::new(FastHashMap::default())); + static ref REGISTRY: Arc>>> = + Arc::new(Mutex::new(HashMap::default())); } #[repr(C)] diff --git a/libportability-gfx/src/impls.rs b/libportability-gfx/src/impls.rs index 3f2de6f..96b8ad3 100644 --- a/libportability-gfx/src/impls.rs +++ b/libportability-gfx/src/impls.rs @@ -11,11 +11,10 @@ use hal::{ {command as com, memory, pass, pso, queue}, {Features, Instance}, }; -#[cfg(feature = "gfx-backend-metal")] -use std::env; use std::{ borrow::{Borrow, Cow}, cell::Cell, + env, ffi::{CStr, CString}, mem, os::raw::{c_int, c_void}, @@ -1828,6 +1827,7 @@ pub unsafe extern "C" fn gfxCreateImage( *pImage = Handle::new(Image::Native { raw: image, fb_attachment, + usage, }); VkResult::VK_SUCCESS @@ -1871,17 +1871,40 @@ pub unsafe extern "C" fn gfxCreateImageView( _pAllocator: *const VkAllocationCallbacks, pView: *mut VkImageView, ) -> VkResult { + let mut view_usage = None; + let mut ptr = pCreateInfo as *const VkStructureType; + while !ptr.is_null() { + ptr = match *ptr { + VkStructureType::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO => { + (ptr as *const VkBaseStruct).as_ref().unwrap().pNext + } + VkStructureType::VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR => { + let data = (ptr as *const VkImageViewUsageCreateInfoKHR) + .as_ref() + .unwrap(); + view_usage = Some(conv::map_image_usage(data.usage)); + data.pNext + } + other => { + warn!("Unrecognized {:?}, skipping", other); + (ptr as *const VkBaseStruct).as_ref().unwrap().pNext + } + } as *const VkStructureType; + } + let info = &*pCreateInfo; let view = match *info.image { Image::Native { ref raw, ref fb_attachment, + usage, } => { match gpu.device.create_image_view( raw, conv::map_view_kind(info.viewType), conv::map_format(info.format).unwrap(), conv::map_swizzle(info.components), + view_usage.unwrap_or(usage), conv::map_subresource_range(info.subresourceRange), ) { Ok(raw) => ImageView::Native { @@ -1916,6 +1939,22 @@ pub unsafe extern "C" fn gfxCreateShaderModule( pShaderModule: *mut VkShaderModule, ) -> VkResult { let info = &*pCreateInfo; + if let Ok(value) = env::var("GFX_SHADER_DUMP") { + let base = std::path::PathBuf::from(value.as_str()); + if base.is_dir() { + let code_u8 = slice::from_raw_parts(info.pCode as *const u8, info.codeSize); + for i in 1 .. { + let full = base.join(format!("{}.spv", i)); + if !full.exists() { + std::fs::write(full, code_u8).unwrap(); + break; + } + } + } else { + warn!("Shader dump path {:?} is not accessible", base); + } + } + let code = slice::from_raw_parts(info.pCode, info.codeSize / 4); let shader_module = gpu .device @@ -2348,7 +2387,6 @@ pub unsafe extern "C" fn gfxCreateGraphicsPipelines( }; // TODO: depth bounds - pso::DepthStencilDesc { depth: depth_test, depth_bounds: state.depthBoundsTestEnable == VK_TRUE, @@ -2386,7 +2424,7 @@ pub unsafe extern "C" fn gfxCreateGraphicsPipelines( .and_then(|vp| vp.pScissors.as_ref()) .map(conv::map_rect) }, - blend_color: if dyn_states + blend_constants: if dyn_states .iter() .any(|&ds| ds == VkDynamicState::VK_DYNAMIC_STATE_BLEND_CONSTANTS) { @@ -2667,6 +2705,7 @@ pub unsafe extern "C" fn gfxCreateSampler( min_filter: conv::map_filter(info.minFilter), mag_filter: conv::map_filter(info.magFilter), mip_filter: conv::map_mipmap_filter(info.mipmapMode), + reduction_mode: hal::image::ReductionMode::WeightedAverage, wrap_mode: ( conv::map_wrap_mode(info.addressModeU), conv::map_wrap_mode(info.addressModeV), @@ -4527,6 +4566,7 @@ pub unsafe extern "C" fn gfxCreateSwapchainKHR( Se::DeviceLost(hal::device::DeviceLost) => VkResult::VK_ERROR_DEVICE_LOST, Se::SurfaceLost(hal::window::SurfaceLost) => VkResult::VK_ERROR_SURFACE_LOST_KHR, Se::WindowInUse => VkResult::VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, + Se::Unknown => VkResult::VK_ERROR_UNKNOWN, } } } diff --git a/libportability-gfx/src/lib.rs b/libportability-gfx/src/lib.rs index d3f625c..572c33d 100644 --- a/libportability-gfx/src/lib.rs +++ b/libportability-gfx/src/lib.rs @@ -122,6 +122,7 @@ pub enum Image { //mip_levels: u32, //array_layers: u32, fb_attachment: hal::image::FramebufferAttachment, + usage: hal::image::Usage, }, SwapchainFrame { swapchain: VkSwapchainKHR, @@ -662,6 +663,7 @@ pub enum VkResult { VK_ERROR_TOO_MANY_OBJECTS = -10, VK_ERROR_FORMAT_NOT_SUPPORTED = -11, VK_ERROR_FRAGMENTED_POOL = -12, + VK_ERROR_UNKNOWN = -13, VK_ERROR_SURFACE_LOST_KHR = -1000000000, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, VK_SUBOPTIMAL_KHR = 1000001003, @@ -830,6 +832,7 @@ pub enum VkStructureType { VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR = 1000108001, VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO_KHR = 1000108002, VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR = 1000108003, + VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = 1000117002, VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000, @@ -7275,3 +7278,15 @@ impl Clone for VkRenderPassAttachmentBeginInfoKHR { *self } } +#[repr(C)] +#[derive(Debug, Copy)] +pub struct VkImageViewUsageCreateInfoKHR { + pub sType: VkStructureType, + pub pNext: *const raw::c_void, + pub usage: VkImageUsageFlags, +} +impl Clone for VkImageViewUsageCreateInfoKHR { + fn clone(&self) -> Self { + *self + } +}