First working code
+ implemented hal initialization code + implemented basic renderer + implemented basic window system
This commit is contained in:
parent
854f5e8c16
commit
e4154ade42
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/target
|
/target
|
||||||
|
*.log
|
||||||
|
|||||||
963
Cargo.lock
generated
Normal file
963
Cargo.lock
generated
Normal file
@ -0,0 +1,963 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "andrew"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b7f09f89872c2b6b29e319377b1fbe91c6f5947df19a25596e121cf19a7b35e"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"line_drawing",
|
||||||
|
"rusttype 0.7.9",
|
||||||
|
"walkdir",
|
||||||
|
"xdg",
|
||||||
|
"xml-rs",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_log-sys"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "approx"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arrayvec"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ash"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69daec0742947f33a85931fa3cb0ce5f07929159dcbd1f0cbb5b2912e2978509"
|
||||||
|
dependencies = [
|
||||||
|
"libloading",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "calloop"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7aa2097be53a00de9e8fc349fea6d76221f398f5c4fa550d420669906962d160"
|
||||||
|
dependencies = [
|
||||||
|
"mio",
|
||||||
|
"mio-extras",
|
||||||
|
"nix",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.50"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "0.1.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2"
|
||||||
|
dependencies = [
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
"time",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cloudabi"
|
||||||
|
version = "0.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cocoa"
|
||||||
|
version = "0.20.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f7b6f3f7f4f0b3ec5c5039aaa9e8c3cef97a7a480a400fd62944841314f293d"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"block",
|
||||||
|
"core-foundation",
|
||||||
|
"core-graphics",
|
||||||
|
"foreign-types",
|
||||||
|
"libc",
|
||||||
|
"objc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-graphics"
|
||||||
|
version = "0.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"core-foundation",
|
||||||
|
"foreign-types",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-video-sys"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"core-graphics",
|
||||||
|
"libc",
|
||||||
|
"objc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derivative"
|
||||||
|
version = "2.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.18",
|
||||||
|
"quote 1.0.7",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dispatch"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dlib"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a"
|
||||||
|
dependencies = [
|
||||||
|
"libloading",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "downcast-rs"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fern"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8c9a4820f0ccc8a7afd67c39a0f1a0f4b07ca1725164271a64939d7aeb9af065"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||||
|
dependencies = [
|
||||||
|
"foreign-types-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types-shared"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fuchsia-zircon"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"fuchsia-zircon-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fuchsia-zircon-sys"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gfx-backend-vulkan"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ebd1dee09bd8d8f1ba52c5ba22d1f70c7ffa990c5eb245eb3ef2d0206f631673"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"ash",
|
||||||
|
"byteorder",
|
||||||
|
"core-graphics",
|
||||||
|
"gfx-hal",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"objc",
|
||||||
|
"raw-window-handle",
|
||||||
|
"smallvec",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
"x11",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gfx-hal"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc96180204064c9493e0fe4a9efeb721e0ac59fe8e1906d0c659142a93114fb1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"raw-window-handle",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "instant"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6c346c299e3fe8ef94dc10c2c0253d858a69aac1245157a3bf4125915d528caf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iovec"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iv"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"fern",
|
||||||
|
"gfx-backend-vulkan",
|
||||||
|
"gfx-hal",
|
||||||
|
"log",
|
||||||
|
"winit",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jni-sys"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kernel32-sys"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.2.8",
|
||||||
|
"winapi-build",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazycell"
|
||||||
|
version = "1.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.68"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libloading"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "line_drawing"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"
|
||||||
|
dependencies = [
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "malloc_buf"
|
||||||
|
version = "0.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maybe-uninit"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memmap"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mio"
|
||||||
|
version = "0.6.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"fuchsia-zircon",
|
||||||
|
"fuchsia-zircon-sys",
|
||||||
|
"iovec",
|
||||||
|
"kernel32-sys",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"miow",
|
||||||
|
"net2",
|
||||||
|
"slab",
|
||||||
|
"winapi 0.2.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mio-extras"
|
||||||
|
version = "2.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
|
||||||
|
dependencies = [
|
||||||
|
"lazycell",
|
||||||
|
"log",
|
||||||
|
"mio",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miow"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||||
|
dependencies = [
|
||||||
|
"kernel32-sys",
|
||||||
|
"net2",
|
||||||
|
"winapi 0.2.8",
|
||||||
|
"ws2_32-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ndk"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95a356cafe20aee088789830bfea3a61336e84ded9e545e00d3869ce95dcb80c"
|
||||||
|
dependencies = [
|
||||||
|
"jni-sys",
|
||||||
|
"ndk-sys",
|
||||||
|
"num_enum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ndk-glue"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d1730ee2e3de41c3321160a6da815f008c4006d71b095880ea50e17cf52332b8"
|
||||||
|
dependencies = [
|
||||||
|
"android_log-sys",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"ndk",
|
||||||
|
"ndk-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ndk-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b2820aca934aba5ed91c79acc72b6a44048ceacc5d36c035ed4e051f12d887d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "net2"
|
||||||
|
version = "0.2.33"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.14.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"cc",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"void",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_enum"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4"
|
||||||
|
dependencies = [
|
||||||
|
"derivative",
|
||||||
|
"num_enum_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_enum_derive"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-crate",
|
||||||
|
"proc-macro2 1.0.18",
|
||||||
|
"quote 1.0.7",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||||
|
dependencies = [
|
||||||
|
"malloc_buf",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ordered-float"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api",
|
||||||
|
"parking_lot_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cloudabi",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"smallvec",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "percent-encoding"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.3.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro-crate"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e"
|
||||||
|
dependencies = [
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "0.4.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid 0.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "0.6.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.18",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "raw-window-handle"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.1.56"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rusttype"
|
||||||
|
version = "0.7.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5"
|
||||||
|
dependencies = [
|
||||||
|
"rusttype 0.8.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rusttype"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "14a911032fb5791ccbeec9f28fdcb9bf0983b81f227bafdfd227c658d0731c8a"
|
||||||
|
dependencies = [
|
||||||
|
"approx",
|
||||||
|
"arrayvec",
|
||||||
|
"ordered-float",
|
||||||
|
"stb_truetype",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "same-file"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scopeguard"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.112"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallvec"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smithay-client-toolkit"
|
||||||
|
version = "0.6.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "421c8dc7acf5cb205b88160f8b4cc2c5cfabe210e43b2f80f009f4c1ef910f1d"
|
||||||
|
dependencies = [
|
||||||
|
"andrew",
|
||||||
|
"bitflags",
|
||||||
|
"dlib",
|
||||||
|
"lazy_static",
|
||||||
|
"memmap",
|
||||||
|
"nix",
|
||||||
|
"wayland-client",
|
||||||
|
"wayland-protocols",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stb_truetype"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.18",
|
||||||
|
"quote 1.0.7",
|
||||||
|
"unicode-xid 0.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time"
|
||||||
|
version = "0.1.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.5.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "void"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "walkdir"
|
||||||
|
version = "2.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||||
|
dependencies = [
|
||||||
|
"same-file",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wayland-client"
|
||||||
|
version = "0.23.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "af1080ebe0efabcf12aef2132152f616038f2d7dcbbccf7b2d8c5270fe14bcda"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"calloop",
|
||||||
|
"downcast-rs",
|
||||||
|
"libc",
|
||||||
|
"mio",
|
||||||
|
"nix",
|
||||||
|
"wayland-commons",
|
||||||
|
"wayland-scanner",
|
||||||
|
"wayland-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wayland-commons"
|
||||||
|
version = "0.23.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb66b0d1a27c39bbce712b6372131c6e25149f03ffb0cd017cf8f7de8d66dbdb"
|
||||||
|
dependencies = [
|
||||||
|
"nix",
|
||||||
|
"wayland-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wayland-protocols"
|
||||||
|
version = "0.23.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6cc286643656742777d55dc8e70d144fa4699e426ca8e9d4ef454f4bf15ffcf9"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"wayland-client",
|
||||||
|
"wayland-commons",
|
||||||
|
"wayland-scanner",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wayland-scanner"
|
||||||
|
version = "0.23.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "93b02247366f395b9258054f964fe293ddd019c3237afba9be2ccbe9e1651c3d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
"quote 0.6.13",
|
||||||
|
"xml-rs",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wayland-sys"
|
||||||
|
version = "0.23.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d94e89a86e6d6d7c7c9b19ebf48a03afaac4af6bc22ae570e9a24124b75358f4"
|
||||||
|
dependencies = [
|
||||||
|
"dlib",
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu",
|
||||||
|
"winapi-x86_64-pc-windows-gnu",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-build"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-util"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winit"
|
||||||
|
version = "0.22.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e4ccbf7ddb6627828eace16cacde80fc6bf4dbb3469f88487262a02cf8e7862"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"cocoa",
|
||||||
|
"core-foundation",
|
||||||
|
"core-graphics",
|
||||||
|
"core-video-sys",
|
||||||
|
"dispatch",
|
||||||
|
"instant",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"mio",
|
||||||
|
"mio-extras",
|
||||||
|
"ndk",
|
||||||
|
"ndk-glue",
|
||||||
|
"ndk-sys",
|
||||||
|
"objc",
|
||||||
|
"parking_lot",
|
||||||
|
"percent-encoding",
|
||||||
|
"raw-window-handle",
|
||||||
|
"smithay-client-toolkit",
|
||||||
|
"wayland-client",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
"x11-dl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ws2_32-sys"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.2.8",
|
||||||
|
"winapi-build",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "x11"
|
||||||
|
version = "2.18.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "x11-dl"
|
||||||
|
version = "2.18.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2bf981e3a5b3301209754218f962052d4d9ee97e478f4d26d4a6eced34c1fef8"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"maybe-uninit",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xdg"
|
||||||
|
version = "2.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xml-rs"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2bb76e5c421bbbeb8924c60c030331b345555024d56261dae8f3e786ed817c23"
|
||||||
18
Cargo.toml
18
Cargo.toml
@ -7,3 +7,21 @@ edition = "2018"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
log = "0.4.8"
|
||||||
|
chrono = "0.4.11"
|
||||||
|
fern = "0.6.0"
|
||||||
|
gfx-hal = "0.5.0"
|
||||||
|
winit = "0.22.0"
|
||||||
|
|
||||||
|
[dependencies.gfx-backend-vulkan]
|
||||||
|
version = "0.5"
|
||||||
|
features = ["x11"]
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "iv"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "iv"
|
||||||
|
path = "src/bin/main.rs"
|
||||||
|
|
||||||
|
|||||||
39
src/bin/main.rs
Normal file
39
src/bin/main.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug, error, info, trace, warn};
|
||||||
|
|
||||||
|
use chrono;
|
||||||
|
|
||||||
|
use ::iv::run;
|
||||||
|
|
||||||
|
fn setup_logger() -> Result<(), fern::InitError> {
|
||||||
|
fern::Dispatch::new()
|
||||||
|
.format(|out, message, record| {
|
||||||
|
out.finish(format_args!(
|
||||||
|
"{}[{}][{}] {}",
|
||||||
|
chrono::Local::now().format("[%H:%M:%S]"),
|
||||||
|
record.level(),
|
||||||
|
record.target(),
|
||||||
|
message
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.level(log::LevelFilter::Debug)
|
||||||
|
.chain(std::io::stdout())
|
||||||
|
.chain(fern::log_file("output.log")?)
|
||||||
|
.apply()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//pub fn draw_frame(hal : &mut HalState, local : &LocalState) -> Result<(), &'static str> {
|
||||||
|
//
|
||||||
|
// hal.draw_clear_frame(local.color());
|
||||||
|
//}
|
||||||
|
|
||||||
|
pub fn main() -> Result<(), &'static str> {
|
||||||
|
|
||||||
|
setup_logger().unwrap();
|
||||||
|
|
||||||
|
run()?;
|
||||||
|
//print!("test");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
498
src/hal.rs
Normal file
498
src/hal.rs
Normal file
@ -0,0 +1,498 @@
|
|||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug,error, info, trace, warn};
|
||||||
|
|
||||||
|
use std::{
|
||||||
|
mem::ManuallyDrop,
|
||||||
|
iter,
|
||||||
|
};
|
||||||
|
|
||||||
|
use core::ptr::read;
|
||||||
|
|
||||||
|
use gfx_hal::{
|
||||||
|
Instance,
|
||||||
|
device::Device,
|
||||||
|
queue::QueueGroup,
|
||||||
|
Backend,
|
||||||
|
pool::CommandPool,
|
||||||
|
pso::Rect,
|
||||||
|
};
|
||||||
|
|
||||||
|
use gfx_backend_vulkan as vk_back;
|
||||||
|
|
||||||
|
use winit::window::Window;
|
||||||
|
|
||||||
|
pub mod render;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct HalState {
|
||||||
|
//items need to communicate with the GPU
|
||||||
|
instance: ManuallyDrop<<vk_back::Backend as Backend>::Instance>,
|
||||||
|
surface: ManuallyDrop<<vk_back::Backend as Backend>::Surface>,
|
||||||
|
adapter: ManuallyDrop<gfx_hal::adapter::Adapter<vk_back::Backend>>,
|
||||||
|
device: vk_back::Device,
|
||||||
|
queue_group: ManuallyDrop<QueueGroup<vk_back::Backend>>,
|
||||||
|
render_pass: ManuallyDrop<<vk_back::Backend as Backend>::RenderPass>,
|
||||||
|
swapchain: ManuallyDrop<<vk_back::Backend as Backend>::Swapchain>,
|
||||||
|
extent: gfx_hal::window::Extent2D,
|
||||||
|
format: gfx_hal::format::Format,
|
||||||
|
render_area: Rect,
|
||||||
|
|
||||||
|
//items needed to render the images
|
||||||
|
sems_image_available: Vec<<vk_back::Backend as Backend>::Semaphore>,
|
||||||
|
sems_render_finished: Vec<<vk_back::Backend as Backend>::Semaphore>,
|
||||||
|
fences: Vec<<vk_back::Backend as Backend>::Fence>,
|
||||||
|
image_views: Vec<<vk_back::Backend as Backend>::ImageView>,
|
||||||
|
framebuffers: Vec<<vk_back::Backend as Backend>::Framebuffer>,
|
||||||
|
|
||||||
|
command_pool: ManuallyDrop<<vk_back::Backend as Backend>::CommandPool>,
|
||||||
|
command_buffers: Vec<<vk_back::Backend as Backend>::CommandBuffer>,
|
||||||
|
|
||||||
|
//items needed to keep track of the images
|
||||||
|
image_count: usize,
|
||||||
|
current_image: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl core::ops::Drop for HalState {
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
fn drop(&mut self) {
|
||||||
|
|
||||||
|
let _ = self.device.wait_idle();
|
||||||
|
|
||||||
|
//destroy all underlying ressources
|
||||||
|
debug!("Destroying HAL ressources");
|
||||||
|
unsafe {
|
||||||
|
self.command_pool.free(self.command_buffers.drain(..));
|
||||||
|
self.device.destroy_command_pool(
|
||||||
|
ManuallyDrop::into_inner(read(&mut self.command_pool)));
|
||||||
|
for buffer in self.framebuffers.drain(..) {
|
||||||
|
self.device.destroy_framebuffer(buffer);
|
||||||
|
}
|
||||||
|
for view in self.image_views.drain(..) {
|
||||||
|
self.device.destroy_image_view(view);
|
||||||
|
}
|
||||||
|
for fence in self.fences.drain(..) {
|
||||||
|
self.device.destroy_fence(fence);
|
||||||
|
}
|
||||||
|
for sem in self.sems_image_available.drain(..) {
|
||||||
|
self.device.destroy_semaphore(sem);
|
||||||
|
}
|
||||||
|
for sem in self.sems_render_finished.drain(..) {
|
||||||
|
self.device.destroy_semaphore(sem);
|
||||||
|
}
|
||||||
|
self.device.destroy_swapchain(ManuallyDrop::into_inner(read(&mut self.swapchain)));
|
||||||
|
self.device.destroy_render_pass(ManuallyDrop::into_inner(read(&mut self.render_pass)));
|
||||||
|
ManuallyDrop::drop(&mut self.queue_group);
|
||||||
|
ManuallyDrop::drop(&mut self.adapter);
|
||||||
|
self.instance.destroy_surface(ManuallyDrop::into_inner(read(&mut self.surface)));
|
||||||
|
ManuallyDrop::drop(&mut self.instance);
|
||||||
|
}
|
||||||
|
info!("HAL ressources destroyed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HalState {
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
pub fn recreate_swapchain(&mut self) -> Result<(), &'static str> {
|
||||||
|
use gfx_hal::window::{
|
||||||
|
SwapchainConfig,
|
||||||
|
Surface,
|
||||||
|
};
|
||||||
|
|
||||||
|
debug!("Recreating swapchain");
|
||||||
|
|
||||||
|
//destroying previous swapchain
|
||||||
|
unsafe {
|
||||||
|
for buffer in self.framebuffers.drain(..) {
|
||||||
|
self.device.destroy_framebuffer(buffer);
|
||||||
|
}
|
||||||
|
for view in self.image_views.drain(..) {
|
||||||
|
self.device.destroy_image_view(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.device.destroy_swapchain(ManuallyDrop::into_inner(read(&mut self.swapchain)));
|
||||||
|
}
|
||||||
|
let capabilities = self.surface.capabilities(&self.adapter.physical_device);
|
||||||
|
info!("{:#?}", capabilities);
|
||||||
|
|
||||||
|
//creating new swapchain
|
||||||
|
let swapchain_config = SwapchainConfig::from_caps(&capabilities, self.format, self.extent);
|
||||||
|
info!("{:?}", swapchain_config);
|
||||||
|
|
||||||
|
let (swapchain, backbuffer) = unsafe {
|
||||||
|
self.device
|
||||||
|
.create_swapchain(&mut self.surface, swapchain_config, None)
|
||||||
|
.map_err(|_| "Failed to create swapchain and backbuffer")?
|
||||||
|
};
|
||||||
|
|
||||||
|
let image_views : Vec<_> = {
|
||||||
|
use gfx_hal::{
|
||||||
|
image::{ViewKind, SubresourceRange},
|
||||||
|
format::{Swizzle, Aspects},
|
||||||
|
};
|
||||||
|
|
||||||
|
backbuffer
|
||||||
|
.iter()
|
||||||
|
.map(|img| unsafe {
|
||||||
|
self.device
|
||||||
|
.create_image_view(
|
||||||
|
&img,
|
||||||
|
ViewKind::D2,
|
||||||
|
self.format,
|
||||||
|
Swizzle::NO,
|
||||||
|
SubresourceRange {
|
||||||
|
aspects : Aspects::COLOR,
|
||||||
|
levels : 0..1,
|
||||||
|
layers : 0..1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.map_err(|_| "Could not create ImageViews")
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<_>, &str>>()?
|
||||||
|
};
|
||||||
|
|
||||||
|
let framebuffers: Vec<_> = {
|
||||||
|
|
||||||
|
image_views
|
||||||
|
.iter()
|
||||||
|
.map(|image_view|
|
||||||
|
unsafe {
|
||||||
|
self.device
|
||||||
|
.create_framebuffer(&self.render_pass,
|
||||||
|
iter::once(image_view),
|
||||||
|
self.extent.to_extent())
|
||||||
|
.map_err(|_| "Could not create FrameBuffer")
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.collect::<Result<Vec<_>, &str>>()?
|
||||||
|
};
|
||||||
|
|
||||||
|
self.swapchain = ManuallyDrop::new(swapchain);
|
||||||
|
self.image_views = image_views;
|
||||||
|
self.framebuffers = framebuffers;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
pub fn new(window: &Window) -> Result<HalState, &'static str> {
|
||||||
|
use gfx_hal::adapter::Gpu;
|
||||||
|
|
||||||
|
// create top level
|
||||||
|
let instance = vk_back::Instance::create("IV", 1)
|
||||||
|
.map_err(|_| "Could not create instance")?;
|
||||||
|
|
||||||
|
let mut surface = unsafe {
|
||||||
|
instance
|
||||||
|
.create_surface(window)
|
||||||
|
.map_err(|_| "Could not create Surface")?
|
||||||
|
};
|
||||||
|
|
||||||
|
let (adapter, device, queue_group) = {
|
||||||
|
use gfx_hal::{
|
||||||
|
window::Surface,
|
||||||
|
queue::family::QueueFamily,
|
||||||
|
};
|
||||||
|
|
||||||
|
// find a adapter with a suitable queue family
|
||||||
|
// TODO add weight for adapters
|
||||||
|
let adapter =
|
||||||
|
Instance::enumerate_adapters(&instance)
|
||||||
|
.into_iter();
|
||||||
|
// .find(|a| {
|
||||||
|
// a.queue_families
|
||||||
|
// .iter()
|
||||||
|
// .any(|qf|
|
||||||
|
// QueueFamily::queue_type(qf).supports_graphics()
|
||||||
|
// && Surface::supports_queue_family(&surface, &qf)
|
||||||
|
// )})
|
||||||
|
// .ok_or("Could not find a graphical adapter")?;
|
||||||
|
|
||||||
|
debug!("Adapters : {:#?}", adapter);
|
||||||
|
|
||||||
|
let adapter =
|
||||||
|
Instance::enumerate_adapters(&instance)
|
||||||
|
.into_iter()
|
||||||
|
.find(|a| {
|
||||||
|
a.queue_families
|
||||||
|
.iter()
|
||||||
|
.any(|qf|
|
||||||
|
QueueFamily::queue_type(qf).supports_graphics()
|
||||||
|
&& Surface::supports_queue_family(&surface, &qf)
|
||||||
|
)})
|
||||||
|
.ok_or("Could not find a graphical adapter")?;
|
||||||
|
|
||||||
|
info!("Selected adapter : {}", adapter.info.name);
|
||||||
|
|
||||||
|
// get the suitable queue family index
|
||||||
|
let queue_family = adapter
|
||||||
|
.queue_families
|
||||||
|
.iter()
|
||||||
|
.find(|qf|
|
||||||
|
QueueFamily::queue_type(*qf).supports_graphics()
|
||||||
|
&& Surface::supports_queue_family(&surface, &qf))
|
||||||
|
.ok_or("Could not find suitable queue_family")?;
|
||||||
|
|
||||||
|
// get the related physical device and queue family list
|
||||||
|
let Gpu {device, queue_groups} = unsafe {
|
||||||
|
use gfx_hal::{
|
||||||
|
adapter::PhysicalDevice,
|
||||||
|
Features,
|
||||||
|
};
|
||||||
|
|
||||||
|
adapter
|
||||||
|
.physical_device
|
||||||
|
.open(&[(&queue_family, &[1.0; 1])], Features::empty())
|
||||||
|
.map_err(|_| "Could not open physical device")?
|
||||||
|
};
|
||||||
|
|
||||||
|
// retrieve the selected queue family
|
||||||
|
let queue_group = queue_groups
|
||||||
|
.into_iter()
|
||||||
|
.find(|qg| qg.family == queue_family.id())
|
||||||
|
.ok_or("Could not take ownership of the queue")?;
|
||||||
|
|
||||||
|
// check our harvest
|
||||||
|
if queue_group.queues.len() <= 0 {
|
||||||
|
return Err("The QueueGroup does not have any CommandQueues available");
|
||||||
|
};
|
||||||
|
|
||||||
|
(adapter, device, queue_group)
|
||||||
|
};
|
||||||
|
|
||||||
|
let (swapchain, extent, backbuffer, format, image_count) = {
|
||||||
|
use gfx_hal::window::{
|
||||||
|
SwapchainConfig,
|
||||||
|
Surface,
|
||||||
|
};
|
||||||
|
|
||||||
|
let capabilities = surface.capabilities(&adapter.physical_device);
|
||||||
|
debug!("{:#?}", capabilities);
|
||||||
|
|
||||||
|
// select optimal presentation mode (vsync, triple buffuring, ...)
|
||||||
|
let present_mode = {
|
||||||
|
use gfx_hal::window::PresentMode;
|
||||||
|
|
||||||
|
[PresentMode::MAILBOX, PresentMode::FIFO,
|
||||||
|
PresentMode::RELAXED, PresentMode::IMMEDIATE]
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.find(|pm| capabilities.present_modes.contains(*pm))
|
||||||
|
.ok_or("No PresentMode found")?
|
||||||
|
};
|
||||||
|
|
||||||
|
// select optimal alpha composition
|
||||||
|
// let composite_alpha_mode = {
|
||||||
|
// use gfx_hal::window::CompositeAlphaMode;
|
||||||
|
//
|
||||||
|
// [CompositeAlphaMode::OPAQUE, CompositeAlphaMode::INHERIT,
|
||||||
|
// CompositeAlphaMode::PREMULTIPLIED, CompositeAlphaMode::POSTMULTIPLIED]
|
||||||
|
// .iter()
|
||||||
|
// .cloned()
|
||||||
|
// .find(|cam| capabilities.composite_alpha_modes.contains(*cam))
|
||||||
|
// .ok_or("No CompositeAlphaMode found")?
|
||||||
|
// };
|
||||||
|
|
||||||
|
// select optimal format (sRGB)
|
||||||
|
let format = {
|
||||||
|
use gfx_hal::format::{Format, ChannelType};
|
||||||
|
|
||||||
|
match surface.supported_formats(&adapter.physical_device) {
|
||||||
|
None => Format::Rgba8Srgb,
|
||||||
|
Some(formats) => formats
|
||||||
|
.iter()
|
||||||
|
.find(|f| f.base_format().1 == ChannelType::Srgb)
|
||||||
|
.cloned()
|
||||||
|
.ok_or("Could no find suitabe format")?
|
||||||
|
}};
|
||||||
|
|
||||||
|
let extent = capabilities.extents.end().clone();
|
||||||
|
|
||||||
|
// verify swapchain size
|
||||||
|
let image_count = {
|
||||||
|
use gfx_hal::window::PresentMode;
|
||||||
|
|
||||||
|
capabilities.image_count.end()
|
||||||
|
.min(capabilities.image_count.start()
|
||||||
|
.max(match present_mode {
|
||||||
|
PresentMode::MAILBOX => &3,
|
||||||
|
PresentMode::FIFO => &2,
|
||||||
|
_ => &1,
|
||||||
|
})).clone()
|
||||||
|
};
|
||||||
|
debug!("image count : {}", image_count);
|
||||||
|
|
||||||
|
// // a surface support at least one layer
|
||||||
|
// let image_layers = 1;
|
||||||
|
//
|
||||||
|
// // verify surface compatibility
|
||||||
|
// let image_usage = {
|
||||||
|
// use gfx_hal::image::Usage;
|
||||||
|
//
|
||||||
|
// if capabilities.usage.contains(Usage::COLOR_ATTACHMENT) {
|
||||||
|
// Ok(Usage::COLOR_ATTACHMENT)
|
||||||
|
// } else {
|
||||||
|
// Err("This surface does not support color")
|
||||||
|
// }
|
||||||
|
// }?;
|
||||||
|
|
||||||
|
let swapchain_config = SwapchainConfig::from_caps(&capabilities, format, extent);
|
||||||
|
debug!("{:?}", swapchain_config);
|
||||||
|
|
||||||
|
let (swapchain, backbuffer) = unsafe {
|
||||||
|
device
|
||||||
|
.create_swapchain(&mut surface, swapchain_config, None)
|
||||||
|
.map_err(|_| "Failed to create swapchain and backbuffer")?
|
||||||
|
};
|
||||||
|
|
||||||
|
(swapchain, extent, backbuffer, format, image_count as usize)
|
||||||
|
};
|
||||||
|
|
||||||
|
// creating semaphores and fences
|
||||||
|
let (sems_image_available, sems_render_finished, fences) = {
|
||||||
|
|
||||||
|
let mut sems_image_available : Vec<<vk_back::Backend as Backend>::Semaphore> = vec![];
|
||||||
|
let mut sems_render_finished : Vec<<vk_back::Backend as Backend>::Semaphore> = vec![];
|
||||||
|
let mut fences :Vec<<vk_back::Backend as Backend>::Fence> = vec![];
|
||||||
|
|
||||||
|
for _ in 0..image_count {
|
||||||
|
sems_image_available
|
||||||
|
.push(device
|
||||||
|
.create_semaphore()
|
||||||
|
.map_err(|_| "Could not create sempahore")?
|
||||||
|
);
|
||||||
|
sems_render_finished
|
||||||
|
.push(device
|
||||||
|
.create_semaphore()
|
||||||
|
.map_err(|_| "Could not create sempahore")?
|
||||||
|
);
|
||||||
|
fences
|
||||||
|
.push(device
|
||||||
|
.create_fence(true)
|
||||||
|
.map_err(|_| "Could not create fence")?
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
(sems_image_available, sems_render_finished, fences)
|
||||||
|
};
|
||||||
|
|
||||||
|
// creating RenderPass
|
||||||
|
let render_pass = {
|
||||||
|
use gfx_hal::{
|
||||||
|
pass::{Attachment, AttachmentOps, AttachmentLoadOp, AttachmentStoreOp, SubpassDesc},
|
||||||
|
image::Layout,
|
||||||
|
};
|
||||||
|
|
||||||
|
let color_attachment = Attachment {
|
||||||
|
format : Some(format),
|
||||||
|
samples : 1,
|
||||||
|
ops : AttachmentOps {
|
||||||
|
load : AttachmentLoadOp::Clear,
|
||||||
|
store : AttachmentStoreOp::Store,
|
||||||
|
},
|
||||||
|
stencil_ops : AttachmentOps::DONT_CARE,
|
||||||
|
layouts : (Layout::Undefined..Layout::Present),
|
||||||
|
};
|
||||||
|
|
||||||
|
let subpass = SubpassDesc {
|
||||||
|
colors : &[(0, Layout::ColorAttachmentOptimal)],
|
||||||
|
depth_stencil : None,
|
||||||
|
inputs : &[],
|
||||||
|
resolves : &[],
|
||||||
|
preserves : &[],
|
||||||
|
};
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
device.create_render_pass(&[color_attachment], &[subpass], &[])
|
||||||
|
.map_err(|_| "Could not create render pass")?
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// add ImageView "headers" to images in BackBuffer
|
||||||
|
let image_views : Vec<_> = {
|
||||||
|
use gfx_hal::{
|
||||||
|
image::{ViewKind, SubresourceRange},
|
||||||
|
format::{Swizzle, Aspects},
|
||||||
|
};
|
||||||
|
|
||||||
|
backbuffer
|
||||||
|
.iter()
|
||||||
|
.map(|img| unsafe {
|
||||||
|
device
|
||||||
|
.create_image_view(
|
||||||
|
&img,
|
||||||
|
ViewKind::D2,
|
||||||
|
format,
|
||||||
|
Swizzle::NO,
|
||||||
|
SubresourceRange {
|
||||||
|
aspects : Aspects::COLOR,
|
||||||
|
levels : 0..1,
|
||||||
|
layers : 0..1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.map_err(|_| "Could not create ImageViews")
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<_>, &str>>()?
|
||||||
|
};
|
||||||
|
|
||||||
|
let framebuffers: Vec<_> = {
|
||||||
|
|
||||||
|
image_views
|
||||||
|
.iter()
|
||||||
|
.map(|image_view|
|
||||||
|
unsafe {
|
||||||
|
device
|
||||||
|
.create_framebuffer(&render_pass, vec![image_view], extent.to_extent())
|
||||||
|
.map_err(|_| "Could not create FrameBuffer")
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.collect::<Result<Vec<_>, &str>>()?
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut command_pool = unsafe {
|
||||||
|
use gfx_hal::pool::CommandPoolCreateFlags;
|
||||||
|
|
||||||
|
device
|
||||||
|
.create_command_pool(queue_group.family, CommandPoolCreateFlags::RESET_INDIVIDUAL)
|
||||||
|
.map_err(|_| "Could not create CommandPool")?
|
||||||
|
};
|
||||||
|
|
||||||
|
let command_buffers: Vec<_> = unsafe {
|
||||||
|
use gfx_hal::command::Level;
|
||||||
|
|
||||||
|
framebuffers
|
||||||
|
.iter()
|
||||||
|
.map(|_| command_pool.allocate_one(Level::Primary))
|
||||||
|
.collect()
|
||||||
|
};
|
||||||
|
|
||||||
|
info!("HAL successfully initialized");
|
||||||
|
|
||||||
|
Ok(
|
||||||
|
HalState {
|
||||||
|
instance: ManuallyDrop::new(instance),
|
||||||
|
surface: ManuallyDrop::new(surface),
|
||||||
|
adapter: ManuallyDrop::new(adapter),
|
||||||
|
device: device,
|
||||||
|
queue_group: ManuallyDrop::new(queue_group),
|
||||||
|
render_pass: ManuallyDrop::new(render_pass),
|
||||||
|
swapchain: ManuallyDrop::new(swapchain),
|
||||||
|
extent: extent,
|
||||||
|
format: format,
|
||||||
|
render_area: Rect{x: 0, y: 0, w: 1280, h: 720},
|
||||||
|
sems_image_available,
|
||||||
|
sems_render_finished,
|
||||||
|
fences,
|
||||||
|
image_views,
|
||||||
|
framebuffers,
|
||||||
|
|
||||||
|
command_pool: ManuallyDrop::new(command_pool),
|
||||||
|
command_buffers,
|
||||||
|
|
||||||
|
image_count,
|
||||||
|
current_image: 0,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
116
src/hal/render.rs
Normal file
116
src/hal/render.rs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug,error, info, trace, warn};
|
||||||
|
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
|
use gfx_hal::{
|
||||||
|
device::Device,
|
||||||
|
window::Swapchain,
|
||||||
|
command::CommandBuffer,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::hal::HalState;
|
||||||
|
|
||||||
|
impl HalState {
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
pub fn draw_clear_frame(&mut self, color: [f32; 4]) -> Result<(), &'static str> {
|
||||||
|
use gfx_hal::{
|
||||||
|
command::{SubpassContents, ClearValue, ClearColor, CommandBufferFlags},
|
||||||
|
queue::{Submission, CommandQueue},
|
||||||
|
pso::PipelineStage,
|
||||||
|
};
|
||||||
|
|
||||||
|
// get current frame fence
|
||||||
|
let fence = &self.fences[self.current_image];
|
||||||
|
|
||||||
|
//wait for current fence in case we are submiting too fast
|
||||||
|
unsafe {
|
||||||
|
self.device
|
||||||
|
.wait_for_fence(fence, !0)
|
||||||
|
.map_err(|_| "Failed to wait for fence")?;
|
||||||
|
self.device
|
||||||
|
.reset_fence(fence)
|
||||||
|
.map_err(|_| "Failed to reset fence")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get current frame semaphores
|
||||||
|
let sem_image_available = &self.sems_image_available[self.current_image];
|
||||||
|
let sem_render_finished = &self.sems_render_finished[self.current_image];
|
||||||
|
|
||||||
|
// acquire image id in swapchain
|
||||||
|
let swp_image_id = unsafe {
|
||||||
|
match self.swapchain.acquire_image(core::u64::MAX, Some(sem_image_available), None) {
|
||||||
|
Ok((swp_image_id, suboptimal)) => match suboptimal {
|
||||||
|
Some(_) => {
|
||||||
|
return self.recreate_swapchain()
|
||||||
|
.map_err(|_| "Could not recreate swpachain");
|
||||||
|
},
|
||||||
|
None => swp_image_id,
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
return self.recreate_swapchain()
|
||||||
|
.map_err(|_| "Could not recreate swpachain");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// debug!("current image : {}", self.current_image);
|
||||||
|
// debug!("swapchain index : {}", swp_image_id);
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
|
||||||
|
let command_buffer = &mut self.command_buffers[self.current_image];
|
||||||
|
command_buffer.begin_primary(CommandBufferFlags::ONE_TIME_SUBMIT);
|
||||||
|
|
||||||
|
let clear_value = ClearValue {color: ClearColor{float32: color}};
|
||||||
|
|
||||||
|
command_buffer.begin_render_pass(
|
||||||
|
&self.render_pass,
|
||||||
|
&self.framebuffers[swp_image_id as usize],
|
||||||
|
self.render_area,
|
||||||
|
iter::once(clear_value),
|
||||||
|
SubpassContents::Inline,
|
||||||
|
);
|
||||||
|
command_buffer.end_render_pass();
|
||||||
|
|
||||||
|
command_buffer.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
let command_buffer = &self.command_buffers[self.current_image];
|
||||||
|
|
||||||
|
// prepare the submission
|
||||||
|
let submission = Submission {
|
||||||
|
command_buffers: iter::once(command_buffer),
|
||||||
|
wait_semaphores: iter::once((sem_image_available,
|
||||||
|
PipelineStage::COLOR_ATTACHMENT_OUTPUT)),
|
||||||
|
signal_semaphores: iter::once(sem_render_finished),
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut queue = &mut self.queue_group.queues[0];
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
|
||||||
|
debug!("Submiting");
|
||||||
|
queue.submit(submission, Some(fence));
|
||||||
|
|
||||||
|
debug!("Presenting into swapchain");
|
||||||
|
let result = self.swapchain.present(&mut queue, swp_image_id, Some(sem_render_finished))
|
||||||
|
.map_err(|_| "Failed to present into the swapchain")?;
|
||||||
|
|
||||||
|
if result.is_some() {
|
||||||
|
self.recreate_swapchain()
|
||||||
|
.map_err(|_| "Could not recreate swapchain")?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.current_image = (self.current_image + 1) % self.image_count;
|
||||||
|
|
||||||
|
// if self.current_image == 0 {
|
||||||
|
// panic!("Abort");
|
||||||
|
// }
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
42
src/input.rs
Normal file
42
src/input.rs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug, error, info, trace, warn};
|
||||||
|
|
||||||
|
use winit::{
|
||||||
|
event::{Event, WindowEvent},
|
||||||
|
event_loop::{ControlFlow, EventLoop},
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Input {
|
||||||
|
pub close_request: bool,
|
||||||
|
pub new_frame_size: Option<(f64, f64)>,
|
||||||
|
pub new_mouse_pos: Option<(f64, f64)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Input {
|
||||||
|
|
||||||
|
pub fn poll_events_loop(event_loop: &mut EventLoop<()>) -> Self {
|
||||||
|
let mut input = Input::default();
|
||||||
|
event_loop.run(move |event, _, control_flow| {
|
||||||
|
*control_flow = ControlFlow::Wait;
|
||||||
|
|
||||||
|
match event {
|
||||||
|
Event::WindowEvent{window_id: _, event} => match event {
|
||||||
|
WindowEvent::CloseRequested => input.close_request = true,
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
input
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn default() -> Self {
|
||||||
|
Input {
|
||||||
|
close_request: false,
|
||||||
|
new_frame_size: None,
|
||||||
|
new_mouse_pos: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
42
src/lib.rs
Normal file
42
src/lib.rs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#[cfg(test)]
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/* imports */
|
||||||
|
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug, error, info, trace, warn};
|
||||||
|
|
||||||
|
mod winit_state;
|
||||||
|
use winit_state::WinitState;
|
||||||
|
|
||||||
|
mod hal;
|
||||||
|
use hal::HalState;
|
||||||
|
|
||||||
|
//mod input;
|
||||||
|
//use input::Input;
|
||||||
|
|
||||||
|
//mod local_state;
|
||||||
|
//use local_state::LocalState;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/* functions */
|
||||||
|
|
||||||
|
/// The main function of the library
|
||||||
|
pub fn run() -> Result<(), &'static str> {
|
||||||
|
let winit_state = WinitState::default();
|
||||||
|
|
||||||
|
let mut hal_state = HalState::new(&winit_state.window)?;
|
||||||
|
//let local_state = LocalState::default();
|
||||||
|
|
||||||
|
loop {
|
||||||
|
//local_state.update();
|
||||||
|
let _ = hal_state.draw_clear_frame([0.0, 255.0, 0.0, 0.0])?;
|
||||||
|
//let input = Input::poll_events_loop(&mut winit_state.event_loop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
assert_eq!(2 + 2, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/local_state.rs
Normal file
7
src/local_state.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug, error, info, trace, warn};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct LocalState {
|
||||||
|
local : i32
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
println!("Hello, world!");
|
|
||||||
}
|
|
||||||
49
src/winit_state.rs
Normal file
49
src/winit_state.rs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#[allow(unused_imports)]
|
||||||
|
use log::{debug, error, info, trace, warn};
|
||||||
|
|
||||||
|
use winit::{
|
||||||
|
dpi::PhysicalSize,
|
||||||
|
event_loop::{EventLoop},
|
||||||
|
window::{WindowBuilder, Window},
|
||||||
|
error::OsError,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct WinitState {
|
||||||
|
pub event_loop: EventLoop<()>,
|
||||||
|
pub window: Window,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WinitState {
|
||||||
|
|
||||||
|
pub fn new (title: &str, size: PhysicalSize<u32>) -> Result<WinitState, OsError> {
|
||||||
|
|
||||||
|
let event_loop = EventLoop::new();
|
||||||
|
|
||||||
|
let window = WindowBuilder::new()
|
||||||
|
.with_inner_size(size)
|
||||||
|
.with_title(title)
|
||||||
|
.build(&event_loop)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
event_loop,
|
||||||
|
window,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for WinitState {
|
||||||
|
|
||||||
|
fn default() -> WinitState {
|
||||||
|
|
||||||
|
WinitState::new(
|
||||||
|
"IV",
|
||||||
|
PhysicalSize {
|
||||||
|
width : 1280,
|
||||||
|
height : 720
|
||||||
|
}
|
||||||
|
).unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user