From 2cf691a17a5031855361b5d37d72c05d9a129126 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 29 Jun 2018 14:04:11 -0400 Subject: [PATCH] Handle sanitation and gfx-hal update --- .gitignore | 1 + .lldbinit | 1 - Cargo.lock | 106 ++++++++++--------------------- Makefile | 15 +++-- libportability-gfx/Cargo.toml | 1 + libportability-gfx/src/handle.rs | 21 +++++- libportability-gfx/src/impls.rs | 69 ++++++++++++-------- libportability-gfx/src/lib.rs | 1 + 8 files changed, 107 insertions(+), 108 deletions(-) delete mode 100644 .lldbinit diff --git a/.gitignore b/.gitignore index 6083428..a72292a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ conformance/*.qpa conformance/*.txt **/*.rs.bk .vscode/ +.lldbinit diff --git a/.lldbinit b/.lldbinit deleted file mode 100644 index 91c934e..0000000 --- a/.lldbinit +++ /dev/null @@ -1 +0,0 @@ -env LD_LIBRARY_PATH=target/debug diff --git a/Cargo.lock b/Cargo.lock index d27d274..07dce68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [[package]] name = "aho-corasick" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -33,11 +33,11 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -74,7 +74,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -198,7 +198,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -208,7 +208,7 @@ name = "failure" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -265,12 +265,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gfx-backend-dx11" version = "0.1.0" -source = "git+https://github.com/gfx-rs/gfx#4306768fd37b94277dcccaeb6fd128a693068e98" +source = "git+https://github.com/gfx-rs/gfx#ee7ae15b09363580fd81b8538e53890231e46bf3" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "spirv_cross 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -281,12 +281,12 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" version = "0.1.0" -source = "git+https://github.com/gfx-rs/gfx#4306768fd37b94277dcccaeb6fd128a693068e98" +source = "git+https://github.com/gfx-rs/gfx#ee7ae15b09363580fd81b8538e53890231e46bf3" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "spirv_cross 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -297,7 +297,7 @@ dependencies = [ [[package]] name = "gfx-backend-metal" version = "0.1.0" -source = "git+https://github.com/gfx-rs/gfx#4306768fd37b94277dcccaeb6fd128a693068e98" +source = "git+https://github.com/gfx-rs/gfx#ee7ae15b09363580fd81b8538e53890231e46bf3" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -306,27 +306,25 @@ dependencies = [ "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)", - "io-surface 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "metal-rs 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "spirv_cross 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "spirv_cross 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "winit 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx-backend-vulkan" version = "0.1.0" -source = "git+https://github.com/gfx-rs/gfx#4306768fd37b94277dcccaeb6fd128a693068e98" +source = "git+https://github.com/gfx-rs/gfx#ee7ae15b09363580fd81b8538e53890231e46bf3" dependencies = [ "ash 0.24.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)", "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -338,7 +336,7 @@ dependencies = [ [[package]] name = "gfx-hal" version = "0.1.0" -source = "git+https://github.com/gfx-rs/gfx#4306768fd37b94277dcccaeb6fd128a693068e98" +source = "git+https://github.com/gfx-rs/gfx#ee7ae15b09363580fd81b8538e53890231e46bf3" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -352,18 +350,10 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "gleam" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "gleam" version = "0.5.1" @@ -402,18 +392,6 @@ dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "io-surface" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cgl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.34 (registry+https://github.com/rust-lang/crates.io-index)", - "leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itertools" version = "0.5.10" @@ -437,19 +415,6 @@ name = "lazy_static" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "leak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "leaky-cow" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "leak 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "libc" version = "0.2.42" @@ -466,10 +431,10 @@ dependencies = [ [[package]] name = "log" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -507,7 +472,7 @@ dependencies = [ "cocoa 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -520,7 +485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -624,8 +589,9 @@ dependencies = [ "gfx-backend-vulkan 0.1.0 (git+https://github.com/gfx-rs/gfx)", "gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)", "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "renderdoc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -673,7 +639,7 @@ name = "regex" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -730,7 +696,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smithay-client-toolkit" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -755,7 +721,7 @@ dependencies = [ [[package]] name = "spirv_cross" -version = "0.9.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1049,7 +1015,7 @@ dependencies = [ "objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smithay-client-toolkit 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smithay-client-toolkit 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "x11-dl 2.18.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1088,7 +1054,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1100,17 +1066,17 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" +"checksum aho-corasick 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f0ba20154ea1f47ce2793322f049c5646cc6d0fa9759d5f333f286e507bf8080" "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" "checksum ash 0.24.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fb9df6efb2ee4200129dc4e7f0ac7065a0eabc03adfc22494689a73c410eae82" "checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1" -"checksum backtrace 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbdd17cd962b570302f5297aea8648d5923e22e555c2ed2d8b2e34eca646bf6d" +"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e" "checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" "checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9" "checksum cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "49ec142f5768efb5b7622aebc3fdbdbb8950a4b9ba996393cb76ef7466e8747d" -"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18" +"checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e" "checksum cgl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "80f05e25f9631fdee56693110feda284a49308ca1e768857a0ad3906cfc1502a" "checksum cocoa 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0c23085dde1ef4429df6e5896b89356d35cdd321fb43afe3e378d010bb5adc6" "checksum cocoa 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b44bd25bd275e9d74a5dff8ca55f2fb66c9ad5e12170d58697701df21a56e0e" @@ -1139,20 +1105,16 @@ dependencies = [ "checksum gfx-backend-vulkan 0.1.0 (git+https://github.com/gfx-rs/gfx)" = "" "checksum gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)" = "" "checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a" -"checksum gleam 0.4.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b4e5e2cdcadecdf3886e7808b6a38eae0a48dfe98c5c12b776fc861b80edf4a2" "checksum gleam 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12b793fcf40a23dd372f184c228ab3eb96f88c50bb4fba8319c483aa025a4e45" "checksum glutin 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9caee44b73388b2b4452ab783b13a1af80edb363bfc6e5292bdb2dd990a3171" "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" -"checksum io-surface 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd46b8bb9528ad2b433e4be99f949ab7bce7bc46fbe6c54cd556d3d18b5930af" "checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc" "checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e6412c5e2ad9584b0b8e979393122026cdd6d2a80b933f890dcd694ddbe73739" -"checksum leak 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73" -"checksum leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc" "checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" -"checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac" +"checksum log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "61bd98ae7f7b754bc53dca7d44b604f733c6bba044ea6f41bc8d89272d8161d2" "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" "checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" @@ -1180,9 +1142,9 @@ dependencies = [ "checksum rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649" "checksum shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8254bf098ce4d8d7cc7cc6de438c5488adc5297e5b7ffef88816c0a91bd289c1" "checksum smallvec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "312a7df010092e73d6bbaf141957e868d4f30efd2bfd9bb1028ad91abec58514" -"checksum smithay-client-toolkit 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84c45607482d31161951f4ea11ba2673e3999e1cc6ca2d50a72eaee7eae3cbf1" +"checksum smithay-client-toolkit 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "428d6c019bb92753be9670367e3f483e4fcef396180a9b59e813b69b20014881" "checksum spirv_cross 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "387a12e5de5d5cd284d07fe7edbcac83163c0b9b4304bd3a0efb1274bcda83cf" -"checksum spirv_cross 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d54061a8b08ed139c027945d6fcd7fbb78550a38dde6c3c47b5a5b3662d8c58" +"checksum spirv_cross 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "73a62edb99e26999160cf3dcdf9c181b8ba01825f7e016f9b9e70f7000d28548" "checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa" "checksum syn 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)" = "58fd09df59565db3399efbba34ba8a2fec1307511ebd245d0061ff9d42691673" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" diff --git a/Makefile b/Makefile index 5120596..80c1c4a 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ DEQP_DIR=$(CTS_DIR)/build/external/vulkancts/modules/vulkan/ DEQP=cd $(DEQP_DIR) && RUST_LOG=debug LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) ./deqp-vk DOTA_DIR=../dota2/bin/osx64 DOTA_EXE=$(DOTA_DIR)/dota2.app/Contents/MacOS/dota2 -DOTA_PARAMS=-vulkan_disable_occlusion_queries -vulkan_scene_system_job_cost 2 +#DOTA_PARAMS=-vulkan_disable_occlusion_queries -vulkan_scene_system_job_cost 2 +DOTA_PARAMS=-vulkan_disable_occlusion_queries RUST_BACKTRACE:=1 BACKEND:=gl @@ -46,7 +47,7 @@ FULL_LIBRARY_PATH=$(CURDIR)/target/debug LIBRARY=target/debug/libportability.$(LIB_EXTENSION) LIBRARY_FAST=target/release/libportability.$(LIB_EXTENSION) -.PHONY: all rebuild debug release version-debug version-release binding run cts clean cherry dota-debug dota-release +.PHONY: all rebuild debug release version-debug version-release binding run cts clean cherry dota-debug dota-release dota-orig all: $(TARGET) @@ -65,10 +66,15 @@ version-release: cargo rustc --release --manifest-path libportability/Cargo.toml --features $(BACKEND) -- -Clink-arg="-current_version 1.0.0" -Clink-arg="-compatibility_version 1.0.0" dota-debug: version-debug $(DOTA_EXE) - DYLD_LIBRARY_PATH=`pwd`/target/debug:`pwd`/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS) + echo "env DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR)" >.lldbinit + DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR) $(DEBUGGER) $(DOTA_EXE) $(DOTA_PARAMS) dota-release: version-release $(DOTA_EXE) - DYLD_LIBRARY_PATH=`pwd`/target/release:`pwd`/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS) + DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS) +dota-molten: + DYLD_LIBRARY_PATH=$(CURDIR)/../MoltenVK/Package/Release/MoltenVK/macOS:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) +dota-orig: + DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) binding: $(BINDING) @@ -103,6 +109,7 @@ cts: else ifdef debug cts: $(LIBRARY) + echo "env LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH)" >.lldbinit #(cd $(DEQP_DIR) && LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) ./deqp-vk -n $(debug)) LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) $(DEQP_DIR)/deqp-vk -n $(debug) else diff --git a/libportability-gfx/Cargo.toml b/libportability-gfx/Cargo.toml index d39790c..0d4eb79 100644 --- a/libportability-gfx/Cargo.toml +++ b/libportability-gfx/Cargo.toml @@ -18,6 +18,7 @@ nightly = [] [dependencies] lazy_static = "1.0" log = "0.4" +smallvec = "0.6" [dependencies.env_logger] version = "0.5" diff --git a/libportability-gfx/src/handle.rs b/libportability-gfx/src/handle.rs index 234919d..c0ea887 100644 --- a/libportability-gfx/src/handle.rs +++ b/libportability-gfx/src/handle.rs @@ -1,13 +1,14 @@ use VK_NULL_HANDLE; use std::{borrow, cmp, fmt, ops}; #[cfg(feature = "nightly")] -use std::collections::HashMap; -#[cfg(feature = "nightly")] use std::sync::{Arc, Mutex}; +#[cfg(feature = "nightly")] +use hal::backend::FastHashMap; + #[cfg(feature = "nightly")] lazy_static! { - static ref REGISTRY: Arc>> = Arc::new(Mutex::new(HashMap::new())); + static ref REGISTRY: Arc>> = Arc::new(Mutex::new(FastHashMap::default())); } #[repr(C)] @@ -61,6 +62,17 @@ impl Handle { } } +impl Handle { + #[cfg(feature = "nightly")] + #[inline] + fn check(&self) { + assert!(REGISTRY.lock().unwrap().contains_key(&(self.0 as _))); + } + #[cfg(not(feature = "nightly"))] + #[inline] + fn check(&self) {} +} + impl Clone for Handle { fn clone(&self) -> Self { Handle(self.0) @@ -72,18 +84,21 @@ impl Copy for Handle {} impl ops::Deref for Handle { type Target = T; fn deref(&self) -> &T { + self.check(); unsafe { &*self.0 } } } impl ops::DerefMut for Handle { fn deref_mut(&mut self) -> &mut T { + self.check(); unsafe { &mut *self.0 } } } impl borrow::Borrow for Handle { fn borrow(&self) -> &T { + self.check(); unsafe { &*self.0 } } } diff --git a/libportability-gfx/src/impls.rs b/libportability-gfx/src/impls.rs index 08586ed..1495ab6 100644 --- a/libportability-gfx/src/impls.rs +++ b/libportability-gfx/src/impls.rs @@ -9,6 +9,8 @@ use hal::device::WaitFor; use hal::pool::RawCommandPool; use hal::queue::RawCommandQueue; +use smallvec::SmallVec; + use std::ffi::{CStr, CString}; #[cfg(feature = "renderdoc")] use std::os::raw::c_void; @@ -357,7 +359,7 @@ pub extern "C" fn gfxGetPhysicalDeviceMemoryProperties( } #[inline] pub extern "C" fn gfxGetInstanceProcAddr( - instance: VkInstance, + _instance: VkInstance, pName: *const ::std::os::raw::c_char, ) -> PFN_vkVoidFunction { let name = unsafe { CStr::from_ptr(pName) }; @@ -1105,9 +1107,7 @@ pub extern "C" fn gfxBindBufferMemory( memory: VkDeviceMemory, memoryOffset: VkDeviceSize, ) -> VkResult { - let temp = unsafe { mem::zeroed() }; - - *buffer = match mem::replace(&mut *buffer, temp) { + let new = match mem::replace(&mut *buffer, unsafe { mem::zeroed() }) { Buffer::Buffer(_) => panic!("A non-sparse buffer can only be bound once!"), Buffer::Unbound(unbound) => { Buffer::Buffer( @@ -1118,6 +1118,11 @@ pub extern "C" fn gfxBindBufferMemory( } }; + // We need to move the value out of the Handle here, + // and then put something else back in. + let temp = mem::replace(&mut *buffer, new); + mem::forget(temp); + VkResult::VK_SUCCESS } #[inline] @@ -1127,9 +1132,7 @@ pub extern "C" fn gfxBindImageMemory( memory: VkDeviceMemory, memoryOffset: VkDeviceSize, ) -> VkResult { - let temp = unsafe { mem::zeroed() }; - - *image = match mem::replace(&mut *image, temp) { + let new = match mem::replace(&mut *image, unsafe { mem::zeroed() }) { Image::Image { .. } => panic!("An non-sparse image can only be bound once!"), Image::Unbound { raw, mip_levels, array_layers } => { Image::Image { @@ -1140,6 +1143,11 @@ pub extern "C" fn gfxBindImageMemory( } }; + // We need to move the value out of the Handle here, + // and then put something else back in. + let temp = mem::replace(&mut *image, new); + mem::forget(temp); + VkResult::VK_SUCCESS } #[inline] @@ -1719,7 +1727,13 @@ pub extern "C" fn gfxCreateGraphicsPipelines( }; let shaders = { - let mut set: pso::GraphicsShaderSet<_> = unsafe { mem::zeroed() }; + let mut set = pso::GraphicsShaderSet { + vertex: unsafe { mem::zeroed() }, // fake entry point + hull: None, + domain: None, + geometry: None, + fragment: None, + }; let stages = unsafe { slice::from_raw_parts(info.pStages, info.stageCount as _) @@ -1738,7 +1752,10 @@ pub extern "C" fn gfxCreateGraphicsPipelines( }; match stage.stage { - VK_SHADER_STAGE_VERTEX_BIT => { set.vertex = entry_point; } + VK_SHADER_STAGE_VERTEX_BIT => { + let fake_vs_entry = mem::replace(&mut set.vertex, entry_point); + mem::forget(fake_vs_entry); + } VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT => { set.hull = Some(entry_point); } VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT => { set.domain = Some(entry_point); } VK_SHADER_STAGE_GEOMETRY_BIT => { set.geometry = Some(entry_point); } @@ -2431,10 +2448,9 @@ pub extern "C" fn gfxFreeDescriptorSets( assert!(descriptorPool.sets.is_none()); descriptorPool.raw.free_sets( - &descriptor_sets + descriptor_sets .into_iter() .filter_map(|set| set.unbox()) - .collect::>() ); VkResult::VK_SUCCESS @@ -2450,7 +2466,8 @@ pub extern "C" fn gfxUpdateDescriptorSets( let write_infos = unsafe { slice::from_raw_parts(pDescriptorWrites, descriptorWriteCount as _) }; - let mut writes = Vec::new(); //TODO: avoid allocation here and below + //TODO: investigate the safety of passing one giant iterator here + let mut writes = SmallVec::<[pso::DescriptorSetWrite<_, _>; 16]>::with_capacity(write_infos.len()); for write in write_infos { let image_info = unsafe { @@ -2464,14 +2481,12 @@ pub extern "C" fn gfxUpdateDescriptorSets( }; let ty = conv::map_descriptor_type(write.descriptorType); - let descriptors = match ty { + let descriptors: SmallVec<[_; 4]> = match ty { pso::DescriptorType::Sampler => { image_info .into_iter() - .map(|image| pso::Descriptor::Sampler( - &*image.sampler, - )) - .collect::>() + .map(|image| pso::Descriptor::Sampler(&*image.sampler)) + .collect() } pso::DescriptorType::InputAttachment | pso::DescriptorType::SampledImage | @@ -2482,7 +2497,7 @@ pub extern "C" fn gfxUpdateDescriptorSets( &*image.imageView, conv::map_image_layout(image.imageLayout), )) - .collect::>() + .collect() } pso::DescriptorType::UniformTexelBuffer => { texel_buffer_views @@ -2490,7 +2505,7 @@ pub extern "C" fn gfxUpdateDescriptorSets( .map(|view| pso::Descriptor::UniformTexelBuffer( &**view, )) - .collect::>() + .collect() } pso::DescriptorType::StorageTexelBuffer => { texel_buffer_views @@ -2498,7 +2513,7 @@ pub extern "C" fn gfxUpdateDescriptorSets( .map(|view| pso::Descriptor::StorageTexelBuffer( &**view, )) - .collect::>() + .collect() } pso::DescriptorType::UniformBuffer | pso::DescriptorType::StorageBuffer | @@ -2518,7 +2533,7 @@ pub extern "C" fn gfxUpdateDescriptorSets( Some(buffer.offset) .. end, ) }) - .collect::>() + .collect() } pso::DescriptorType::CombinedImageSampler => { image_info @@ -2528,7 +2543,7 @@ pub extern "C" fn gfxUpdateDescriptorSets( conv::map_image_layout(image.imageLayout), &*image.sampler, )) - .collect::>() + .collect() } }; @@ -3096,15 +3111,13 @@ pub extern "C" fn gfxCmdBindVertexBuffers( let views = buffers .into_iter() - .zip(offsets.into_iter()) + .zip(offsets) .map(|(buffer, offset)| { let buffer = buffer.expect("Non-sparse buffers need to be bound to device memory."); + (buffer, *offset) + }); - (buffer, *offset as _) - }) - .collect(); - - commandBuffer.bind_vertex_buffers(firstBinding, pso::VertexBufferSet(views)); + commandBuffer.bind_vertex_buffers(firstBinding, views); } #[inline] pub extern "C" fn gfxCmdDraw( diff --git a/libportability-gfx/src/lib.rs b/libportability-gfx/src/lib.rs index e0b7e94..cfbb04f 100644 --- a/libportability-gfx/src/lib.rs +++ b/libportability-gfx/src/lib.rs @@ -18,6 +18,7 @@ extern crate gfx_backend_vulkan as back; extern crate lazy_static; #[macro_use] extern crate log; +extern crate smallvec; #[cfg(feature = "env_logger")] extern crate env_logger; #[cfg(feature = "renderdoc")]