From f7f1ff699aeb035773ad47d3d5355f6409f9e332 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Sat, 29 Aug 2020 14:58:28 -0500 Subject: [PATCH] Implement OpenGL Backend For Unix Platforms --- Cargo.lock | 678 +++++++++++++++++++++++++++++++----- wgpu-core/Cargo.toml | 11 +- wgpu-core/build.rs | 6 +- wgpu-core/src/device/mod.rs | 10 +- wgpu-core/src/hub.rs | 19 + wgpu-core/src/instance.rs | 25 +- wgpu-core/src/lib.rs | 6 + 7 files changed, 665 insertions(+), 90 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04fc13f09..350062365 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,20 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "addr2line" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + [[package]] name = "aho-corasick" version = "0.7.10" @@ -23,6 +38,12 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" + [[package]] name = "android_log-sys" version = "0.1.2" @@ -65,12 +86,6 @@ dependencies = [ "libloading 0.6.2", ] -[[package]] -name = "atom" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2" - [[package]] name = "atty" version = "0.2.14" @@ -88,12 +103,41 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +[[package]] +name = "backtrace" +version = "0.3.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2baad346b2d4e94a24347adeee9c7a93f412ee94b9cc26e5b59dea23848e9f28" +dependencies = [ + "addr2line", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "bit-set" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3" + [[package]] name = "bitflags" version = "1.2.1" @@ -134,6 +178,9 @@ name = "cc" version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -141,12 +188,27 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "cfg_aliases" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6da2b592f5a2e590c3d94c44313bab369f2286cfe1e4134c830bf3317814866" +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + [[package]] name = "chrono" version = "0.4.11" @@ -176,6 +238,36 @@ dependencies = [ "bitflags", ] +[[package]] +name = "cocoa" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1706996401131526e36b3b49f0c4d912639ce110996f3ca144d78946727bce54" +dependencies = [ + "bitflags", + "block", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29f7768b2d1be17b96158e3285951d366b40211320fb30826a76cb7a0da6400" +dependencies = [ + "bitflags", + "block", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "foreign-types", + "libc", + "objc", +] + [[package]] name = "cocoa" version = "0.20.1" @@ -185,7 +277,7 @@ dependencies = [ "bitflags", "block", "core-foundation 0.7.0", - "core-graphics", + "core-graphics 0.19.0", "foreign-types", "libc", "objc", @@ -212,6 +304,16 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +dependencies = [ + "core-foundation-sys 0.6.2", + "libc", +] + [[package]] name = "core-foundation" version = "0.7.0" @@ -232,6 +334,12 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" + [[package]] name = "core-foundation-sys" version = "0.7.0" @@ -244,6 +352,18 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a21fa21941700a3cd8fcb4091f361a6a712fac632f85d9f487cc892045d55c6" +[[package]] +name = "core-graphics" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +dependencies = [ + "bitflags", + "core-foundation 0.6.4", + "foreign-types", + "libc", +] + [[package]] name = "core-graphics" version = "0.19.0" @@ -274,9 +394,9 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "core-foundation-sys 0.7.0", - "core-graphics", + "core-graphics 0.19.0", "libc", "objc", ] @@ -309,6 +429,18 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" +[[package]] +name = "display-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303de632386f9c82eb7823456f5932bd40b4de9521078901767bf16a9f331491" +dependencies = [ + "foreign-types", + "objc", + "objc-foundation", + "time-point", +] + [[package]] name = "dlib" version = "0.4.2" @@ -344,6 +476,15 @@ dependencies = [ "termcolor", ] +[[package]] +name = "euclid" +version = "0.20.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bb7ef65b3777a325d1eeefefab5b6d4959da54747e33bd6258e789640f307ad" +dependencies = [ + "num-traits", +] + [[package]] name = "fixedbitset" version = "0.2.0" @@ -414,9 +555,9 @@ dependencies = [ [[package]] name = "gfx-auxil" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6311ee3cc7a3b4c8ae94c4513cd2cbe888ec37990cf0ffa672bd275391b12eb1" +checksum = "07cd956b592970f08545b9325b87580eb95a51843b6f39da27b8667fec1a1216" dependencies = [ "fxhash", "gfx-hal", @@ -425,10 +566,11 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" -version = "0.6.0" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0a460b6458f3857af43064c687b1a010fe1f1b2e8c68fcd1d5db7206fa0809" +checksum = "4ff6f4862cf86d969218e2ddd151816022aff86a1d99a09ffd114da8457c6013" dependencies = [ + "arrayvec", "bitflags", "gfx-auxil", "gfx-hal", @@ -437,18 +579,21 @@ dependencies = [ "parking_lot 0.11.0", "range-alloc", "raw-window-handle", - "smallvec", + "smallvec 1.4.2", "spirv_cross", + "thunderdome", "winapi 0.3.8", "wio", ] [[package]] name = "gfx-backend-dx12" -version = "0.6.0" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "815ea94b924aa3a98e52ba3f090564c2186c7ef33fc0afa2f6b72314935c8798" +checksum = "018a08a0703ef8765ed25ecd48ec77b4d728233364d85b22b8ce24bcd5f71dda" dependencies = [ + "arrayvec", + "bit-set", "bitflags", "d3d12", "gfx-auxil", @@ -456,7 +601,7 @@ dependencies = [ "log", "range-alloc", "raw-window-handle", - "smallvec", + "smallvec 1.4.2", "spirv_cross", "winapi 0.3.8", ] @@ -473,10 +618,34 @@ dependencies = [ ] [[package]] -name = "gfx-backend-metal" +name = "gfx-backend-gl" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42518c5b571be5ba337a89cfba5abfaf2d90b83fc4db96357f64f2ea05f20f81" +checksum = "cb13142f794e5268b14a6dcd350cf60644e4c80e5221900b83dbbfa719aad392" +dependencies = [ + "arrayvec", + "bitflags", + "cfg_aliases", + "gfx-auxil", + "gfx-hal", + "glow", + "js-sys", + "lazy_static", + "log", + "parking_lot 0.11.0", + "raw-window-handle", + "smallvec 1.4.2", + "spirv_cross", + "surfman", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gfx-backend-metal" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ba1c77c112e7d35786dbd49ed26f2a76ce53a44bc09fe964935e4e35ed7f2b" dependencies = [ "arrayvec", "bitflags", @@ -488,12 +657,12 @@ dependencies = [ "gfx-hal", "lazy_static", "log", - "metal", + "metal 0.20.0", "objc", "parking_lot 0.11.0", "range-alloc", "raw-window-handle", - "smallvec", + "smallvec 1.4.2", "spirv_cross", "storage-map", ] @@ -514,7 +683,7 @@ dependencies = [ "log", "objc", "raw-window-handle", - "smallvec", + "smallvec 1.4.2", "winapi 0.3.8", "x11", ] @@ -543,17 +712,66 @@ dependencies = [ [[package]] name = "gfx-memory" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe8d8855df07f438eb8a765e90356d5b821d644ea3b59b870091450b89576a9f" +checksum = "dccdda5d2b39412f4ca2cb15c70b5a82783a86b0606f5e985342754c8ed88f05" dependencies = [ + "bit-set", "fxhash", "gfx-hal", - "hibitset", "log", "slab", ] +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + +[[package]] +name = "gl_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "gleam" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea4f9ba7411ae3f00516401fb811b4f4f37f5c926357f2a033d27f96b74c849" +dependencies = [ + "gl_generator 0.13.1", +] + +[[package]] +name = "glow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1625b792e2f9267116dd41eb7d325e0ea2572ceba5069451906745e04f852f33" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "hashbrown" version = "0.8.2" @@ -572,15 +790,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hibitset" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a1bb8316a44459a7d14253c4d28dd7395cbd23cc04a68c46e851b8e46d64b1" -dependencies = [ - "atom", -] - [[package]] name = "humantime" version = "1.3.0" @@ -612,6 +821,19 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7777a24a1ce5de49fcdde84ec46efa487c3af49d5b6e6e0a50367cc5c1096182" +[[package]] +name = "io-surface" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2279a6faecd06034f88218f77f7a767693e0957bce0323a96d92747e2760b445" +dependencies = [ + "cgl", + "core-foundation 0.6.4", + "gleam", + "leaky-cow", + "libc", +] + [[package]] name = "iovec" version = "0.1.4" @@ -634,10 +856,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] -name = "js-sys" -version = "0.3.40" +name = "jobserver" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" +checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" dependencies = [ "wasm-bindgen", ] @@ -652,6 +883,12 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "lazy_static" version = "1.4.0" @@ -660,9 +897,24 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "leak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73" + +[[package]] +name = "leaky-cow" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc" +dependencies = [ + "leak", +] [[package]] name = "libc" @@ -722,7 +974,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -731,11 +983,20 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "generator", "scoped-tls", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -776,6 +1037,21 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "metal" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0" +dependencies = [ + "bitflags", + "block", + "cocoa 0.20.1", + "core-graphics 0.19.0", + "foreign-types", + "log", + "objc", +] + [[package]] name = "metal" version = "0.20.0" @@ -790,13 +1066,23 @@ dependencies = [ "objc", ] +[[package]] +name = "miniz_oxide" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +dependencies = [ + "adler", + "autocfg", +] + [[package]] name = "mio" version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "fuchsia-zircon", "fuchsia-zircon-sys", "iovec", @@ -884,7 +1170,7 @@ version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "winapi 0.3.8", ] @@ -897,7 +1183,7 @@ checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 0.1.10", "libc", "void", ] @@ -953,6 +1239,17 @@ dependencies = [ "objc_exception", ] +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -962,6 +1259,21 @@ dependencies = [ "cc", ] +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + +[[package]] +name = "object" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" + [[package]] name = "once_cell" version = "1.4.0" @@ -977,6 +1289,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.2", + "rustc_version", +] + [[package]] name = "parking_lot" version = "0.10.2" @@ -998,17 +1321,32 @@ dependencies = [ "parking_lot_core 0.8.0", ] +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi 0.0.3", + "libc", + "redox_syscall", + "rustc_version", + "smallvec 0.6.13", + "winapi 0.3.8", +] + [[package]] name = "parking_lot_core" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "cloudabi 0.0.3", "libc", "redox_syscall", - "smallvec", + "smallvec 1.4.2", "winapi 0.3.8", ] @@ -1018,12 +1356,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "cloudabi 0.1.0", "instant", "libc", "redox_syscall", - "smallvec", + "smallvec 1.4.2", "winapi 0.3.8", ] @@ -1063,7 +1401,7 @@ dependencies = [ "wgpu-core", "wgpu-subscriber", "wgpu-types", - "winit", + "winit 0.22.2", ] [[package]] @@ -1198,6 +1536,12 @@ dependencies = [ "serde", ] +[[package]] +name = "rustc-demangle" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1315,12 +1659,44 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +[[package]] +name = "slotmap" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c46a3482db8f247956e464d783693ece164ca056e6e67563ee5505bdb86452cd" + +[[package]] +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +[[package]] +name = "smithay-client-toolkit" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa" +dependencies = [ + "andrew", + "bitflags", + "dlib", + "lazy_static", + "memmap", + "nix", + "wayland-client 0.21.13", + "wayland-commons 0.21.13", + "wayland-protocols 0.21.13", +] + [[package]] name = "smithay-client-toolkit" version = "0.6.6" @@ -1333,15 +1709,15 @@ dependencies = [ "lazy_static", "memmap", "nix", - "wayland-client", - "wayland-protocols", + "wayland-client 0.23.6", + "wayland-protocols 0.23.6", ] [[package]] name = "spirv_cross" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33a9478e9c78782dd694d05dee074703a9c4c74b511de742b88a7e8149f1b37" +checksum = "d8221f4aebf53a4447aebd4fe29ebff2c66dd2c2821e63675e09e85bd21c8633" dependencies = [ "cc", "js-sys", @@ -1376,6 +1752,36 @@ dependencies = [ "lock_api 0.4.1", ] +[[package]] +name = "surfman" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d85bf0eb91b66b93dda5c04627f00074ea1fa008c2980b132a065fafe7a1ab" +dependencies = [ + "bitflags", + "cfg_aliases", + "cgl", + "cocoa 0.19.1", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "display-link", + "euclid", + "gl_generator 0.14.0", + "io-surface", + "lazy_static", + "libc", + "log", + "mach", + "metal 0.18.0", + "objc", + "parking_lot 0.10.2", + "raw-window-handle", + "wayland-sys 0.24.1", + "winapi 0.3.8", + "winit 0.19.3", + "wio", +] + [[package]] name = "syn" version = "1.0.31" @@ -1436,6 +1842,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "thunderdome" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae" + [[package]] name = "time" version = "0.1.43" @@ -1446,6 +1858,12 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "time-point" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06535c958d6abe68dc4b4ef9e6845f758fc42fe463d0093d0aca40254f03fb14" + [[package]] name = "toml" version = "0.5.6" @@ -1461,7 +1879,7 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "tracing-core", ] @@ -1509,7 +1927,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec", + "smallvec 1.4.2", "tracing-core", "tracing-log", "tracing-serde", @@ -1546,19 +1964,19 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ "bumpalo", "lazy_static", @@ -1571,9 +1989,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ "quote 1.0.7", "wasm-bindgen-macro-support", @@ -1581,9 +1999,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1594,9 +2012,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" + +[[package]] +name = "wayland-client" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713" +dependencies = [ + "bitflags", + "downcast-rs", + "libc", + "nix", + "wayland-commons 0.21.13", + "wayland-scanner 0.21.13", + "wayland-sys 0.21.13", +] [[package]] name = "wayland-client" @@ -1610,9 +2043,19 @@ dependencies = [ "libc", "mio", "nix", - "wayland-commons", - "wayland-scanner", - "wayland-sys", + "wayland-commons 0.23.6", + "wayland-scanner 0.23.6", + "wayland-sys 0.23.6", +] + +[[package]] +name = "wayland-commons" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec" +dependencies = [ + "nix", + "wayland-sys 0.21.13", ] [[package]] @@ -1622,7 +2065,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb66b0d1a27c39bbce712b6372131c6e25149f03ffb0cd017cf8f7de8d66dbdb" dependencies = [ "nix", - "wayland-sys", + "wayland-sys 0.23.6", +] + +[[package]] +name = "wayland-protocols" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afde2ea2a428eee6d7d2c8584fdbe8b82eee8b6c353e129a434cd6e07f42145" +dependencies = [ + "bitflags", + "wayland-client 0.21.13", + "wayland-commons 0.21.13", + "wayland-scanner 0.21.13", + "wayland-sys 0.21.13", ] [[package]] @@ -1632,9 +2088,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6cc286643656742777d55dc8e70d144fa4699e426ca8e9d4ef454f4bf15ffcf9" dependencies = [ "bitflags", - "wayland-client", - "wayland-commons", - "wayland-scanner", + "wayland-client 0.23.6", + "wayland-commons 0.23.6", + "wayland-scanner 0.23.6", +] + +[[package]] +name = "wayland-scanner" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3828c568714507315ee425a9529edc4a4aa9901409e373e9e0027e7622b79e" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "xml-rs", ] [[package]] @@ -1648,6 +2115,16 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "wayland-sys" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520ab0fd578017a0ee2206623ba9ef4afe5e8f23ca7b42f6acfba2f4e66b1628" +dependencies = [ + "dlib", + "lazy_static", +] + [[package]] name = "wayland-sys" version = "0.23.6" @@ -1658,6 +2135,26 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "wayland-sys" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537500923d50be11d95a63c4cb538145e4c82edf61296b7debc1f94a1a6514ed" +dependencies = [ + "dlib", + "lazy_static", +] + +[[package]] +name = "web-sys" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "wgpu-core" version = "0.6.0" @@ -1670,6 +2167,7 @@ dependencies = [ "gfx-backend-dx11", "gfx-backend-dx12", "gfx-backend-empty", + "gfx-backend-gl", "gfx-backend-metal", "gfx-backend-vulkan", "gfx-descriptor", @@ -1681,7 +2179,7 @@ dependencies = [ "raw-window-handle", "ron", "serde", - "smallvec", + "smallvec 1.4.2", "thiserror", "tracing", "wgpu-types", @@ -1750,6 +2248,30 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winit" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d0da905e61ae52d55c5ca6f8bea1e09daf5e325b6c77b0947c65a5179b49f5f" +dependencies = [ + "android_glue", + "backtrace", + "bitflags", + "cocoa 0.18.5", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "lazy_static", + "libc", + "log", + "objc", + "parking_lot 0.9.0", + "percent-encoding", + "smithay-client-toolkit 0.4.6", + "wayland-client 0.21.13", + "winapi 0.3.8", + "x11-dl", +] + [[package]] name = "winit" version = "0.22.2" @@ -1757,9 +2279,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e4ccbf7ddb6627828eace16cacde80fc6bf4dbb3469f88487262a02cf8e7862" dependencies = [ "bitflags", - "cocoa", + "cocoa 0.20.1", "core-foundation 0.7.0", - "core-graphics", + "core-graphics 0.19.0", "core-video-sys", "dispatch", "instant", @@ -1775,8 +2297,8 @@ dependencies = [ "parking_lot 0.10.2", "percent-encoding", "raw-window-handle", - "smithay-client-toolkit", - "wayland-client", + "smithay-client-toolkit 0.6.6", + "wayland-client 0.23.6", "winapi 0.3.8", "x11-dl", ] diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index d27e99935..6c700a407 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -25,8 +25,8 @@ arrayvec = "0.5" bitflags = "1.0" copyless = "0.1" fxhash = "0.2" -hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx.git", rev = "c9fcd08956eeddac8f6d85b02794fc5e3d1717f5" } -gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx.git", rev = "c9fcd08956eeddac8f6d85b02794fc5e3d1717f5" } +hal = { package = "gfx-hal", version = "0.6" } +gfx-backend-empty = "0.6" parking_lot = "0.11" raw-window-handle = { version = "0.3", optional = true } ron = { version = "0.6", optional = true } @@ -34,8 +34,8 @@ serde = { version = "1.0", features = ["serde_derive"], optional = true } smallvec = "1" tracing = { version = "0.1", default-features = false, features = ["std"] } thiserror = "1" -gfx-descriptor = { git = "https://github.com/katharostech/gfx-extras.git", branch = "gl-final-showdown" } -gfx-memory = { git = "https://github.com/katharostech/gfx-extras.git", branch = "gl-final-showdown" } +gfx-descriptor = "0.2" +gfx-memory = "0.2" [dependencies.naga] version = "0.2" @@ -48,6 +48,9 @@ path = "../wgpu-types" package = "wgpu-types" version = "0.6" +[target.'cfg(all(unix, not(target_os = "ios")))'.dependencies] +gfx-backend-gl = { version = "0.6" } + [target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies] gfx-backend-metal = { version = "0.6" } gfx-backend-vulkan = { version = "0.6.4", optional = true } diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index 5f7d660ab..ef07a993f 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -6,13 +6,15 @@ fn main() { // Setup cfg aliases cfg_aliases::cfg_aliases! { // Vendors/systems - apple: { any(target_os = "ios", target_os = "macos") }, + ios: { target_os = "ios" }, + macos: { target_os = "macos" }, + apple: { any(ios, macos) }, // Backends vulkan: { any(windows, all(unix, not(apple)), feature = "gfx-backend-vulkan") }, metal: { apple }, dx12: { windows }, dx11: { windows }, - gl: { unix }, + gl: { all(unix, not(ios)) }, } } diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index cf71ba88d..af8d4a12e 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -1736,16 +1736,16 @@ impl Global { None }; - let actual_border = desc + let actual_border: hal::image::PackedColor = desc .border_color .map(|c| match c { wgt::SamplerBorderColor::TransparentBlack => { - hal::image::BorderColor::TransparentBlack + [0., 0., 0., 0.].into() } - wgt::SamplerBorderColor::OpaqueBlack => hal::image::BorderColor::OpaqueBlack, - wgt::SamplerBorderColor::OpaqueWhite => hal::image::BorderColor::OpaqueWhite, + wgt::SamplerBorderColor::OpaqueBlack => [0., 0., 0., 1.].into(), + wgt::SamplerBorderColor::OpaqueWhite => [1., 1., 1., 1.].into(), }) - .unwrap_or(hal::image::BorderColor::OpaqueBlack); + .unwrap_or([0., 0., 0., 0.].into()); let info = hal::image::SamplerDesc { min_filter: conv::map_filter(desc.min_filter), diff --git a/wgpu-core/src/hub.rs b/wgpu-core/src/hub.rs index 4252141e9..ca076c1d1 100644 --- a/wgpu-core/src/hub.rs +++ b/wgpu-core/src/hub.rs @@ -670,6 +670,8 @@ pub struct Hubs { dx12: Hub, #[cfg(dx11)] dx11: Hub, + #[cfg(gl)] + gl: Hub, } impl Hubs { @@ -683,6 +685,8 @@ impl Hubs { dx12: Hub::new(factory), #[cfg(dx11)] dx11: Hub::new(factory), + #[cfg(gl)] + gl: Hub::new(factory), } } } @@ -734,6 +738,10 @@ impl Drop for Global { { self.hubs.dx11.clear(&mut *surface_guard); } + #[cfg(gl)] + { + self.hubs.gl.clear(&mut *surface_guard); + } // destroy surfaces for element in surface_guard.map.drain(..) { @@ -795,6 +803,17 @@ impl GfxBackend for backend::Dx11 { } } +#[cfg(gl)] +impl GfxBackend for backend::Gl { + const VARIANT: Backend = Backend::Gl; + fn hub(global: &Global) -> &Hub { + &global.hubs.gl + } + fn get_surface_mut(surface: &mut Surface) -> &mut Self::Surface { + surface.gl.as_mut().unwrap() + } +} + #[cfg(test)] fn _test_send_sync(global: &Global) { fn test_internal(_: T) {} diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 2a76cb5cf..6e0f01e90 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -38,6 +38,8 @@ pub struct Instance { pub dx12: Option, #[cfg(dx11)] pub dx11: Option, + #[cfg(gl)] + pub gl: Option, } impl Instance { @@ -59,6 +61,8 @@ impl Instance { dx12: map((Backend::Dx12, gfx_backend_dx12::Instance::create)), #[cfg(dx11)] dx11: map((Backend::Dx11, gfx_backend_dx11::Instance::create)), + #[cfg(gl)] + gl: map((Backend::Gl, gfx_backend_gl::Instance::create)), } } } @@ -81,6 +85,8 @@ impl Instance { map((surface.dx12, &mut self.dx12)), #[cfg(dx11)] map((surface.dx11, &mut self.dx11)), + #[cfg(gl)] + map((surface.gl, &mut self.gl)), } } } @@ -97,6 +103,8 @@ pub struct Surface { pub dx12: Option>, #[cfg(dx11)] pub dx11: Option>, + #[cfg(gl)] + pub gl: Option>, } #[derive(Debug)] @@ -341,7 +349,7 @@ impl Global { inst .as_ref() .and_then(|inst| inst.create_surface(handle).map_err(|e| { - eprintln!("Error: {:?}", e); + tracing::warn!("Error: {:?}", e); }).ok()) }; @@ -354,6 +362,8 @@ impl Global { dx12: map(&self.instance.dx12), #[cfg(dx11)] dx11: map(&self.instance.dx11), + #[cfg(gl)] + gl: map(&self.instance.gl), } } }; @@ -397,6 +407,8 @@ impl Global { map((&instance.dx12, Backend::Dx12, "Dx12", backend::Dx12::hub)), #[cfg(dx11)] map((&instance.dx11, Backend::Dx11, "Dx11", backend::Dx11::hub)), + #[cfg(gl)] + map((&instance.gl, Backend::Gl, "GL", backend::Gl::hub)), } adapters @@ -426,6 +438,7 @@ impl Global { let mut id_metal = inputs.find(Backend::Metal); let mut id_dx12 = inputs.find(Backend::Dx12); let mut id_dx11 = inputs.find(Backend::Dx11); + let mut id_gl = inputs.find(Backend::Gl); backends_map! { let map = |(instance_backend, id_backend, surface_backend)| { @@ -477,6 +490,13 @@ impl Global { } surface_dx11 })); + #[cfg(gl)] + let adapters_gl = map((&instance.gl, &id_gl, { + fn surface_gl(surf: &Surface) -> Option<&GfxSurface> { + surf.gl.as_ref() + } + surface_gl + })); } if device_types.is_empty() { @@ -532,6 +552,8 @@ impl Global { map(("Dx12", &mut id_dx12, adapters_dx12, backend::Dx12::hub)), #[cfg(dx11)] map(("Dx11", &mut id_dx11, adapters_dx11, backend::Dx11::hub)), + #[cfg(gl)] + map(("GL", &mut id_dx11, adapters_gl, backend::Gl::hub)), } let _ = ( @@ -540,6 +562,7 @@ impl Global { id_metal.take(), id_dx12.take(), id_dx11.take(), + id_gl.take(), ); tracing::warn!("Some adapters are present, but enumerating them failed!"); Err(RequestAdapterError::NotFound) diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 0ec245a31..79f3143ad 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -19,6 +19,8 @@ pub mod backend { pub use gfx_backend_dx11::Backend as Dx11; #[cfg(dx12)] pub use gfx_backend_dx12::Backend as Dx12; + #[cfg(gl)] + pub use gfx_backend_gl::Backend as Gl; #[cfg(metal)] pub use gfx_backend_metal::Backend as Metal; #[cfg(vulkan)] @@ -203,6 +205,8 @@ struct PrivateFeatures { #[macro_export] macro_rules! gfx_select { ($id:expr => $global:ident.$method:ident( $($param:expr),* )) => { + // Note: For some reason the cfg aliases defined in build.rs don't succesfully apply in this + // macro so we must specify their equivalents manually match $id.backend() { #[cfg(any(not(any(target_os = "ios", target_os = "macos")), feature = "gfx-backend-vulkan"))] wgt::Backend::Vulkan => $global.$method::<$crate::backend::Vulkan>( $($param),* ), @@ -212,6 +216,8 @@ macro_rules! gfx_select { wgt::Backend::Dx12 => $global.$method::<$crate::backend::Dx12>( $($param),* ), #[cfg(windows)] wgt::Backend::Dx11 => $global.$method::<$crate::backend::Dx11>( $($param),* ), + #[cfg(all(unix, not(target_os = "ios")))] + wgt::Backend::Gl => $global.$method::<$crate::backend::Gl>( $($param),+ ), _ => unreachable!() } };