wip 2
This commit is contained in:
parent
0877a91373
commit
9845d5717b
12 changed files with 903 additions and 148 deletions
578
Cargo.lock
generated
578
Cargo.lock
generated
|
|
@ -61,6 +61,12 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aligned-vec"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "allocator-api2"
|
name = "allocator-api2"
|
||||||
version = "0.2.21"
|
version = "0.2.21"
|
||||||
|
|
@ -136,6 +142,12 @@ version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69"
|
checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arbitrary"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arboard"
|
name = "arboard"
|
||||||
version = "3.4.1"
|
version = "3.4.1"
|
||||||
|
|
@ -151,6 +163,17 @@ dependencies = [
|
||||||
"x11rb",
|
"x11rb",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arg_enum_proc_macro"
|
||||||
|
version = "0.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayref"
|
name = "arrayref"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
|
@ -201,6 +224,29 @@ version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "av1-grain"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"arrayvec",
|
||||||
|
"log",
|
||||||
|
"nom",
|
||||||
|
"num-rational",
|
||||||
|
"v_frame",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "avif-serialize"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e335041290c43101ca215eed6f43ec437eb5a42125573f600fc3fa42b9bddd62"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "backtrace"
|
name = "backtrace"
|
||||||
version = "0.3.71"
|
version = "0.3.71"
|
||||||
|
|
@ -231,6 +277,12 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit_field"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.3.2"
|
version = "1.3.2"
|
||||||
|
|
@ -243,6 +295,12 @@ version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitstream-io"
|
||||||
|
version = "2.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block"
|
name = "block"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
|
@ -277,6 +335,12 @@ dependencies = [
|
||||||
"objc2 0.5.2",
|
"objc2 0.5.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "built"
|
||||||
|
version = "0.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.16.0"
|
version = "3.16.0"
|
||||||
|
|
@ -390,6 +454,16 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-expr"
|
||||||
|
version = "0.15.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"
|
||||||
|
dependencies = [
|
||||||
|
"smallvec",
|
||||||
|
"target-lexicon",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
@ -484,6 +558,12 @@ dependencies = [
|
||||||
"tracing-error",
|
"tracing-error",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color_quant"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.7"
|
||||||
|
|
@ -558,12 +638,37 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-deque"
|
||||||
|
version = "0.8.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-epoch",
|
||||||
|
"crossbeam-utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-epoch"
|
||||||
|
version = "0.9.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-utils",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.21"
|
version = "0.8.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crunchy"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cursor-icon"
|
name = "cursor-icon"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
|
@ -747,6 +852,21 @@ version = "3.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f"
|
checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "exr"
|
||||||
|
version = "1.73.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0"
|
||||||
|
dependencies = [
|
||||||
|
"bit_field",
|
||||||
|
"half",
|
||||||
|
"lebe",
|
||||||
|
"miniz_oxide 0.8.2",
|
||||||
|
"rayon-core",
|
||||||
|
"smallvec",
|
||||||
|
"zune-inflate",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eyre"
|
name = "eyre"
|
||||||
version = "0.6.12"
|
version = "0.6.12"
|
||||||
|
|
@ -845,6 +965,16 @@ dependencies = [
|
||||||
"wasi",
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gif"
|
||||||
|
version = "0.13.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2"
|
||||||
|
dependencies = [
|
||||||
|
"color_quant",
|
||||||
|
"weezl",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gimli"
|
name = "gimli"
|
||||||
version = "0.28.1"
|
version = "0.28.1"
|
||||||
|
|
@ -862,15 +992,6 @@ dependencies = [
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glam"
|
|
||||||
version = "0.22.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "12f597d56c1bd55a811a1be189459e8fad2bbc272616375602443bdfb37fa774"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glam"
|
name = "glam"
|
||||||
version = "0.29.2"
|
version = "0.29.2"
|
||||||
|
|
@ -942,6 +1063,16 @@ dependencies = [
|
||||||
"puffin",
|
"puffin",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "half"
|
||||||
|
version = "2.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"crunchy",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.5"
|
version = "0.14.5"
|
||||||
|
|
@ -961,6 +1092,12 @@ dependencies = [
|
||||||
"foldhash",
|
"foldhash",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
|
@ -1134,12 +1271,37 @@ checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"byteorder-lite",
|
"byteorder-lite",
|
||||||
|
"color_quant",
|
||||||
|
"exr",
|
||||||
|
"gif",
|
||||||
|
"image-webp",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"png",
|
"png",
|
||||||
|
"qoi",
|
||||||
|
"ravif",
|
||||||
|
"rayon",
|
||||||
|
"rgb",
|
||||||
|
"tiff",
|
||||||
"zune-core",
|
"zune-core",
|
||||||
"zune-jpeg",
|
"zune-jpeg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "image-webp"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e031e8e3d94711a9ccb5d6ea357439ef3dcbed361798bd4071dc4d9793fbe22f"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder-lite",
|
||||||
|
"quick-error",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "imgref"
|
||||||
|
version = "1.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indenter"
|
name = "indenter"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
|
|
@ -1169,6 +1331,17 @@ version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "969ee3fc68ec2e88eb21434ce4d9b7e1600d1ce92ff974560a6c4a304f5124b9"
|
checksum = "969ee3fc68ec2e88eb21434ce4d9b7e1600d1ce92ff974560a6c4a304f5124b9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "interpolate_name"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
|
|
@ -1178,6 +1351,15 @@ dependencies = [
|
||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.14"
|
version = "1.0.14"
|
||||||
|
|
@ -1215,6 +1397,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jpeg-decoder"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.76"
|
version = "0.3.76"
|
||||||
|
|
@ -1231,12 +1419,28 @@ version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lebe"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.169"
|
version = "0.2.169"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libfuzzer-sys"
|
||||||
|
version = "0.4.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b9569d2f74e257076d8c6bfa73fb505b46b851e51ddaecc825944aa3bed17fa"
|
||||||
|
dependencies = [
|
||||||
|
"arbitrary",
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
version = "0.7.4"
|
version = "0.7.4"
|
||||||
|
|
@ -1308,6 +1512,15 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86"
|
checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "loop9"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"
|
||||||
|
dependencies = [
|
||||||
|
"imgref",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lz4_flex"
|
name = "lz4_flex"
|
||||||
version = "0.11.3"
|
version = "0.11.3"
|
||||||
|
|
@ -1323,6 +1536,16 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maybe-rayon"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"rayon",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.4"
|
version = "2.7.4"
|
||||||
|
|
@ -1338,6 +1561,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "minimal-lexical"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.7.4"
|
version = "0.7.4"
|
||||||
|
|
@ -1418,18 +1647,81 @@ dependencies = [
|
||||||
"jni-sys",
|
"jni-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "new_debug_unreachable"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nohash-hasher"
|
name = "nohash-hasher"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom"
|
||||||
|
version = "7.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"minimal-lexical",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "noop_proc_macro"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-bigint"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
||||||
|
dependencies = [
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-conv"
|
name = "num-conv"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-derive"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.46"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-rational"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
|
||||||
|
dependencies = [
|
||||||
|
"num-bigint",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.19"
|
version = "0.2.19"
|
||||||
|
|
@ -1766,6 +2058,12 @@ dependencies = [
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "paste"
|
||||||
|
version = "1.0.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.3.1"
|
version = "2.3.1"
|
||||||
|
|
@ -1838,6 +2136,15 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "presser"
|
name = "presser"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
|
@ -1862,6 +2169,25 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "profiling"
|
||||||
|
version = "1.0.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d"
|
||||||
|
dependencies = [
|
||||||
|
"profiling-procmacros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "profiling-procmacros"
|
||||||
|
version = "1.0.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "puffin"
|
name = "puffin"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
|
|
@ -1893,6 +2219,21 @@ dependencies = [
|
||||||
"web-time 0.2.4",
|
"web-time 0.2.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "qoi"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-error"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.36.2"
|
version = "0.36.2"
|
||||||
|
|
@ -1911,6 +2252,86 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rav1e"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9"
|
||||||
|
dependencies = [
|
||||||
|
"arbitrary",
|
||||||
|
"arg_enum_proc_macro",
|
||||||
|
"arrayvec",
|
||||||
|
"av1-grain",
|
||||||
|
"bitstream-io",
|
||||||
|
"built",
|
||||||
|
"cfg-if",
|
||||||
|
"interpolate_name",
|
||||||
|
"itertools 0.12.1",
|
||||||
|
"libc",
|
||||||
|
"libfuzzer-sys",
|
||||||
|
"log",
|
||||||
|
"maybe-rayon",
|
||||||
|
"new_debug_unreachable",
|
||||||
|
"noop_proc_macro",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"once_cell",
|
||||||
|
"paste",
|
||||||
|
"profiling",
|
||||||
|
"rand",
|
||||||
|
"rand_chacha",
|
||||||
|
"simd_helpers",
|
||||||
|
"system-deps",
|
||||||
|
"thiserror",
|
||||||
|
"v_frame",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ravif"
|
||||||
|
version = "0.11.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6"
|
||||||
|
dependencies = [
|
||||||
|
"avif-serialize",
|
||||||
|
"imgref",
|
||||||
|
"loop9",
|
||||||
|
"quick-error",
|
||||||
|
"rav1e",
|
||||||
|
"rayon",
|
||||||
|
"rgb",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-string"
|
name = "raw-string"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
|
|
@ -1941,6 +2362,26 @@ dependencies = [
|
||||||
"raw-window-handle 0.5.2",
|
"raw-window-handle 0.5.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rayon"
|
||||||
|
version = "1.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
"rayon-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rayon-core"
|
||||||
|
version = "1.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-deque",
|
||||||
|
"crossbeam-utils",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
|
|
@ -1997,6 +2438,12 @@ version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rgb"
|
||||||
|
version = "0.8.50"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rspirv"
|
name = "rspirv"
|
||||||
version = "0.12.0+sdk-1.3.268.0"
|
version = "0.12.0+sdk-1.3.268.0"
|
||||||
|
|
@ -2038,7 +2485,7 @@ dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"either",
|
"either",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -2199,11 +2646,19 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_spanned"
|
||||||
|
version = "0.6.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shaders"
|
name = "shaders"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam 0.22.0",
|
|
||||||
"shaders-shared",
|
"shaders-shared",
|
||||||
"spirv-std",
|
"spirv-std",
|
||||||
]
|
]
|
||||||
|
|
@ -2212,7 +2667,8 @@ dependencies = [
|
||||||
name = "shaders-shared"
|
name = "shaders-shared"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam 0.22.0",
|
"bytemuck",
|
||||||
|
"spirv-std",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -2236,6 +2692,15 @@ version = "0.3.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simd_helpers"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
|
|
@ -2336,7 +2801,7 @@ dependencies = [
|
||||||
"elsa",
|
"elsa",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"internal-iterator",
|
"internal-iterator",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"longest-increasing-subsequence",
|
"longest-increasing-subsequence",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
|
|
@ -2373,7 +2838,7 @@ version = "0.9.0"
|
||||||
source = "git+https://github.com/Rust-GPU/rust-gpu.git#bfa63c15a921357b38aa78986670c15f36df76dc"
|
source = "git+https://github.com/Rust-GPU/rust-gpu.git#bfa63c15a921357b38aa78986670c15f36df76dc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"glam 0.29.2",
|
"glam",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"spirv-std-macros",
|
"spirv-std-macros",
|
||||||
"spirv-std-types",
|
"spirv-std-types",
|
||||||
|
|
@ -2453,6 +2918,25 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "system-deps"
|
||||||
|
version = "6.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-expr",
|
||||||
|
"heck",
|
||||||
|
"pkg-config",
|
||||||
|
"toml",
|
||||||
|
"version-compare",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "target-lexicon"
|
||||||
|
version = "0.12.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.69"
|
version = "1.0.69"
|
||||||
|
|
@ -2495,6 +2979,17 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tiff"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
|
||||||
|
dependencies = [
|
||||||
|
"flate2",
|
||||||
|
"jpeg-decoder",
|
||||||
|
"weezl",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.37"
|
version = "0.3.37"
|
||||||
|
|
@ -2570,11 +3065,26 @@ dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.8.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_edit",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.8"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
|
|
@ -2583,6 +3093,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
@ -2697,6 +3209,17 @@ version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "v_frame"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b"
|
||||||
|
dependencies = [
|
||||||
|
"aligned-vec",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "valuable"
|
name = "valuable"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -2709,6 +3232,12 @@ version = "1.12.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eab68b56840f69efb0fefbe3ab6661499217ffdc58e2eef7c3f6f69835386322"
|
checksum = "eab68b56840f69efb0fefbe3ab6661499217ffdc58e2eef7c3f6f69835386322"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version-compare"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
|
|
@ -2721,20 +3250,23 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash",
|
"ash",
|
||||||
"ash-window",
|
"ash-window",
|
||||||
|
"bytemuck",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cgmath",
|
"cgmath",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"egui",
|
"egui",
|
||||||
"egui-ash",
|
"egui-ash",
|
||||||
"glam 0.22.0",
|
|
||||||
"gltf",
|
"gltf",
|
||||||
"gpu-allocator",
|
"gpu-allocator",
|
||||||
"gpu-profiler",
|
"gpu-profiler",
|
||||||
|
"image",
|
||||||
"puffin",
|
"puffin",
|
||||||
"puffin_egui",
|
"puffin_egui",
|
||||||
"raw-window-handle 0.6.2",
|
"raw-window-handle 0.6.2",
|
||||||
|
"rayon",
|
||||||
"shaders-shared",
|
"shaders-shared",
|
||||||
"spirv-builder",
|
"spirv-builder",
|
||||||
|
"spirv-std",
|
||||||
"tobj",
|
"tobj",
|
||||||
"winit 0.30.7",
|
"winit 0.30.7",
|
||||||
]
|
]
|
||||||
|
|
@ -3025,6 +3557,12 @@ dependencies = [
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "weezl"
|
||||||
|
version = "0.1.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
|
@ -3498,6 +4036,7 @@ version = "0.7.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
"zerocopy-derive",
|
"zerocopy-derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -3561,6 +4100,15 @@ version = "0.4.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
|
checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zune-inflate"
|
||||||
|
version = "0.2.54"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
|
||||||
|
dependencies = [
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zune-jpeg"
|
name = "zune-jpeg"
|
||||||
version = "0.4.14"
|
version = "0.4.14"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ winit = { version = "0.30.7", features = ["rwh_06"] }
|
||||||
raw-window-handle = "0.6"
|
raw-window-handle = "0.6"
|
||||||
gpu-allocator = { version = "0.25.0", features = ["vulkan"] }
|
gpu-allocator = { version = "0.25.0", features = ["vulkan"] }
|
||||||
glam = { version = "0.22", default-features = false, features = ["libm"] }
|
glam = { version = "0.22", default-features = false, features = ["libm"] }
|
||||||
|
bytemuck = "1.21.0"
|
||||||
|
|
||||||
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu.git" }
|
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu.git" }
|
||||||
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu.git" }
|
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu.git" }
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,5 @@ version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glam.workspace = true
|
spirv-std.workspace = true
|
||||||
|
bytemuck.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||||
|
|
||||||
use glam::{Mat4, Vec3};
|
use spirv_std::glam::{Mat4, Vec3, Vec4};
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
@ -10,3 +10,12 @@ pub struct UniformBufferObject {
|
||||||
pub proj: Mat4,
|
pub proj: Mat4,
|
||||||
pub model_color: Vec3,
|
pub model_color: Vec3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub struct PushConstants {
|
||||||
|
pub texture_size: Vec4,
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl bytemuck::Pod for PushConstants {}
|
||||||
|
unsafe impl bytemuck::Zeroable for PushConstants {}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,5 @@ crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
spirv-std.workspace = true
|
spirv-std.workspace = true
|
||||||
glam.workspace = true
|
|
||||||
|
|
||||||
shaders-shared = { path = "../shaders-shared" }
|
shaders-shared = { path = "../shaders-shared" }
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,18 @@
|
||||||
#![cfg_attr(target_arch = "spirv", no_std)]
|
#![cfg_attr(target_arch = "spirv", no_std)]
|
||||||
|
|
||||||
use shaders_shared::UniformBufferObject;
|
use shaders_shared::UniformBufferObject;
|
||||||
use spirv_std::{glam::Vec2, image::Image2d, spirv, Image, Sampler};
|
use spirv_std::{
|
||||||
|
glam::{Mat3, UVec2, Vec2, Vec3, Vec4, Vec4Swizzles},
|
||||||
use glam::{Mat3, Vec3, Vec4, Vec4Swizzles};
|
image::Image2d,
|
||||||
|
spirv, Sampler,
|
||||||
|
};
|
||||||
|
|
||||||
#[spirv(vertex)]
|
#[spirv(vertex)]
|
||||||
pub fn main_vs(
|
pub fn main_vs(
|
||||||
// Vertex inputs
|
// Vertex inputs
|
||||||
in_pos: Vec3,
|
in_pos: Vec3,
|
||||||
in_normal: Vec3,
|
in_normal: Vec3,
|
||||||
|
in_tex_coord: Vec2,
|
||||||
|
|
||||||
// Uniform buffer
|
// Uniform buffer
|
||||||
#[spirv(uniform, descriptor_set = 0, binding = 0)] ubo: &UniformBufferObject,
|
#[spirv(uniform, descriptor_set = 0, binding = 0)] ubo: &UniformBufferObject,
|
||||||
|
|
@ -17,6 +20,7 @@ pub fn main_vs(
|
||||||
// Vertex outputs
|
// Vertex outputs
|
||||||
out_world_position: &mut Vec3,
|
out_world_position: &mut Vec3,
|
||||||
out_world_normal: &mut Vec3,
|
out_world_normal: &mut Vec3,
|
||||||
|
out_tex_coord: &mut Vec2,
|
||||||
#[spirv(position)] gl_position: &mut Vec4,
|
#[spirv(position)] gl_position: &mut Vec4,
|
||||||
) {
|
) {
|
||||||
// Transform position to world space
|
// Transform position to world space
|
||||||
|
|
@ -29,6 +33,11 @@ pub fn main_vs(
|
||||||
|
|
||||||
// Calculate clip space position
|
// Calculate clip space position
|
||||||
*gl_position = ubo.proj * ubo.view * pos;
|
*gl_position = ubo.proj * ubo.view * pos;
|
||||||
|
*out_tex_coord = in_tex_coord;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_uv_u(pix: UVec2, tex_size: Vec4) -> spirv_std::glam::Vec2 {
|
||||||
|
(pix.as_vec2() + Vec2::splat(0.5)) * tex_size.zw()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[spirv(fragment)]
|
#[spirv(fragment)]
|
||||||
|
|
@ -36,29 +45,30 @@ pub fn main_fs(
|
||||||
frag_world_position: Vec3,
|
frag_world_position: Vec3,
|
||||||
frag_world_normal: Vec3,
|
frag_world_normal: Vec3,
|
||||||
frag_tex_coord: Vec2,
|
frag_tex_coord: Vec2,
|
||||||
#[spirv(uniform, descriptor_set = 0, binding = 0)] ubo: &UniformBufferObject,
|
|
||||||
#[spirv(descriptor_set = 0, binding = 1)] texture: &Image2d,
|
#[spirv(descriptor_set = 0, binding = 1)] texture: &Image2d,
|
||||||
#[spirv(descriptor_set = 0, binding = 2)] sampler: &Sampler,
|
#[spirv(descriptor_set = 0, binding = 2)] sampler: &Sampler,
|
||||||
out_color: &mut Vec4,
|
out_color: &mut Vec4,
|
||||||
) {
|
) {
|
||||||
|
// Convert fragment coordinate to UV coordinate
|
||||||
|
// Sample the texture
|
||||||
let base_color = texture.sample(*sampler, frag_tex_coord);
|
let base_color = texture.sample(*sampler, frag_tex_coord);
|
||||||
let light_pos = Vec3::new(2.0, 2.0, -2.0);
|
// let light_pos = Vec3::new(2.0, 2.0, -2.0);
|
||||||
|
//
|
||||||
// Calculate light direction
|
// // Calculate light direction
|
||||||
let l = (light_pos - frag_world_position).normalize();
|
// let l = (light_pos - frag_world_position).normalize();
|
||||||
let n = frag_world_normal.normalize();
|
// let n = frag_world_normal.normalize();
|
||||||
|
//
|
||||||
// Calculate lambertian lighting
|
// // Calculate lambertian lighting
|
||||||
let lambertian = f32::max(n.dot(l), 0.0);
|
// let lambertian = f32::max(n.dot(l), 0.0);
|
||||||
|
//
|
||||||
// Ambient lighting
|
// // Ambient lighting
|
||||||
let ambient = Vec3::splat(0.2);
|
// let ambient = Vec3::splat(0.2);
|
||||||
|
//
|
||||||
// Combine texture color with model color
|
// // Combine texture color with model color
|
||||||
let color_from_texture = Vec3::new(base_color.x, base_color.y, base_color.z);
|
// let color_from_texture = Vec3::new(base_color.x, base_color.y, base_color.z);
|
||||||
let combined_color = color_from_texture * ubo.model_color;
|
// let combined_color = color_from_texture;
|
||||||
|
//
|
||||||
// Final color calculation with gamma correction
|
// // Final color calculation with gamma correction
|
||||||
let color = (combined_color * lambertian + ambient).powf(2.2);
|
// let color = (combined_color * lambertian + ambient).powf(2.2);
|
||||||
*out_color = Vec4::from((color, 1.0));
|
*out_color = Vec4::new(base_color.x, base_color.y, base_color.z, base_color.w);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ winit.workspace = true
|
||||||
raw-window-handle.workspace = true
|
raw-window-handle.workspace = true
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
cgmath = "0.18.0"
|
cgmath = "0.18.0"
|
||||||
glam.workspace = true
|
spirv-std.workspace = true
|
||||||
gpu-allocator.workspace = true
|
gpu-allocator.workspace = true
|
||||||
egui-ash = { version = "0.4.0", features = ["gpu-allocator"] }
|
egui-ash = { version = "0.4.0", features = ["gpu-allocator"] }
|
||||||
tobj = "4.0.2"
|
tobj = "4.0.2"
|
||||||
|
|
@ -23,6 +23,9 @@ gpu-profiler = { git = "https://github.com/zackartz/gpu-profiler", features = [
|
||||||
"use-ash",
|
"use-ash",
|
||||||
] }
|
] }
|
||||||
gltf = { version = "1.4.1", features = ["import"] }
|
gltf = { version = "1.4.1", features = ["import"] }
|
||||||
|
image = "0.25.5"
|
||||||
|
rayon = "1.10.0"
|
||||||
|
bytemuck.workspace = true
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
spirv-builder.workspace = true
|
spirv-builder.workspace = true
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
|
f32::consts::PI,
|
||||||
ffi::CString,
|
ffi::CString,
|
||||||
mem::ManuallyDrop,
|
mem::ManuallyDrop,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
|
|
@ -13,16 +14,16 @@ use ash::{
|
||||||
vk::{self, KhrAccelerationStructureFn, KhrDeferredHostOperationsFn, KhrRayTracingPipelineFn},
|
vk::{self, KhrAccelerationStructureFn, KhrDeferredHostOperationsFn, KhrRayTracingPipelineFn},
|
||||||
Device, Entry, Instance,
|
Device, Entry, Instance,
|
||||||
};
|
};
|
||||||
use egui::widgets;
|
|
||||||
use egui_ash::{
|
use egui_ash::{
|
||||||
raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle},
|
raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle},
|
||||||
winit, App, AppCreator, AshRenderState, CreationContext, HandleRedraw, RunOption, Theme,
|
winit, App, AppCreator, AshRenderState, CreationContext, HandleRedraw, RunOption, Theme,
|
||||||
};
|
};
|
||||||
use glam::Vec3;
|
|
||||||
use gpu_allocator::vulkan::{Allocator, AllocatorCreateDesc};
|
use gpu_allocator::vulkan::{Allocator, AllocatorCreateDesc};
|
||||||
use renderer::Renderer;
|
use renderer::Renderer;
|
||||||
|
use spirv_std::glam::Vec3;
|
||||||
|
|
||||||
mod renderer;
|
mod renderer;
|
||||||
|
mod texture_cache;
|
||||||
|
|
||||||
struct Game {
|
struct Game {
|
||||||
entry: Entry,
|
entry: Entry,
|
||||||
|
|
@ -131,11 +132,10 @@ impl App for Game {
|
||||||
if !ctx.wants_keyboard_input() {
|
if !ctx.wants_keyboard_input() {
|
||||||
let movement_speed = 0.1;
|
let movement_speed = 0.1;
|
||||||
|
|
||||||
// Calculate forward direction using yaw
|
|
||||||
let forward = Vec3::new(
|
let forward = Vec3::new(
|
||||||
self.camera_yaw.sin(),
|
self.camera_yaw.sin() * self.camera_pitch.cos(),
|
||||||
self.camera_pitch.sin(),
|
self.camera_pitch.sin(),
|
||||||
self.camera_yaw.cos(),
|
self.camera_yaw.cos() * self.camera_pitch.cos(),
|
||||||
)
|
)
|
||||||
.normalize();
|
.normalize();
|
||||||
|
|
||||||
|
|
@ -263,9 +263,13 @@ impl Drop for Game {
|
||||||
|
|
||||||
struct MyAppCreator;
|
struct MyAppCreator;
|
||||||
impl MyAppCreator {
|
impl MyAppCreator {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
const ENABLE_VALIDATION_LAYERS: bool = true;
|
const ENABLE_VALIDATION_LAYERS: bool = true;
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
const ENABLE_VALIDATION_LAYERS: bool = false;
|
||||||
const VALIDATION: [&'static str; 1] = ["VK_LAYER_KHRONOS_validation"];
|
const VALIDATION: [&'static str; 1] = ["VK_LAYER_KHRONOS_validation"];
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
unsafe extern "system" fn vulkan_debug_utils_callback(
|
unsafe extern "system" fn vulkan_debug_utils_callback(
|
||||||
message_severity: vk::DebugUtilsMessageSeverityFlagsEXT,
|
message_severity: vk::DebugUtilsMessageSeverityFlagsEXT,
|
||||||
message_types: vk::DebugUtilsMessageTypeFlagsEXT,
|
message_types: vk::DebugUtilsMessageTypeFlagsEXT,
|
||||||
|
|
@ -291,6 +295,16 @@ impl MyAppCreator {
|
||||||
vk::FALSE
|
vk::FALSE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
unsafe extern "system" fn vulkan_debug_utils_callback(
|
||||||
|
_message_severity: vk::DebugUtilsMessageSeverityFlagsEXT,
|
||||||
|
_message_types: vk::DebugUtilsMessageTypeFlagsEXT,
|
||||||
|
_p_callback_data: *const vk::DebugUtilsMessengerCallbackDataEXT,
|
||||||
|
_p_user_data: *mut std::ffi::c_void,
|
||||||
|
) -> vk::Bool32 {
|
||||||
|
vk::FALSE
|
||||||
|
}
|
||||||
|
|
||||||
fn create_entry() -> Entry {
|
fn create_entry() -> Entry {
|
||||||
unsafe { Entry::load().unwrap() }
|
unsafe { Entry::load().unwrap() }
|
||||||
}
|
}
|
||||||
|
|
@ -639,7 +653,7 @@ impl AppCreator<Arc<Mutex<Allocator>>> for MyAppCreator {
|
||||||
camera_position: Vec3::new(0.0, 0.0, -5.0),
|
camera_position: Vec3::new(0.0, 0.0, -5.0),
|
||||||
camera_pitch: 0.,
|
camera_pitch: 0.,
|
||||||
camera_yaw: 0.,
|
camera_yaw: 0.,
|
||||||
camera_fov: 45.,
|
camera_fov: 90.,
|
||||||
bg_color: Vec3::splat(0.1).into(),
|
bg_color: Vec3::splat(0.1).into(),
|
||||||
model_color: Vec3::splat(0.8).into(),
|
model_color: Vec3::splat(0.8).into(),
|
||||||
last_mouse_pos: None,
|
last_mouse_pos: None,
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,23 @@
|
||||||
use ash::{
|
use ash::{
|
||||||
extensions::khr::{Surface, Swapchain},
|
extensions::khr::{Surface, Swapchain},
|
||||||
vk::{self, Buffer, ImageAspectFlags},
|
vk::{self, Buffer},
|
||||||
Device,
|
Device,
|
||||||
};
|
};
|
||||||
use egui::Vec2;
|
use egui::Vec2;
|
||||||
use egui_ash::EguiCommand;
|
use egui_ash::EguiCommand;
|
||||||
use glam::{Mat4, Vec3};
|
|
||||||
use gltf::json::buffer::View;
|
|
||||||
use gpu_allocator::vulkan::{Allocation, AllocationCreateDesc, Allocator};
|
use gpu_allocator::vulkan::{Allocation, AllocationCreateDesc, Allocator};
|
||||||
use shaders_shared::UniformBufferObject;
|
use shaders_shared::{PushConstants, UniformBufferObject};
|
||||||
|
use spirv_std::glam::{Mat4, Vec3, Vec4};
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CString,
|
ffi::CString,
|
||||||
mem::ManuallyDrop,
|
mem::ManuallyDrop,
|
||||||
path::{Path, PathBuf},
|
path::Path,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::texture_cache::TextureCache;
|
||||||
|
|
||||||
macro_rules! include_spirv {
|
macro_rules! include_spirv {
|
||||||
($file:literal) => {{
|
($file:literal) => {{
|
||||||
let bytes = include_bytes!($file);
|
let bytes = include_bytes!($file);
|
||||||
|
|
@ -91,6 +93,8 @@ impl Texture {
|
||||||
let mut allocator = allocator.lock().unwrap();
|
let mut allocator = allocator.lock().unwrap();
|
||||||
|
|
||||||
let buffer_size = data.len() as u64;
|
let buffer_size = data.len() as u64;
|
||||||
|
|
||||||
|
println!("DATA LEN: {}", buffer_size);
|
||||||
let staging_buffer = unsafe {
|
let staging_buffer = unsafe {
|
||||||
device
|
device
|
||||||
.create_buffer(
|
.create_buffer(
|
||||||
|
|
@ -163,7 +167,7 @@ impl Texture {
|
||||||
.expect("failed to bind image memory")
|
.expect("failed to bind image memory")
|
||||||
};
|
};
|
||||||
|
|
||||||
let command_buffer = unsafe {
|
unsafe {
|
||||||
let command_buffer = device
|
let command_buffer = device
|
||||||
.allocate_command_buffers(
|
.allocate_command_buffers(
|
||||||
&vk::CommandBufferAllocateInfo::builder()
|
&vk::CommandBufferAllocateInfo::builder()
|
||||||
|
|
@ -218,7 +222,10 @@ impl Texture {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
depth: 1,
|
depth: 1,
|
||||||
});
|
})
|
||||||
|
.buffer_offset(0)
|
||||||
|
.buffer_row_length(width)
|
||||||
|
.buffer_image_height(height);
|
||||||
|
|
||||||
device.cmd_copy_buffer_to_image(
|
device.cmd_copy_buffer_to_image(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
|
|
@ -329,7 +336,7 @@ impl Texture {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&mut self, device: &Device, allocator: &mut Allocator) {
|
pub fn destroy(&mut self, device: &Device, allocator: &mut Allocator) {
|
||||||
unsafe {
|
unsafe {
|
||||||
device.destroy_sampler(self.sampler, None);
|
device.destroy_sampler(self.sampler, None);
|
||||||
device.destroy_image_view(self.image_view, None);
|
device.destroy_image_view(self.image_view, None);
|
||||||
|
|
@ -346,11 +353,29 @@ pub struct Mesh {
|
||||||
vertex_buffer_allocation: Option<Allocation>,
|
vertex_buffer_allocation: Option<Allocation>,
|
||||||
vertex_count: u32,
|
vertex_count: u32,
|
||||||
transform: Mat4,
|
transform: Mat4,
|
||||||
texture: Option<Texture>,
|
texture: Option<Arc<Texture>>,
|
||||||
|
descriptor_sets: Vec<vk::DescriptorSet>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
meshes: Vec<Mesh>,
|
meshes: Vec<Mesh>,
|
||||||
|
texture_cache: TextureCache,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Model {
|
||||||
|
fn destroy(&mut self, device: &Device, allocator: &mut Allocator) {
|
||||||
|
for mesh in &mut self.meshes {
|
||||||
|
unsafe {
|
||||||
|
device.destroy_buffer(mesh.vertex_buffer, None);
|
||||||
|
if let Some(vertex_buffer_allocation) = mesh.vertex_buffer_allocation.take() {
|
||||||
|
allocator
|
||||||
|
.free(vertex_buffer_allocation)
|
||||||
|
.expect("Failed to free memory");
|
||||||
|
}
|
||||||
|
self.texture_cache.cleanup(device, allocator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_texture_from_gltf(
|
fn load_texture_from_gltf(
|
||||||
|
|
@ -362,28 +387,27 @@ fn load_texture_from_gltf(
|
||||||
buffers: &[gltf::buffer::Data],
|
buffers: &[gltf::buffer::Data],
|
||||||
path: &Path,
|
path: &Path,
|
||||||
) -> Option<Texture> {
|
) -> Option<Texture> {
|
||||||
let image = texture.source();
|
|
||||||
let data = match image.source() {
|
|
||||||
gltf::image::Source::View { view, .. } => {
|
|
||||||
// Handle embedded buffer view
|
|
||||||
match view.buffer().source() {
|
|
||||||
gltf::buffer::Source::Bin => {
|
|
||||||
let start = view.offset();
|
|
||||||
let end = start + view.length();
|
|
||||||
buffers[0][start..end].to_vec()
|
|
||||||
}
|
|
||||||
_ => return None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gltf::image::Source::Uri { .. } => {
|
|
||||||
// For URI sources, we'll get the data directly from gltf::image::Data
|
|
||||||
let img_data =
|
let img_data =
|
||||||
gltf::image::Data::from_source(image.source(), Some(path), buffers).ok()?;
|
gltf::image::Data::from_source(texture.source().source(), Some(path), buffers).ok()?;
|
||||||
img_data.pixels.clone().to_vec()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let img_data = gltf::image::Data::from_source(image.source(), Some(path), buffers).ok()?;
|
println!(
|
||||||
|
"Original texture dimensions: {}x{}",
|
||||||
|
img_data.width, img_data.height
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert to RGB/RGBA
|
||||||
|
let pixels_rgba = if img_data.pixels.len() == (img_data.width * img_data.height * 3) as usize {
|
||||||
|
// Image is RGB, convert to RGBA
|
||||||
|
println!("Converting RGB to RGBA");
|
||||||
|
let mut rgba_data = Vec::with_capacity((img_data.width * img_data.height * 4) as usize);
|
||||||
|
for chunk in img_data.pixels.chunks_exact(3) {
|
||||||
|
rgba_data.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);
|
||||||
|
}
|
||||||
|
rgba_data
|
||||||
|
} else {
|
||||||
|
// Assume it's already RGBA
|
||||||
|
img_data.pixels
|
||||||
|
};
|
||||||
|
|
||||||
Some(Texture::new(
|
Some(Texture::new(
|
||||||
device,
|
device,
|
||||||
|
|
@ -392,7 +416,7 @@ fn load_texture_from_gltf(
|
||||||
queue,
|
queue,
|
||||||
img_data.width,
|
img_data.width,
|
||||||
img_data.height,
|
img_data.height,
|
||||||
&data,
|
&pixels_rgba,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -408,6 +432,7 @@ impl Model {
|
||||||
let base_path = path.parent();
|
let base_path = path.parent();
|
||||||
let (document, buffers, _) = gltf::import(path).expect("failed to load GLTF");
|
let (document, buffers, _) = gltf::import(path).expect("failed to load GLTF");
|
||||||
let mut meshes = Vec::new();
|
let mut meshes = Vec::new();
|
||||||
|
let mut texture_cache = TextureCache::new();
|
||||||
|
|
||||||
for scene in document.scenes() {
|
for scene in document.scenes() {
|
||||||
for node in scene.nodes() {
|
for node in scene.nodes() {
|
||||||
|
|
@ -420,11 +445,15 @@ impl Model {
|
||||||
command_pool,
|
command_pool,
|
||||||
queue,
|
queue,
|
||||||
base_path.unwrap(),
|
base_path.unwrap(),
|
||||||
|
&mut texture_cache,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Self { meshes }
|
Self {
|
||||||
|
meshes,
|
||||||
|
texture_cache,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -437,6 +466,7 @@ fn process_node(
|
||||||
command_pool: vk::CommandPool,
|
command_pool: vk::CommandPool,
|
||||||
queue: vk::Queue,
|
queue: vk::Queue,
|
||||||
path: &Path,
|
path: &Path,
|
||||||
|
texture_cache: &mut TextureCache,
|
||||||
) -> Vec<Mesh> {
|
) -> Vec<Mesh> {
|
||||||
let mut meshes = Vec::new();
|
let mut meshes = Vec::new();
|
||||||
|
|
||||||
|
|
@ -444,7 +474,7 @@ fn process_node(
|
||||||
let (translation, rotation, scale) = node.transform().decomposed();
|
let (translation, rotation, scale) = node.transform().decomposed();
|
||||||
Mat4::from_scale_rotation_translation(
|
Mat4::from_scale_rotation_translation(
|
||||||
Vec3::from(scale),
|
Vec3::from(scale),
|
||||||
glam::Quat::from_array(rotation),
|
spirv_std::glam::Quat::from_array(rotation),
|
||||||
Vec3::from(translation),
|
Vec3::from(translation),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
@ -457,6 +487,9 @@ fn process_node(
|
||||||
.pbr_metallic_roughness()
|
.pbr_metallic_roughness()
|
||||||
.base_color_texture()
|
.base_color_texture()
|
||||||
.and_then(|tex| {
|
.and_then(|tex| {
|
||||||
|
// Create a unique key for the texture
|
||||||
|
let key = format!("{:?}", tex.texture().source().source());
|
||||||
|
texture_cache.get_or_load_texture(key, || {
|
||||||
load_texture_from_gltf(
|
load_texture_from_gltf(
|
||||||
device,
|
device,
|
||||||
allocator.clone(),
|
allocator.clone(),
|
||||||
|
|
@ -466,8 +499,10 @@ fn process_node(
|
||||||
buffers,
|
buffers,
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Rest of the mesh creation code...
|
||||||
let reader = primitive.reader(|buffer| Some(&buffers[buffer.index()]));
|
let reader = primitive.reader(|buffer| Some(&buffers[buffer.index()]));
|
||||||
|
|
||||||
if let (Some(positions), Some(normals), Some(tex_coords)) = (
|
if let (Some(positions), Some(normals), Some(tex_coords)) = (
|
||||||
|
|
@ -477,16 +512,16 @@ fn process_node(
|
||||||
) {
|
) {
|
||||||
let mut vertices = Vec::new();
|
let mut vertices = Vec::new();
|
||||||
|
|
||||||
let indicies = reader
|
let indices = reader
|
||||||
.read_indices()
|
.read_indices()
|
||||||
.map(|indicies| indicies.into_u32().collect::<Vec<_>>())
|
.map(|indices| indices.into_u32().collect::<Vec<_>>())
|
||||||
.unwrap_or_else(|| (0..positions.len() as u32).collect());
|
.unwrap_or_else(|| (0..positions.len() as u32).collect());
|
||||||
|
|
||||||
let positions: Vec<_> = positions.collect();
|
let positions: Vec<_> = positions.collect();
|
||||||
let normals: Vec<_> = normals.collect();
|
let normals: Vec<_> = normals.collect();
|
||||||
let tex_coords: Vec<_> = tex_coords.into_f32().collect();
|
let tex_coords: Vec<_> = tex_coords.into_f32().collect();
|
||||||
|
|
||||||
for &index in indicies.iter() {
|
for &index in indices.iter() {
|
||||||
let i = index as usize;
|
let i = index as usize;
|
||||||
let vertex = Vertex {
|
let vertex = Vertex {
|
||||||
position: Vec3::new(positions[i][0], positions[i][1], positions[i][2]),
|
position: Vec3::new(positions[i][0], positions[i][1], positions[i][2]),
|
||||||
|
|
@ -505,6 +540,7 @@ fn process_node(
|
||||||
vertex_count: vertices.len() as u32,
|
vertex_count: vertices.len() as u32,
|
||||||
transform: world_transform,
|
transform: world_transform,
|
||||||
texture,
|
texture,
|
||||||
|
descriptor_sets: Vec::new(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -520,6 +556,7 @@ fn process_node(
|
||||||
command_pool,
|
command_pool,
|
||||||
queue,
|
queue,
|
||||||
path,
|
path,
|
||||||
|
texture_cache,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -680,7 +717,6 @@ pub struct RendererInner {
|
||||||
uniform_buffer_allocations: Vec<Allocation>,
|
uniform_buffer_allocations: Vec<Allocation>,
|
||||||
descriptor_pool: vk::DescriptorPool,
|
descriptor_pool: vk::DescriptorPool,
|
||||||
descriptor_set_layouts: Vec<vk::DescriptorSetLayout>,
|
descriptor_set_layouts: Vec<vk::DescriptorSetLayout>,
|
||||||
descriptor_sets: Vec<vk::DescriptorSet>,
|
|
||||||
render_pass: vk::RenderPass,
|
render_pass: vk::RenderPass,
|
||||||
framebuffers: Vec<vk::Framebuffer>,
|
framebuffers: Vec<vk::Framebuffer>,
|
||||||
depth_images_and_allocations: Vec<(vk::Image, Allocation)>,
|
depth_images_and_allocations: Vec<(vk::Image, Allocation)>,
|
||||||
|
|
@ -849,17 +885,26 @@ impl RendererInner {
|
||||||
(buffers, buffer_allocations)
|
(buffers, buffer_allocations)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_descriptor_pool(device: &Device, swapchain_count: usize) -> vk::DescriptorPool {
|
fn create_descriptor_pool(device: &Device, total_sets_needed: usize) -> vk::DescriptorPool {
|
||||||
let pool_size = vk::DescriptorPoolSize::builder()
|
let pool_sizes = [
|
||||||
|
vk::DescriptorPoolSize::builder()
|
||||||
.ty(vk::DescriptorType::UNIFORM_BUFFER)
|
.ty(vk::DescriptorType::UNIFORM_BUFFER)
|
||||||
.descriptor_count(swapchain_count as u32);
|
.descriptor_count(total_sets_needed as u32)
|
||||||
|
.build(),
|
||||||
|
vk::DescriptorPoolSize::builder()
|
||||||
|
.ty(vk::DescriptorType::COMBINED_IMAGE_SAMPLER)
|
||||||
|
.descriptor_count(total_sets_needed as u32)
|
||||||
|
.build(),
|
||||||
|
];
|
||||||
|
|
||||||
let descriptor_pool_create_info = vk::DescriptorPoolCreateInfo::builder()
|
let descriptor_pool_create_info = vk::DescriptorPoolCreateInfo::builder()
|
||||||
.pool_sizes(std::slice::from_ref(&pool_size))
|
.pool_sizes(&pool_sizes)
|
||||||
.max_sets(swapchain_count as u32);
|
.max_sets(total_sets_needed as u32);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
device
|
device
|
||||||
.create_descriptor_pool(&descriptor_pool_create_info, None)
|
.create_descriptor_pool(&descriptor_pool_create_info, None)
|
||||||
.expect("Failed to create descriptor pool")
|
.expect("failed to create descriptor pool")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -867,18 +912,35 @@ impl RendererInner {
|
||||||
device: &Device,
|
device: &Device,
|
||||||
swapchain_count: usize,
|
swapchain_count: usize,
|
||||||
) -> Vec<vk::DescriptorSetLayout> {
|
) -> Vec<vk::DescriptorSetLayout> {
|
||||||
let ubo_layout_binding = vk::DescriptorSetLayoutBinding::builder()
|
let bindings = [
|
||||||
|
// Binding 0: Uniform buffer
|
||||||
|
vk::DescriptorSetLayoutBinding::builder()
|
||||||
.binding(0)
|
.binding(0)
|
||||||
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
||||||
.descriptor_count(1)
|
.descriptor_count(1)
|
||||||
.stage_flags(vk::ShaderStageFlags::VERTEX | vk::ShaderStageFlags::FRAGMENT);
|
.stage_flags(vk::ShaderStageFlags::VERTEX | vk::ShaderStageFlags::FRAGMENT)
|
||||||
let ubo_layout_create_info = vk::DescriptorSetLayoutCreateInfo::builder()
|
.build(),
|
||||||
.bindings(std::slice::from_ref(&ubo_layout_binding));
|
// Binding 1: Texture sampler
|
||||||
|
vk::DescriptorSetLayoutBinding::builder()
|
||||||
|
.binding(1)
|
||||||
|
.descriptor_type(vk::DescriptorType::SAMPLED_IMAGE)
|
||||||
|
.descriptor_count(1)
|
||||||
|
.stage_flags(vk::ShaderStageFlags::FRAGMENT)
|
||||||
|
.build(),
|
||||||
|
vk::DescriptorSetLayoutBinding::builder()
|
||||||
|
.binding(2)
|
||||||
|
.descriptor_type(vk::DescriptorType::SAMPLER)
|
||||||
|
.descriptor_count(1)
|
||||||
|
.stage_flags(vk::ShaderStageFlags::FRAGMENT)
|
||||||
|
.build(),
|
||||||
|
];
|
||||||
|
|
||||||
|
let layout_create_info = vk::DescriptorSetLayoutCreateInfo::builder().bindings(&bindings);
|
||||||
|
|
||||||
(0..swapchain_count)
|
(0..swapchain_count)
|
||||||
.map(|_| unsafe {
|
.map(|_| unsafe {
|
||||||
device
|
device
|
||||||
.create_descriptor_set_layout(&ubo_layout_create_info, None)
|
.create_descriptor_set_layout(&layout_create_info, None)
|
||||||
.expect("Failed to create descriptor set layout")
|
.expect("Failed to create descriptor set layout")
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
@ -889,28 +951,65 @@ impl RendererInner {
|
||||||
descriptor_pool: vk::DescriptorPool,
|
descriptor_pool: vk::DescriptorPool,
|
||||||
descriptor_set_layouts: &[vk::DescriptorSetLayout],
|
descriptor_set_layouts: &[vk::DescriptorSetLayout],
|
||||||
uniform_buffers: &[Buffer],
|
uniform_buffers: &[Buffer],
|
||||||
|
mesh: &Mesh,
|
||||||
) -> Vec<vk::DescriptorSet> {
|
) -> Vec<vk::DescriptorSet> {
|
||||||
let descriptor_set_allocate_info = vk::DescriptorSetAllocateInfo::builder()
|
|
||||||
.descriptor_pool(descriptor_pool)
|
|
||||||
.set_layouts(descriptor_set_layouts);
|
|
||||||
let descriptor_sets = unsafe {
|
let descriptor_sets = unsafe {
|
||||||
device
|
device
|
||||||
.allocate_descriptor_sets(&descriptor_set_allocate_info)
|
.allocate_descriptor_sets(
|
||||||
.expect("Failed to allocate descriptor sets")
|
&vk::DescriptorSetAllocateInfo::builder()
|
||||||
|
.descriptor_pool(descriptor_pool)
|
||||||
|
.set_layouts(descriptor_set_layouts),
|
||||||
|
)
|
||||||
|
.expect("failed to allocate descriptor sets")
|
||||||
};
|
};
|
||||||
for index in 0..descriptor_sets.len() {
|
|
||||||
|
for (index, &descriptor_set) in descriptor_sets.iter().enumerate() {
|
||||||
let buffer_info = vk::DescriptorBufferInfo::builder()
|
let buffer_info = vk::DescriptorBufferInfo::builder()
|
||||||
.buffer(uniform_buffers[index])
|
.buffer(uniform_buffers[index])
|
||||||
.offset(0)
|
.offset(0)
|
||||||
.range(vk::WHOLE_SIZE)
|
.range(vk::WHOLE_SIZE)
|
||||||
.build();
|
.build();
|
||||||
let descriptor_write = vk::WriteDescriptorSet::builder()
|
|
||||||
.dst_set(descriptor_sets[index])
|
let mut descriptor_writes = vec![vk::WriteDescriptorSet::builder()
|
||||||
|
.dst_set(descriptor_set)
|
||||||
.dst_binding(0)
|
.dst_binding(0)
|
||||||
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
||||||
.buffer_info(std::slice::from_ref(&buffer_info));
|
.buffer_info(std::slice::from_ref(&buffer_info))
|
||||||
|
.build()];
|
||||||
|
|
||||||
|
if let Some(ref texture) = mesh.texture {
|
||||||
|
// Image view descriptor
|
||||||
|
let image_info = vk::DescriptorImageInfo::builder()
|
||||||
|
.image_layout(vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL)
|
||||||
|
.image_view(texture.image_view)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
descriptor_writes.push(
|
||||||
|
vk::WriteDescriptorSet::builder()
|
||||||
|
.dst_set(descriptor_set)
|
||||||
|
.dst_binding(1)
|
||||||
|
.descriptor_type(vk::DescriptorType::SAMPLED_IMAGE)
|
||||||
|
.image_info(std::slice::from_ref(&image_info))
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Sampler descriptor
|
||||||
|
let sampler_info = vk::DescriptorImageInfo::builder()
|
||||||
|
.sampler(texture.sampler)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
descriptor_writes.push(
|
||||||
|
vk::WriteDescriptorSet::builder()
|
||||||
|
.dst_set(descriptor_set)
|
||||||
|
.dst_binding(2)
|
||||||
|
.descriptor_type(vk::DescriptorType::SAMPLER)
|
||||||
|
.image_info(std::slice::from_ref(&sampler_info))
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
device.update_descriptor_sets(std::slice::from_ref(&descriptor_write), &[]);
|
device.update_descriptor_sets(&descriptor_writes, &[]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1119,10 +1218,19 @@ impl RendererInner {
|
||||||
.name(&main_function_name_fs)
|
.name(&main_function_name_fs)
|
||||||
.build(),
|
.build(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let push_constant_range = vk::PushConstantRange::builder()
|
||||||
|
.stage_flags(vk::ShaderStageFlags::FRAGMENT)
|
||||||
|
.offset(0)
|
||||||
|
.size(std::mem::size_of::<PushConstants>() as u32)
|
||||||
|
.build();
|
||||||
|
|
||||||
let pipeline_layout = unsafe {
|
let pipeline_layout = unsafe {
|
||||||
device
|
device
|
||||||
.create_pipeline_layout(
|
.create_pipeline_layout(
|
||||||
&vk::PipelineLayoutCreateInfo::builder().set_layouts(descriptor_set_layouts),
|
&vk::PipelineLayoutCreateInfo::builder()
|
||||||
|
.set_layouts(descriptor_set_layouts)
|
||||||
|
.push_constant_ranges(&[push_constant_range]),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.expect("Failed to create pipeline layout")
|
.expect("Failed to create pipeline layout")
|
||||||
|
|
@ -1139,7 +1247,7 @@ impl RendererInner {
|
||||||
.rasterizer_discard_enable(false)
|
.rasterizer_discard_enable(false)
|
||||||
.polygon_mode(vk::PolygonMode::FILL)
|
.polygon_mode(vk::PolygonMode::FILL)
|
||||||
.cull_mode(vk::CullModeFlags::BACK)
|
.cull_mode(vk::CullModeFlags::BACK)
|
||||||
.front_face(vk::FrontFace::COUNTER_CLOCKWISE)
|
.front_face(vk::FrontFace::CLOCKWISE)
|
||||||
.depth_bias_enable(false)
|
.depth_bias_enable(false)
|
||||||
.line_width(1.0);
|
.line_width(1.0);
|
||||||
let stencil_op = vk::StencilOpState::builder()
|
let stencil_op = vk::StencilOpState::builder()
|
||||||
|
|
@ -1437,15 +1545,26 @@ impl RendererInner {
|
||||||
swapchain_images.len(),
|
swapchain_images.len(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let descriptor_pool = Self::create_descriptor_pool(&device, swapchain_images.len());
|
let t = Instant::now();
|
||||||
|
println!("loading model!");
|
||||||
|
let mut model = Model::load(
|
||||||
|
&device,
|
||||||
|
allocator.clone(),
|
||||||
|
command_pool,
|
||||||
|
queue,
|
||||||
|
"./sponza/NewSponza_Main_glTF_003.gltf",
|
||||||
|
);
|
||||||
|
println!(
|
||||||
|
"loaded {} meshes in {:.2} seconds!",
|
||||||
|
model.meshes.len(),
|
||||||
|
t.elapsed().as_secs_f32()
|
||||||
|
);
|
||||||
|
|
||||||
|
let descriptor_pool =
|
||||||
|
Self::create_descriptor_pool(&device, model.meshes.len() * swapchain_images.len());
|
||||||
let descriptor_set_layouts =
|
let descriptor_set_layouts =
|
||||||
Self::create_descriptor_set_layouts(&device, swapchain_images.len());
|
Self::create_descriptor_set_layouts(&device, swapchain_images.len());
|
||||||
let descriptor_sets = Self::create_descriptor_sets(
|
|
||||||
&device,
|
|
||||||
descriptor_pool,
|
|
||||||
&descriptor_set_layouts,
|
|
||||||
&uniform_buffers,
|
|
||||||
);
|
|
||||||
let render_pass = Self::create_render_pass(&device, surface_format);
|
let render_pass = Self::create_render_pass(&device, surface_format);
|
||||||
let CreateFramebuffersResult(
|
let CreateFramebuffersResult(
|
||||||
framebuffers,
|
framebuffers,
|
||||||
|
|
@ -1462,20 +1581,21 @@ impl RendererInner {
|
||||||
);
|
);
|
||||||
let (pipeline, pipeline_layout) =
|
let (pipeline, pipeline_layout) =
|
||||||
Self::create_graphics_pipeline(&device, &descriptor_set_layouts, render_pass);
|
Self::create_graphics_pipeline(&device, &descriptor_set_layouts, render_pass);
|
||||||
println!("loading model!");
|
|
||||||
let model = Model::load(
|
|
||||||
&device,
|
|
||||||
allocator.clone(),
|
|
||||||
command_pool,
|
|
||||||
queue,
|
|
||||||
"./sponza/NewSponza_Main_glTF_003.gltf",
|
|
||||||
);
|
|
||||||
println!("loaded!");
|
|
||||||
let command_buffers =
|
let command_buffers =
|
||||||
Self::create_command_buffers(&device, command_pool, swapchain_images.len());
|
Self::create_command_buffers(&device, command_pool, swapchain_images.len());
|
||||||
let (in_flight_fences, image_available_semaphores, render_finished_semaphores) =
|
let (in_flight_fences, image_available_semaphores, render_finished_semaphores) =
|
||||||
Self::create_sync_objects(&device, swapchain_images.len());
|
Self::create_sync_objects(&device, swapchain_images.len());
|
||||||
|
|
||||||
|
for mesh in &mut model.meshes {
|
||||||
|
mesh.descriptor_sets = Self::create_descriptor_sets(
|
||||||
|
&device,
|
||||||
|
descriptor_pool,
|
||||||
|
&descriptor_set_layouts,
|
||||||
|
&uniform_buffers,
|
||||||
|
mesh,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
|
@ -1494,7 +1614,6 @@ impl RendererInner {
|
||||||
uniform_buffer_allocations,
|
uniform_buffer_allocations,
|
||||||
descriptor_pool,
|
descriptor_pool,
|
||||||
descriptor_set_layouts,
|
descriptor_set_layouts,
|
||||||
descriptor_sets,
|
|
||||||
render_pass,
|
render_pass,
|
||||||
framebuffers,
|
framebuffers,
|
||||||
depth_images_and_allocations,
|
depth_images_and_allocations,
|
||||||
|
|
@ -1514,7 +1633,7 @@ impl RendererInner {
|
||||||
camera_position: Vec3::new(0.0, 0.0, -5.0),
|
camera_position: Vec3::new(0.0, 0.0, -5.0),
|
||||||
camera_yaw: 0.,
|
camera_yaw: 0.,
|
||||||
camera_pitch: 0.,
|
camera_pitch: 0.,
|
||||||
camera_fov: 45.,
|
camera_fov: 90.,
|
||||||
bg_color: Vec3::splat(0.1),
|
bg_color: Vec3::splat(0.1),
|
||||||
model_color: Vec3::splat(0.8),
|
model_color: Vec3::splat(0.8),
|
||||||
accumulation_reset_needed: true,
|
accumulation_reset_needed: true,
|
||||||
|
|
@ -1685,6 +1804,18 @@ impl RendererInner {
|
||||||
);
|
);
|
||||||
|
|
||||||
for mesh in &self.model.meshes {
|
for mesh in &self.model.meshes {
|
||||||
|
let push_constants = PushConstants {
|
||||||
|
texture_size: Vec4::new(1024.0, 1024.0, 1.0 / 1024.0, 1.0 / 1024.0),
|
||||||
|
};
|
||||||
|
unsafe {
|
||||||
|
self.device.cmd_push_constants(
|
||||||
|
self.command_buffers[self.current_frame],
|
||||||
|
self.pipeline_layout,
|
||||||
|
vk::ShaderStageFlags::FRAGMENT,
|
||||||
|
0,
|
||||||
|
bytemuck::cast_slice(&[push_constants]),
|
||||||
|
);
|
||||||
|
}
|
||||||
let model_matrix = Mat4::from_rotation_y(rotate_y.to_radians()) * mesh.transform;
|
let model_matrix = Mat4::from_rotation_y(rotate_y.to_radians()) * mesh.transform;
|
||||||
|
|
||||||
let ubo = UniformBufferObject {
|
let ubo = UniformBufferObject {
|
||||||
|
|
@ -1710,7 +1841,7 @@ impl RendererInner {
|
||||||
vk::PipelineBindPoint::GRAPHICS,
|
vk::PipelineBindPoint::GRAPHICS,
|
||||||
self.pipeline_layout,
|
self.pipeline_layout,
|
||||||
0,
|
0,
|
||||||
&[self.descriptor_sets[self.current_frame]],
|
&[mesh.descriptor_sets[self.current_frame]],
|
||||||
&[],
|
&[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1807,14 +1938,7 @@ impl RendererInner {
|
||||||
for semaphore in self.render_finished_semaphores.drain(..) {
|
for semaphore in self.render_finished_semaphores.drain(..) {
|
||||||
self.device.destroy_semaphore(semaphore, None);
|
self.device.destroy_semaphore(semaphore, None);
|
||||||
}
|
}
|
||||||
for mesh in &mut self.model.meshes {
|
self.model.destroy(&self.device, &mut allocator);
|
||||||
self.device.destroy_buffer(mesh.vertex_buffer, None);
|
|
||||||
if let Some(vertex_buffer_allocation) = mesh.vertex_buffer_allocation.take() {
|
|
||||||
allocator
|
|
||||||
.free(vertex_buffer_allocation)
|
|
||||||
.expect("Failed to free memory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.device.destroy_pipeline(self.pipeline, None);
|
self.device.destroy_pipeline(self.pipeline, None);
|
||||||
self.device
|
self.device
|
||||||
.destroy_pipeline_layout(self.pipeline_layout, None);
|
.destroy_pipeline_layout(self.pipeline_layout, None);
|
||||||
|
|
|
||||||
46
crates/vk-rs/src/texture_cache.rs
Normal file
46
crates/vk-rs/src/texture_cache.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
|
sync::{Arc, Mutex},
|
||||||
|
};
|
||||||
|
|
||||||
|
use ash::Device;
|
||||||
|
use gpu_allocator::vulkan::Allocator;
|
||||||
|
|
||||||
|
use super::renderer::Texture;
|
||||||
|
|
||||||
|
pub struct TextureCache {
|
||||||
|
cache: HashMap<String, Arc<Texture>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TextureCache {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
cache: HashMap::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_or_load_texture(
|
||||||
|
&mut self,
|
||||||
|
key: String,
|
||||||
|
load_fn: impl FnOnce() -> Option<Texture>,
|
||||||
|
) -> Option<Arc<Texture>> {
|
||||||
|
if let Some(texture) = self.cache.get(&key) {
|
||||||
|
Some(Arc::clone(texture))
|
||||||
|
} else {
|
||||||
|
load_fn().map(|texture| {
|
||||||
|
let texture = Arc::new(texture);
|
||||||
|
self.cache.insert(key, Arc::clone(&texture));
|
||||||
|
texture
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn cleanup(&mut self, device: &Device, allocator: &mut Allocator) {
|
||||||
|
for (_, texture) in self.cache.drain() {
|
||||||
|
if let Ok(texture) = Arc::try_unwrap(texture) {
|
||||||
|
let mut texture = texture;
|
||||||
|
texture.destroy(device, allocator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue