Compare commits
15 Commits
df747855b6
...
color-v3
| Author | SHA1 | Date | |
|---|---|---|---|
| fc76a8308a | |||
| 0d2e80145c | |||
| 7adb747625 | |||
| 7ff19631ba | |||
| 9ea4261a84 | |||
| 81f23c1bd8 | |||
| 08ada94bd2 | |||
| 4005e14ab0 | |||
| 3bd01da563 | |||
| 616bd2ae6d | |||
| 86ef0887e3 | |||
| 3c5563c940 | |||
| c3224fadd8 | |||
| 44b71c2692 | |||
| 6671475c75 |
@@ -21,7 +21,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- run: cargo check
|
with:
|
||||||
|
components: clippy
|
||||||
|
- run: cargo check --all-targets
|
||||||
|
- run: cargo clippy --all-targets
|
||||||
- run: cargo test
|
- run: cargo test
|
||||||
|
|
||||||
test-gpu:
|
test-gpu:
|
||||||
@@ -30,5 +33,5 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- run: cargo install --git https://github.com/rust-gpu/rust-gpu cargo-gpu
|
- run: cargo install --git https://github.com/rust-gpu/rust-gpu cargo-gpu --rev 67f1ff2
|
||||||
- run: cargo gpu check --auto-install-rust-toolchain -p enkou-shaders
|
- run: cargo gpu check --auto-install-rust-toolchain -p enkou-shaders
|
||||||
|
|||||||
Generated
+3
-687
@@ -130,9 +130,6 @@ name = "bitflags"
|
|||||||
version = "2.13.0"
|
version = "2.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
||||||
dependencies = [
|
|
||||||
"serde_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitstream-io"
|
name = "bitstream-io"
|
||||||
@@ -181,68 +178,6 @@ 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 = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "camino"
|
|
||||||
version = "1.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b4ce8d3bd5823c7504d3f579f13e7b2f3da252fcb938c594d5680ee508bf846f"
|
|
||||||
dependencies = [
|
|
||||||
"serde_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo-gpu-install"
|
|
||||||
version = "0.10.0-alpha.1"
|
|
||||||
source = "git+https://github.com/Rust-GPU/rust-gpu.git?rev=67f1ff2#67f1ff27272a1dff82776a5ad7388c738e0b31be"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"cargo_metadata",
|
|
||||||
"directories",
|
|
||||||
"log",
|
|
||||||
"serde",
|
|
||||||
"spirv-builder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo-platform"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "84982c6c0ae343635a3a4ee6dedef965513735c8b183caa7289fa6e27399ebd4"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo-util-schemas"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7dc1a6f7b5651af85774ae5a34b4e8be397d9cf4bc063b7e6dbd99a841837830"
|
|
||||||
dependencies = [
|
|
||||||
"semver",
|
|
||||||
"serde",
|
|
||||||
"serde-untagged",
|
|
||||||
"serde-value",
|
|
||||||
"thiserror",
|
|
||||||
"toml",
|
|
||||||
"unicode-xid",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cargo_metadata"
|
|
||||||
version = "0.21.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868"
|
|
||||||
dependencies = [
|
|
||||||
"camino",
|
|
||||||
"cargo-platform",
|
|
||||||
"cargo-util-schemas",
|
|
||||||
"semver",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.65"
|
version = "1.2.65"
|
||||||
@@ -307,38 +242,6 @@ version = "0.2.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "directories"
|
|
||||||
version = "6.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
|
|
||||||
dependencies = [
|
|
||||||
"dirs-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dirs-sys"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"option-ext",
|
|
||||||
"redox_users",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "displaydoc"
|
|
||||||
version = "0.2.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.16.0"
|
version = "1.16.0"
|
||||||
@@ -360,15 +263,6 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "enkou-shaders-tests"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"cargo-gpu-install",
|
|
||||||
"rspirv 0.13.0+sdk-1.4.341.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equator"
|
name = "equator"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
@@ -389,23 +283,6 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "equivalent"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "erased-serde"
|
|
||||||
version = "0.4.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_core",
|
|
||||||
"typeid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.14"
|
version = "0.3.14"
|
||||||
@@ -467,26 +344,6 @@ dependencies = [
|
|||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "form_urlencoded"
|
|
||||||
version = "1.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
|
|
||||||
dependencies = [
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "getrandom"
|
|
||||||
version = "0.2.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"wasi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
@@ -530,115 +387,6 @@ dependencies = [
|
|||||||
"zerocopy",
|
"zerocopy",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashbrown"
|
|
||||||
version = "0.17.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_collections"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
|
|
||||||
dependencies = [
|
|
||||||
"displaydoc",
|
|
||||||
"potential_utf",
|
|
||||||
"utf8_iter",
|
|
||||||
"yoke",
|
|
||||||
"zerofrom",
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_locale_core"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
|
|
||||||
dependencies = [
|
|
||||||
"displaydoc",
|
|
||||||
"litemap",
|
|
||||||
"tinystr",
|
|
||||||
"writeable",
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_normalizer"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
|
|
||||||
dependencies = [
|
|
||||||
"icu_collections",
|
|
||||||
"icu_normalizer_data",
|
|
||||||
"icu_properties",
|
|
||||||
"icu_provider",
|
|
||||||
"smallvec",
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_normalizer_data"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_properties"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
|
|
||||||
dependencies = [
|
|
||||||
"icu_collections",
|
|
||||||
"icu_locale_core",
|
|
||||||
"icu_properties_data",
|
|
||||||
"icu_provider",
|
|
||||||
"zerotrie",
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_properties_data"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "icu_provider"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
|
|
||||||
dependencies = [
|
|
||||||
"displaydoc",
|
|
||||||
"icu_locale_core",
|
|
||||||
"writeable",
|
|
||||||
"yoke",
|
|
||||||
"zerofrom",
|
|
||||||
"zerotrie",
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
|
|
||||||
dependencies = [
|
|
||||||
"idna_adapter",
|
|
||||||
"smallvec",
|
|
||||||
"utf8_iter",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna_adapter"
|
|
||||||
version = "1.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
|
|
||||||
dependencies = [
|
|
||||||
"icu_normalizer",
|
|
||||||
"icu_properties",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.25.10"
|
version = "0.25.10"
|
||||||
@@ -678,16 +426,6 @@ version = "1.12.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7"
|
checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "indexmap"
|
|
||||||
version = "2.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
|
||||||
dependencies = [
|
|
||||||
"equivalent",
|
|
||||||
"hashbrown",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "interpolate_name"
|
name = "interpolate_name"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
@@ -708,19 +446,13 @@ dependencies = [
|
|||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "1.0.18"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
version = "0.1.34"
|
version = "0.1.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
|
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.4",
|
"getrandom",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -752,27 +484,12 @@ version = "0.2.16"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libredox"
|
|
||||||
version = "0.1.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "litemap"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.32"
|
version = "0.4.32"
|
||||||
@@ -910,21 +627,6 @@ version = "1.21.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "option-ext"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ordered-float"
|
|
||||||
version = "2.10.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
@@ -937,12 +639,6 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
|
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "percent-encoding"
|
|
||||||
version = "2.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
@@ -956,15 +652,6 @@ dependencies = [
|
|||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "potential_utf"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
|
|
||||||
dependencies = [
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.21"
|
version = "0.2.21"
|
||||||
@@ -1073,7 +760,7 @@ version = "0.9.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.4",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1140,12 +827,6 @@ dependencies = [
|
|||||||
"rgb",
|
"rgb",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "raw-string"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e0501e134c6905fee1f10fed25b0a7e1261bf676cffac9543a7d0730dec01af2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
@@ -1166,62 +847,12 @@ dependencies = [
|
|||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "redox_users"
|
|
||||||
version = "0.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom 0.2.17",
|
|
||||||
"libredox",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rgb"
|
name = "rgb"
|
||||||
version = "0.8.53"
|
version = "0.8.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"
|
checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rspirv"
|
|
||||||
version = "0.12.0+sdk-1.3.268.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "69cf3a93856b6e5946537278df0d3075596371b1950ccff012f02b0f7eafec8d"
|
|
||||||
dependencies = [
|
|
||||||
"rustc-hash",
|
|
||||||
"spirv 0.3.0+sdk-1.3.268.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rspirv"
|
|
||||||
version = "0.13.0+sdk-1.4.341.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "091dca2e1d6fd3098417b5ec88e77e80d1ba5945750943419dc976858082c296"
|
|
||||||
dependencies = [
|
|
||||||
"rustc-hash",
|
|
||||||
"spirv 0.4.0+sdk-1.4.341.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc-hash"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_codegen_spirv-types"
|
|
||||||
version = "0.10.0-alpha.1"
|
|
||||||
source = "git+https://github.com/Rust-GPU/rust-gpu.git?rev=67f1ff2#67f1ff27272a1dff82776a5ad7388c738e0b31be"
|
|
||||||
dependencies = [
|
|
||||||
"rspirv 0.12.0+sdk-1.3.268.0",
|
|
||||||
"semver",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"spirv 0.3.0+sdk-1.3.268.0",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.1.4"
|
version = "1.1.4"
|
||||||
@@ -1241,90 +872,6 @@ version = "1.0.22"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "1.0.28"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde"
|
|
||||||
version = "1.0.228"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
||||||
dependencies = [
|
|
||||||
"serde_core",
|
|
||||||
"serde_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde-untagged"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058"
|
|
||||||
dependencies = [
|
|
||||||
"erased-serde",
|
|
||||||
"serde",
|
|
||||||
"serde_core",
|
|
||||||
"typeid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde-value"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
|
|
||||||
dependencies = [
|
|
||||||
"ordered-float",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_core"
|
|
||||||
version = "1.0.228"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
||||||
dependencies = [
|
|
||||||
"serde_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_derive"
|
|
||||||
version = "1.0.228"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_json"
|
|
||||||
version = "1.0.150"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
|
||||||
dependencies = [
|
|
||||||
"itoa",
|
|
||||||
"memchr",
|
|
||||||
"serde",
|
|
||||||
"serde_core",
|
|
||||||
"zmij",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_spanned"
|
|
||||||
version = "0.6.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shlex"
|
name = "shlex"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
@@ -1352,41 +899,6 @@ version = "1.15.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spirv"
|
|
||||||
version = "0.3.0+sdk-1.3.268.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.13.0",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spirv"
|
|
||||||
version = "0.4.0+sdk-1.4.341.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.13.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spirv-builder"
|
|
||||||
version = "0.10.0-alpha.1"
|
|
||||||
source = "git+https://github.com/Rust-GPU/rust-gpu.git?rev=67f1ff2#67f1ff27272a1dff82776a5ad7388c738e0b31be"
|
|
||||||
dependencies = [
|
|
||||||
"cargo_metadata",
|
|
||||||
"log",
|
|
||||||
"memchr",
|
|
||||||
"raw-string",
|
|
||||||
"rustc_codegen_spirv-types",
|
|
||||||
"semver",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spirv-std"
|
name = "spirv-std"
|
||||||
version = "0.10.0-alpha.1"
|
version = "0.10.0-alpha.1"
|
||||||
@@ -1433,17 +945,6 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "synstructure"
|
|
||||||
version = "0.13.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.27.0"
|
version = "3.27.0"
|
||||||
@@ -1451,7 +952,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"getrandom 0.3.4",
|
"getrandom",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
@@ -1491,93 +992,12 @@ dependencies = [
|
|||||||
"zune-jpeg",
|
"zune-jpeg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinystr"
|
|
||||||
version = "0.8.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
|
|
||||||
dependencies = [
|
|
||||||
"displaydoc",
|
|
||||||
"zerovec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.8.23"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"toml_edit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_datetime"
|
|
||||||
version = "0.6.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_edit"
|
|
||||||
version = "0.22.27"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"toml_write",
|
|
||||||
"winnow",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_write"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "typeid"
|
|
||||||
version = "1.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.24"
|
version = "1.0.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-xid"
|
|
||||||
version = "0.2.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "url"
|
|
||||||
version = "2.5.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
|
||||||
dependencies = [
|
|
||||||
"form_urlencoded",
|
|
||||||
"idna",
|
|
||||||
"percent-encoding",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utf8_iter"
|
|
||||||
version = "1.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "v_frame"
|
name = "v_frame"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@@ -1589,12 +1009,6 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasi"
|
|
||||||
version = "0.11.1+wasi-snapshot-preview1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasip2"
|
name = "wasip2"
|
||||||
version = "1.0.4+wasi-0.2.12"
|
version = "1.0.4+wasi-0.2.12"
|
||||||
@@ -1670,56 +1084,18 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winnow"
|
|
||||||
version = "0.7.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wit-bindgen"
|
name = "wit-bindgen"
|
||||||
version = "0.57.1"
|
version = "0.57.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "writeable"
|
|
||||||
version = "0.6.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "y4m"
|
name = "y4m"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
|
checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "yoke"
|
|
||||||
version = "0.8.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
|
|
||||||
dependencies = [
|
|
||||||
"stable_deref_trait",
|
|
||||||
"yoke-derive",
|
|
||||||
"zerofrom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "yoke-derive"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"synstructure",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.8.52"
|
version = "0.8.52"
|
||||||
@@ -1740,66 +1116,6 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerofrom"
|
|
||||||
version = "0.1.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
|
|
||||||
dependencies = [
|
|
||||||
"zerofrom-derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerofrom-derive"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"synstructure",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerotrie"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
|
|
||||||
dependencies = [
|
|
||||||
"displaydoc",
|
|
||||||
"yoke",
|
|
||||||
"zerofrom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerovec"
|
|
||||||
version = "0.11.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
|
|
||||||
dependencies = [
|
|
||||||
"yoke",
|
|
||||||
"zerofrom",
|
|
||||||
"zerovec-derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerovec-derive"
|
|
||||||
version = "0.11.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zmij"
|
|
||||||
version = "1.0.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zune-core"
|
name = "zune-core"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"enkou-shaders",
|
"enkou-shaders",
|
||||||
"enkou-shaders-tests",
|
|
||||||
]
|
]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
|
|
||||||
@@ -13,6 +12,7 @@ license = "MIT"
|
|||||||
repository = ""
|
repository = ""
|
||||||
|
|
||||||
[workspace.lints.rust]
|
[workspace.lints.rust]
|
||||||
|
missing_docs = { level = "warn" }
|
||||||
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
@@ -25,6 +25,5 @@ glam = { version = "0.33.1", default-features = false, features = ["bytemuck", "
|
|||||||
image = { version = "0.25.10", default-features = false, features = ["default-formats"]}
|
image = { version = "0.25.10", default-features = false, features = ["default-formats"]}
|
||||||
libm = "0.2.16"
|
libm = "0.2.16"
|
||||||
rand = { version = "0.10.1", default-features = false }
|
rand = { version = "0.10.1", default-features = false }
|
||||||
rspirv = "0.13.0"
|
|
||||||
rand_xoshiro = "0.8.1"
|
rand_xoshiro = "0.8.1"
|
||||||
tempfile = "3.27.0"
|
tempfile = "3.27.0"
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "enkou-shaders-tests"
|
|
||||||
publish = false
|
|
||||||
version.workspace = true
|
|
||||||
authors.workspace = true
|
|
||||||
edition.workspace = true
|
|
||||||
license.workspace = true
|
|
||||||
repository.workspace = true
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
rspirv.workspace = true
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
anyhow.workspace = true
|
|
||||||
cargo-gpu-install.workspace = true
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
use cargo_gpu_install::install::Install;
|
|
||||||
use cargo_gpu_install::spirv_builder::{ShaderPanicStrategy, SpirvMetadata};
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
pub fn main() -> anyhow::Result<()> {
|
|
||||||
let manifest_dir = env!("CARGO_MANIFEST_DIR");
|
|
||||||
let crate_path = [manifest_dir, "..", "enkou-shaders"]
|
|
||||||
.iter()
|
|
||||||
.copied()
|
|
||||||
.collect::<PathBuf>();
|
|
||||||
|
|
||||||
let install = Install::from_shader_crate(crate_path.clone())
|
|
||||||
.within_build_script()
|
|
||||||
.run()?;
|
|
||||||
let mut builder = install.to_spirv_builder(crate_path, "spirv-unknown-vulkan1.3");
|
|
||||||
builder.build_script.defaults = true;
|
|
||||||
builder.shader_panic_strategy = ShaderPanicStrategy::SilentExit;
|
|
||||||
builder.spirv_metadata = SpirvMetadata::Full;
|
|
||||||
|
|
||||||
let compile_result = builder.build()?;
|
|
||||||
let spv_path = compile_result.module.unwrap_single();
|
|
||||||
println!("cargo::rustc-env=SHADER_SPV_PATH={}", spv_path.display());
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
#[cfg(test)]
|
|
||||||
mod test {
|
|
||||||
use rspirv::binary::parse_bytes;
|
|
||||||
use rspirv::dr::{Module, Operand};
|
|
||||||
use rspirv::spirv::ExecutionModel;
|
|
||||||
use std::sync::OnceLock;
|
|
||||||
|
|
||||||
static SHADER_MODULE: OnceLock<Module> = OnceLock::new();
|
|
||||||
|
|
||||||
fn shader() -> &'static Module {
|
|
||||||
SHADER_MODULE.get_or_init(|| {
|
|
||||||
let shader_bytes = include_bytes!(env!("SHADER_SPV_PATH"));
|
|
||||||
|
|
||||||
let mut loader = rspirv::dr::Loader::new();
|
|
||||||
parse_bytes(shader_bytes, &mut loader).expect("Unable to parse shader");
|
|
||||||
|
|
||||||
loader.module()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_entry_point(execution_model: ExecutionModel, name: &str) -> bool {
|
|
||||||
for ref entry_point in shader().entry_points.iter() {
|
|
||||||
let operands: Vec<Operand> = entry_point
|
|
||||||
.operands
|
|
||||||
.iter()
|
|
||||||
.filter(|op| match op {
|
|
||||||
Operand::ExecutionModel(_) | Operand::LiteralString(_) => true,
|
|
||||||
_ => false,
|
|
||||||
})
|
|
||||||
.map(|op| op.clone())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
assert_eq!(operands.len(), 2);
|
|
||||||
match &operands[0] {
|
|
||||||
Operand::ExecutionModel(actual) => {
|
|
||||||
if execution_model != *actual {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
op => panic!("Unexpected operand; {}", op),
|
|
||||||
}
|
|
||||||
|
|
||||||
match &operands[1] {
|
|
||||||
Operand::LiteralString(actual) => {
|
|
||||||
if name != actual {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
op => panic!("Unexpected operand; {}", op),
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
pub fn has_entry_main_fs() {
|
|
||||||
assert!(has_entry_point(ExecutionModel::Fragment, "main_fs"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
pub fn has_entry_main_vs() {
|
|
||||||
assert!(has_entry_point(ExecutionModel::Vertex, "main_vs"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,10 +14,10 @@ bytemuck.workspace = true
|
|||||||
glam.workspace = true
|
glam.workspace = true
|
||||||
libm.workspace = true
|
libm.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
|
rand_xoshiro.workspace = true
|
||||||
spirv-std.workspace = true
|
spirv-std.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
image.workspace = true
|
image.workspace = true
|
||||||
rand_xoshiro.workspace = true
|
|
||||||
tempfile.workspace = true
|
tempfile.workspace = true
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
//! # Fractal flame
|
||||||
|
//!
|
||||||
|
//! The `flam3` sources include example parameters (`test.flam3`) to demonstrate the fractal flame algorithm,
|
||||||
|
//! which are copied here and used to generate an image that can be compared against the reference `flam3` renderer
|
||||||
|
|
||||||
|
use anyhow::Result;
|
||||||
|
use enkou_shaders::chaos_game::ChaosGame;
|
||||||
|
use enkou_shaders::transform::Transform;
|
||||||
|
use enkou_shaders::variation::{Variation, VariationKind};
|
||||||
|
use glam::{UVec2, UVec3, UVec4, Vec2, Vec2Swizzles, Vec4};
|
||||||
|
use rand::SeedableRng;
|
||||||
|
use rand_xoshiro::Xoshiro256StarStar;
|
||||||
|
use enkou_shaders::camera::Camera;
|
||||||
|
use enkou_shaders::image::BlendMode;
|
||||||
|
|
||||||
|
const ITERATIONS_DISCARD: usize = 100;
|
||||||
|
const IMAGE_DIMENSIONS: UVec2 = UVec2::new(640, 480);
|
||||||
|
const IMAGE_QUALITY: f32 = 10.0;
|
||||||
|
|
||||||
|
// Palette data copied from `flam3-palettes.xml`.
|
||||||
|
// Palettes are ASCII hexadecimal strings; two characters form a byte,
|
||||||
|
// and bytes are grouped in triplets to get a single RGB color.
|
||||||
|
const PALETTE: &'static str = "\
|
||||||
|
00dadebc00eee6c500eef2ce00eef2cf00e6eee100eaeed800f2f1eb00f2f5d8
|
||||||
|
00e6f2ce00deeac500d6dac600ced2bc00c2caa900becaa000ced6aa00dee2c5
|
||||||
|
00eaedce00eaf2c500dee2c500c2caaa00aebeaa00a5b29600a2a98d0096a284
|
||||||
|
008d8d7a0085897100858d710085856700797d6700797d670071795e00656d55
|
||||||
|
004d5d4200344025003040250030381c002c3c1c002c341c00242c1200242400
|
||||||
|
00242c0900283409003840120030401c0040502f0055694200657555006c7d5e
|
||||||
|
00748d710074898400748d8400788d840079897a0079857100757d670071795e
|
||||||
|
006c715e006d705e006c795e0068755e00697155006d7555006d755500697155
|
||||||
|
0065715500696d550064715e006870670068706700686c67006c6c5e0071715e
|
||||||
|
0079796700818571007d91710085927a0085927a007d9284007992840078928d
|
||||||
|
00788d8d00748d84007492840075927a006c85670064795e0059694b00aa5700
|
||||||
|
0038441c00303c1c002c3c1c003440250050614b005d6d5e0064715e0060715e
|
||||||
|
0060755e0068755e006c795e006c795e0071796700707967006c7d6700687967
|
||||||
|
006c7967006c75670071755e0071755e0075795e00757d5e00818d5e008d925e
|
||||||
|
008d9267009a9a71009aa27a009aa27a009aa17a00929a71008992670081855e
|
||||||
|
007d7d550069794b00616d4200444c250038441c0040512500454d2500716d42
|
||||||
|
00797d4b00817d5500797955006d755500697d55006c795e006579540068795e
|
||||||
|
00647967006479670068755e0064715e00646c5e00656d55004d584200344025
|
||||||
|
002c381c0020281c001c1409001818000004140000081000000c1800001c2809
|
||||||
|
00243012003c4425005d6555007579550085895e008991710096a271009aa27a
|
||||||
|
009eaa7a009eaa7a00aaae7100a6aa7a00a2aa7a00a1a57a00969e7a0085967a
|
||||||
|
0081927a0078927a0075927a00758d7a00708167007d7d670089896700929a71
|
||||||
|
009eaa7a00aab68400b2b68d00b6ba9700c2ca9700b2be8d00b2b68d00aab28d
|
||||||
|
00a2ae84009aa67a00929e7a00859a7a007d967a007d927a007d9284007d9284
|
||||||
|
0081968400859684008596840081928400859a8400859a84008d9a8400929684
|
||||||
|
009ea98400aeb28400aaba8400b2be8d00b6c2a000c6caa000c6ceaa00d6dab3
|
||||||
|
00dae2c500d2d6bc00bec2a000aab68d009ea67a00929a710089897100817d67
|
||||||
|
007d7d6700817867007d7d5e0079795e0079815e00817d6700817d6700818167
|
||||||
|
008189710085917a0089927a00969d7a00969e7a0092968400969a8d00929284
|
||||||
|
0089918400819284007d928d0078928d0074928d0078928d007896970081968d
|
||||||
|
0081968d00819a8d00859a8d00899e8d00899e8d008da2970095a297008da297
|
||||||
|
0096a68d009aa18d009ea984009ea67a00a2a571009ea671009aa67100959d71";
|
||||||
|
|
||||||
|
/// Generate an image
|
||||||
|
pub fn main() -> Result<()> {
|
||||||
|
let transforms: &[Transform] = &[];
|
||||||
|
|
||||||
|
let weights = [0.25; 4];
|
||||||
|
|
||||||
|
let variations = [Variation::new(
|
||||||
|
VariationKind::Spherical,
|
||||||
|
1.0,
|
||||||
|
[0.0; 4].into(),
|
||||||
|
)];
|
||||||
|
|
||||||
|
let camera = Camera::new(IMAGE_DIMENSIONS, Vec2::ZERO, 0.0, Vec2::ZERO, (IMAGE_DIMENSIONS / 2).as_vec2());
|
||||||
|
|
||||||
|
let palette_chars: String = PALETTE.chars().filter(|c| c.is_alphanumeric()).collect();
|
||||||
|
let palette_bytes: Vec<u8> = (0..palette_chars.len())
|
||||||
|
.step_by(2)
|
||||||
|
.map(|i| {
|
||||||
|
let s = &palette_chars[i..i + 2];
|
||||||
|
let b = u8::from_str_radix(s, 16).expect("illegal palette value");
|
||||||
|
b
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let palette_colors: Vec<Vec4> = palette_bytes
|
||||||
|
.chunks(3)
|
||||||
|
.map(|chunk| [chunk[0] as f32, chunk[1] as f32, chunk[2] as f32, 255.0].into())
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let mut rng = Xoshiro256StarStar::from_seed([4u8; 32]);
|
||||||
|
let chaos_game = ChaosGame::new(&mut rng, transforms, &weights, &variations);
|
||||||
|
|
||||||
|
let mut image_accum: Vec<Vec4> = Vec::new();
|
||||||
|
image_accum.resize(IMAGE_DIMENSIONS.element_product() as usize, Vec4::ZERO);
|
||||||
|
|
||||||
|
let iterations: usize = (IMAGE_DIMENSIONS.element_product() as f32 * IMAGE_QUALITY) as usize;
|
||||||
|
chaos_game.skip(ITERATIONS_DISCARD).take(iterations).for_each(|(ifs_point, ifs_color)| {
|
||||||
|
let pixel_point = camera.transform_point_to_image(ifs_point);
|
||||||
|
if pixel_point.is_none() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let pixel_point = pixel_point.unwrap();
|
||||||
|
let pixel_index = pixel_point.y * IMAGE_DIMENSIONS.x + pixel_point.x;
|
||||||
|
|
||||||
|
let pixel_color = BlendMode::Linear.ifs_to_rgb(ifs_color, palette_colors.as_ref());
|
||||||
|
image_accum[pixel_index as usize] += pixel_color;
|
||||||
|
});
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
|
//! # Sierpinski Gasket
|
||||||
|
//!
|
||||||
|
//! The Sierpinski Gasket is a simple iterated function system (IFS) that demonstrates
|
||||||
|
//! the basic principles of using the "chaos game" to generate images. Using a set of three
|
||||||
|
//! transforms, generate new points in the function system using the chaos game,
|
||||||
|
//! then plot those points and display the resulting image.
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use enkou_shaders::Coefficients2;
|
use enkou_shaders::Coefficients2;
|
||||||
use enkou_shaders::camera::Camera;
|
use enkou_shaders::camera::Camera;
|
||||||
use enkou_shaders::chaos_game::ChaosGame;
|
use enkou_shaders::chaos_game::ChaosGame;
|
||||||
use enkou_shaders::transform::Transform;
|
use enkou_shaders::transform::Transform;
|
||||||
|
use enkou_shaders::variation::Variation;
|
||||||
use glam::{Affine2, UVec2, Vec2, uvec2};
|
use glam::{Affine2, UVec2, Vec2, uvec2};
|
||||||
use image::{GrayImage, Luma};
|
use image::{GrayImage, Luma};
|
||||||
use rand::SeedableRng;
|
use rand::SeedableRng;
|
||||||
@@ -11,26 +18,33 @@ use std::mem;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
const ITERATIONS: u32 = 50_000;
|
const ITERATIONS_DISCARD: usize = 20;
|
||||||
const ITERATIONS_DISCARD: u32 = 20;
|
|
||||||
const IMAGE_DIMENSION: UVec2 = uvec2(600, 600);
|
const IMAGE_DIMENSION: UVec2 = uvec2(600, 600);
|
||||||
|
const IMAGE_QUALITY: f32 = 1.0;
|
||||||
|
|
||||||
|
/// Build and display a simple fractal - the Sierpinski Gasket
|
||||||
pub fn main() -> Result<()> {
|
pub fn main() -> Result<()> {
|
||||||
let seed: u64 = 4; // chosen by fair dice roll
|
let mut rng = Xoshiro256StarStar::from_seed([4u8; 32]);
|
||||||
let mut rng = Xoshiro256StarStar::seed_from_u64(seed);
|
|
||||||
|
|
||||||
let transforms = [
|
let transforms = [
|
||||||
// F_0: (x / 2, y / 2)
|
{
|
||||||
Transform::new(Affine2::from_coefficients(0.5, 0.0, 0.0, 0.0, 0.5, 0.0)),
|
// F_0: (x / 2, y / 2)
|
||||||
// F_1: ((x + 1) / 2, y / 2)
|
let coefficients = Affine2::from_coefficients(0.5, 0.0, 0.0, 0.0, 0.5, 0.0);
|
||||||
Transform::new(Affine2::from_coefficients(0.5, 0.0, 0.5, 0.0, 0.5, 0.0)),
|
Transform::new(coefficients, Affine2::IDENTITY, uvec2(0, 1), 0.0, 0.5)
|
||||||
// F_2: (x / 2, (y + 1) / 2)
|
},
|
||||||
Transform::new(Affine2::from_coefficients(0.5, 0.0, 0.0, 0.0, 0.5, 0.5)),
|
{
|
||||||
|
// F_1: ((x + 1) / 2, y / 2)
|
||||||
|
let coefficients = Affine2::from_coefficients(0.5, 0.0, 0.5, 0.0, 0.5, 0.0);
|
||||||
|
Transform::new(coefficients, Affine2::IDENTITY, uvec2(0, 1), 0.5, 0.5)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// F_2: (x / 2, (y + 1) / 2)
|
||||||
|
let coefficients = Affine2::from_coefficients(0.5, 0.0, 0.0, 0.0, 0.5, 0.5);
|
||||||
|
Transform::new(coefficients, Affine2::IDENTITY, uvec2(0, 1), 1.0, 0.5)
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let weights = [1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0];
|
let weights = [1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0];
|
||||||
|
let variations = [Variation::IDENTITY];
|
||||||
let mut image = GrayImage::new(IMAGE_DIMENSION.x, IMAGE_DIMENSION.y);
|
|
||||||
|
|
||||||
// The gasket is defined on the range [0, 1] for both X and Y
|
// The gasket is defined on the range [0, 1] for both X and Y
|
||||||
let camera = Camera::new(
|
let camera = Camera::new(
|
||||||
@@ -41,31 +55,28 @@ pub fn main() -> Result<()> {
|
|||||||
IMAGE_DIMENSION.as_vec2(),
|
IMAGE_DIMENSION.as_vec2(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut chaos_game = ChaosGame::new(&mut rng, &transforms, &weights);
|
let mut image = GrayImage::new(IMAGE_DIMENSION.x, IMAGE_DIMENSION.y);
|
||||||
for i in 0..ITERATIONS {
|
let chaos_game = ChaosGame::new(&mut rng, &transforms, &weights, &variations);
|
||||||
let next_point = chaos_game.next().unwrap();
|
|
||||||
|
|
||||||
if i < ITERATIONS_DISCARD {
|
let iterations = (IMAGE_DIMENSION.element_product() as f32 * IMAGE_QUALITY) as usize;
|
||||||
continue;
|
chaos_game
|
||||||
}
|
.skip(ITERATIONS_DISCARD)
|
||||||
|
.take(iterations)
|
||||||
if let Some(next_point) = camera.transform_point_to_image(next_point) {
|
.for_each(|(ifs_point, _)| {
|
||||||
image.put_pixel(next_point.x, next_point.y, Luma([255u8]))
|
if let Some(pixel_point) = camera.transform_point_to_image(ifs_point) {
|
||||||
}
|
image.put_pixel(pixel_point.x, pixel_point.y, Luma([255u8]));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let temp = NamedTempFile::with_suffix(".png").context("Unable to create file for image")?;
|
let temp = NamedTempFile::with_suffix(".png").context("Unable to create file for image")?;
|
||||||
image.save(temp.path()).context("Unable to save image")?;
|
image.save(temp.path()).context("Unable to save image")?;
|
||||||
|
|
||||||
let open_program = cfg_select! {
|
let mut command = cfg_select! {
|
||||||
unix => "xdg-open",
|
unix => Command::new("xdg-open").arg(temp.path()).spawn(),
|
||||||
_ => panic!("Unknown system"),
|
windows => Command::new("PowerShell").arg("-Command").arg(format!("start {}", temp.path().display())).spawn(),
|
||||||
};
|
_ => Err(anyhow::anyhow!("No available program to open images"))?
|
||||||
|
}?;
|
||||||
Command::new(open_program)
|
command.wait()?;
|
||||||
.arg(temp.path())
|
|
||||||
.spawn()?
|
|
||||||
.wait()?;
|
|
||||||
|
|
||||||
// In case the image viewer forks and gives control back prior to reading the file,
|
// In case the image viewer forks and gives control back prior to reading the file,
|
||||||
// drop it and don't run the destructor
|
// drop it and don't run the destructor
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ impl Camera {
|
|||||||
///
|
///
|
||||||
/// * `dimensions` - Width and height of the output image (in pixels).
|
/// * `dimensions` - Width and height of the output image (in pixels).
|
||||||
/// * `center` - Location of the origin in IFS coordinates. Positive `x` shifts the image
|
/// * `center` - Location of the origin in IFS coordinates. Positive `x` shifts the image
|
||||||
/// left, and positive `y` position shifts the image up.
|
/// left, and positive `y` position shifts the image up.
|
||||||
/// * `rotate` - Rotation angle (in radians) of IFS coordinates. Rotation is applied after the
|
/// * `rotate` - Rotation angle (in radians) of IFS coordinates. Rotation is applied after the
|
||||||
/// `center` translation, so it is about the new origin.
|
/// `center` translation, so it is about the new origin.
|
||||||
/// * `zoom` - Zoom factor applied to IFS coordinates. IFS coordinates are scaled by
|
/// * `zoom` - Zoom factor applied to IFS coordinates. IFS coordinates are scaled by
|
||||||
/// `pow(2, zoom)`, so a zoom factor of 0 is the identity.
|
/// `pow(2, zoom)`, so a zoom factor of 0 is the identity.
|
||||||
/// * `scale` - Pixels per unit of IFS coordinates. This parameter is usually chosen such
|
/// * `scale` - Pixels per unit of IFS coordinates. This parameter is usually chosen such
|
||||||
/// that the largest dimension will cover the range `[-2, 2]`, but values higher or lower
|
/// that the largest dimension will cover the range `[-2, 2]`, but values higher or lower
|
||||||
/// can be used as a secondary zoom.
|
/// can be used as a secondary zoom.
|
||||||
pub fn new(dimensions: UVec2, center: Vec2, rotate: f32, zoom: Vec2, scale: Vec2) -> Camera {
|
pub fn new(dimensions: UVec2, center: Vec2, rotate: f32, zoom: Vec2, scale: Vec2) -> Camera {
|
||||||
let ifs_center_transform = Affine2::from_translation(-center);
|
let ifs_center_transform = Affine2::from_translation(-center);
|
||||||
let zoom_transform = Affine2::from_scale(vec2(powf(2.0, zoom.x), powf(2.0, zoom.y)));
|
let zoom_transform = Affine2::from_scale(vec2(powf(2.0, zoom.x), powf(2.0, zoom.y)));
|
||||||
@@ -90,6 +90,25 @@ impl Camera {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Shader entry point for running the camera transformation over a list of IFS coordinates
|
||||||
|
pub mod entry {
|
||||||
|
use crate::camera::Camera;
|
||||||
|
use spirv_std::glam::{IVec2, Vec2};
|
||||||
|
use spirv_std::spirv;
|
||||||
|
|
||||||
|
/// Transform IFS coordinates to pixel coordinates
|
||||||
|
#[spirv(compute(entry_point_name = "main_camera", threads(1)))]
|
||||||
|
pub fn main_camera(
|
||||||
|
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] camera: &Camera,
|
||||||
|
#[spirv(storage_buffer, descriptor_set = 0, binding = 1)] coordinates_ifs: &[Vec2],
|
||||||
|
#[spirv(storage_buffer, descriptor_set = 1, binding = 0)] coordinates_pixel: &mut [IVec2],
|
||||||
|
) {
|
||||||
|
for i in 0..coordinates_ifs.len() {
|
||||||
|
coordinates_pixel[i] = camera.transform_point(coordinates_ifs[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::camera::Camera;
|
use crate::camera::Camera;
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
//!
|
//!
|
||||||
//! This algorithm is also known as the ["chaos game"](https://en.wikipedia.org/wiki/Chaos_game),
|
//! This algorithm is also known as the ["chaos game"](https://en.wikipedia.org/wiki/Chaos_game),
|
||||||
//! and it forms the basic system for producing images.
|
//! and it forms the basic system for producing images.
|
||||||
|
|
||||||
use crate::transform::Transform;
|
use crate::transform::Transform;
|
||||||
use glam::{Vec2, vec2};
|
use crate::variation::Variation;
|
||||||
use rand::distr::{Distribution, StandardUniform};
|
use rand::distr::{Distribution, StandardUniform};
|
||||||
use rand::{Rng, RngExt};
|
use rand::{Rng, RngExt};
|
||||||
|
use spirv_std::glam::{Vec2, vec2};
|
||||||
|
|
||||||
struct BiUnit;
|
struct BiUnit;
|
||||||
impl Distribution<f32> for BiUnit {
|
impl Distribution<f32> for BiUnit {
|
||||||
@@ -34,15 +36,17 @@ impl Distribution<f32> for BiUnit {
|
|||||||
/// * `weights` - Weights are assumed to be normalized; adding all elements together should return the value 1
|
/// * `weights` - Weights are assumed to be normalized; adding all elements together should return the value 1
|
||||||
pub fn step_chaos_game<R: Rng>(
|
pub fn step_chaos_game<R: Rng>(
|
||||||
point: Vec2,
|
point: Vec2,
|
||||||
|
color: f32,
|
||||||
rng: &mut R,
|
rng: &mut R,
|
||||||
transforms: &[Transform],
|
transforms: &[Transform],
|
||||||
weights: &[f32],
|
weights: &[f32],
|
||||||
) -> (Vec2, u32) {
|
variations: &[Variation],
|
||||||
|
) -> (Vec2, f32) {
|
||||||
let mut choice_weight = rng.sample::<f32, _>(StandardUniform);
|
let mut choice_weight = rng.sample::<f32, _>(StandardUniform);
|
||||||
let mut transform_index: u32 = 0;
|
let mut transform_index: u32 = 0;
|
||||||
|
|
||||||
for weight in weights {
|
for i in 0..weights.len() {
|
||||||
choice_weight -= weight;
|
choice_weight -= weights[i];
|
||||||
if choice_weight <= 0.0 {
|
if choice_weight <= 0.0 {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -50,9 +54,10 @@ pub fn step_chaos_game<R: Rng>(
|
|||||||
transform_index += 1;
|
transform_index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let transform = &transforms[transform_index as usize];
|
||||||
(
|
(
|
||||||
transforms[transform_index as usize].transform_point(point),
|
transform.transform_point(rng, variations, point),
|
||||||
transform_index,
|
transform.transform_color(color),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,32 +67,49 @@ pub fn step_chaos_game<R: Rng>(
|
|||||||
/// New points in the chaos game are produced by iterating on the chaos game.
|
/// New points in the chaos game are produced by iterating on the chaos game.
|
||||||
pub struct ChaosGame<'a, R: Rng> {
|
pub struct ChaosGame<'a, R: Rng> {
|
||||||
current_point: Vec2,
|
current_point: Vec2,
|
||||||
|
current_color: f32,
|
||||||
rng: &'a mut R,
|
rng: &'a mut R,
|
||||||
transforms: &'a [Transform],
|
transforms: &'a [Transform],
|
||||||
weights: &'a [f32],
|
weights: &'a [f32],
|
||||||
|
variations: &'a [Variation],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: Rng> ChaosGame<'a, R> {
|
impl<'a, R: Rng> ChaosGame<'a, R> {
|
||||||
/// Create a new chaos game iterator
|
/// Create a new chaos game iterator
|
||||||
pub fn new(rng: &'a mut R, transforms: &'a [Transform], weights: &'a [f32]) -> Self {
|
pub fn new(
|
||||||
|
rng: &'a mut R,
|
||||||
|
transforms: &'a [Transform],
|
||||||
|
weights: &'a [f32],
|
||||||
|
variations: &'a [Variation],
|
||||||
|
) -> Self {
|
||||||
let current_point = vec2(rng.sample(BiUnit), rng.sample(BiUnit));
|
let current_point = vec2(rng.sample(BiUnit), rng.sample(BiUnit));
|
||||||
|
let current_color = rng.sample(StandardUniform);
|
||||||
ChaosGame {
|
ChaosGame {
|
||||||
current_point,
|
current_point,
|
||||||
|
current_color,
|
||||||
rng,
|
rng,
|
||||||
transforms,
|
transforms,
|
||||||
weights,
|
weights,
|
||||||
|
variations,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: Rng> Iterator for ChaosGame<'a, R> {
|
impl<'a, R: Rng> Iterator for ChaosGame<'a, R> {
|
||||||
type Item = Vec2;
|
type Item = (Vec2, f32);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
let (next_point, _) =
|
let (next_point, next_color) = step_chaos_game(
|
||||||
step_chaos_game(self.current_point, self.rng, self.transforms, self.weights);
|
self.current_point,
|
||||||
|
self.current_color,
|
||||||
|
self.rng,
|
||||||
|
self.transforms,
|
||||||
|
self.weights,
|
||||||
|
self.variations,
|
||||||
|
);
|
||||||
self.current_point = next_point;
|
self.current_point = next_point;
|
||||||
|
self.current_color = next_color;
|
||||||
|
|
||||||
Some(next_point)
|
Some((next_point, next_color))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
//! Image
|
||||||
|
use glam::Vec4;
|
||||||
|
use libm::floorf;
|
||||||
|
|
||||||
|
/// Blending modes for mapping IFS color values (which are on a scale `[0, 1]`)
|
||||||
|
/// to RGBA colors.
|
||||||
|
#[derive(Copy, Clone, Default)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum BlendMode {
|
||||||
|
/// Map IFS color values to a linear blend of the nearest two palette colors
|
||||||
|
#[default]
|
||||||
|
Linear = 0,
|
||||||
|
|
||||||
|
/// Map IFS color values to the nearest single palette color
|
||||||
|
Step = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BlendMode {
|
||||||
|
/// Map an IFS color value to RGBA color from the provided palette.
|
||||||
|
pub fn ifs_to_rgb(&self, color: f32, palette: &[Vec4]) -> Vec4 {
|
||||||
|
let colors_m_one = palette.len() - 1;
|
||||||
|
let period = 1.0 / colors_m_one as f32;
|
||||||
|
let index_lower = floorf(color / period) as usize;
|
||||||
|
let index_upper = (index_lower + 1).clamp(0, colors_m_one);
|
||||||
|
let rem = color % period / period;
|
||||||
|
|
||||||
|
match self {
|
||||||
|
BlendMode::Linear => palette[index_lower].lerp(palette[index_upper], rem),
|
||||||
|
BlendMode::Step => palette[index_lower],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UNSAFE: Sound because enum has guaranteed layout (u32) and defined zero-value
|
||||||
|
unsafe impl bytemuck::Zeroable for BlendMode {}
|
||||||
|
// UNSAFE: Sound because enum has guaranteed layout (u32) and defined zero-value
|
||||||
|
unsafe impl bytemuck::Pod for BlendMode {}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use crate::image::BlendMode;
|
||||||
|
use glam::Vec4;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn blend_linear() {
|
||||||
|
let ifs_to_rgb = |color, palette| BlendMode::Linear.ifs_to_rgb(color, palette);
|
||||||
|
|
||||||
|
let palette = &[Vec4::splat(0.0), Vec4::splat(1.0)];
|
||||||
|
assert_eq!(ifs_to_rgb(0.0, palette), Vec4::splat(0.0));
|
||||||
|
assert_eq!(ifs_to_rgb(0.5, palette), Vec4::splat(0.5));
|
||||||
|
assert_eq!(ifs_to_rgb(1.0, palette), Vec4::splat(1.0));
|
||||||
|
|
||||||
|
let palette = &[Vec4::splat(1.0), Vec4::splat(2.0), Vec4::splat(3.0)];
|
||||||
|
assert_eq!(ifs_to_rgb(0.0, palette), Vec4::splat(1.0));
|
||||||
|
assert_eq!(ifs_to_rgb(0.5, palette), Vec4::splat(2.0));
|
||||||
|
assert_eq!(ifs_to_rgb(1.0, palette), Vec4::splat(3.0));
|
||||||
|
|
||||||
|
let palette = &[
|
||||||
|
Vec4::splat(1.0),
|
||||||
|
Vec4::splat(2.0),
|
||||||
|
Vec4::splat(3.0),
|
||||||
|
Vec4::splat(4.0),
|
||||||
|
];
|
||||||
|
assert_eq!(ifs_to_rgb(0.0, palette), Vec4::splat(1.0));
|
||||||
|
assert_eq!(ifs_to_rgb(0.5, palette), Vec4::splat(2.5));
|
||||||
|
assert_eq!(ifs_to_rgb(1.0, palette), Vec4::splat(4.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn blend_step() {
|
||||||
|
let ifs_to_rgb = |color, palette| BlendMode::Step.ifs_to_rgb(color, palette);
|
||||||
|
|
||||||
|
let palette = &[Vec4::splat(0.0), Vec4::splat(1.0)];
|
||||||
|
assert_eq!(ifs_to_rgb(0.5, palette), Vec4::splat(0.0));
|
||||||
|
|
||||||
|
let palette = &[Vec4::splat(1.0), Vec4::splat(2.0), Vec4::splat(3.0)];
|
||||||
|
assert_eq!(ifs_to_rgb(0.0, palette), palette[0]);
|
||||||
|
assert_eq!(ifs_to_rgb(0.25, palette), palette[0]);
|
||||||
|
assert_eq!(ifs_to_rgb(0.4, palette), palette[0]);
|
||||||
|
assert_eq!(ifs_to_rgb(0.5, palette), palette[1]);
|
||||||
|
assert_eq!(ifs_to_rgb(0.7, palette), palette[1]);
|
||||||
|
assert_eq!(ifs_to_rgb(1.0, palette), palette[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
+39
-38
@@ -1,17 +1,14 @@
|
|||||||
//! # Enkou
|
//! # Enkou
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![warn(missing_docs)]
|
#![allow(clippy::needless_range_loop)] // SPIR-V backend has issues with iteration over items
|
||||||
|
|
||||||
pub mod camera;
|
pub mod camera;
|
||||||
pub mod chaos_game;
|
pub mod chaos_game;
|
||||||
|
pub mod image;
|
||||||
pub mod transform;
|
pub mod transform;
|
||||||
|
pub mod variation;
|
||||||
|
|
||||||
use bytemuck::{Pod, Zeroable};
|
use glam::Affine2;
|
||||||
use core::f32::consts::PI;
|
|
||||||
use glam::{Affine2, Vec3, Vec4, vec2, vec3};
|
|
||||||
#[cfg(target_arch = "spirv")]
|
|
||||||
use spirv_std::num_traits::Float;
|
|
||||||
use spirv_std::spirv;
|
|
||||||
|
|
||||||
/// Utility trait to convert between `flam3` notation and [`glam`].
|
/// Utility trait to convert between `flam3` notation and [`glam`].
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
@@ -38,6 +35,28 @@ pub trait Coefficients2 {
|
|||||||
/// ```
|
/// ```
|
||||||
fn from_coefficients(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Affine2;
|
fn from_coefficients(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Affine2;
|
||||||
|
|
||||||
|
/// Convert affine transformation coefficients to the [`glam`] representation.
|
||||||
|
/// Parameters use the following form:
|
||||||
|
///
|
||||||
|
/// ```text
|
||||||
|
/// (a * x + b * y + c, d * x + e * y + f)
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// # use glam::{Affine2, vec2};
|
||||||
|
/// # use crate::enkou_shaders::Coefficients2;
|
||||||
|
/// let coefs = Affine2::from_coefficients_arr([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]);
|
||||||
|
/// let (x, y) = (7.0, 8.0);
|
||||||
|
/// assert_eq!(
|
||||||
|
/// coefs.transform_point2(vec2(x, y)),
|
||||||
|
/// vec2(
|
||||||
|
/// coefs.a() * x + coefs.b() * y + coefs.c(),
|
||||||
|
/// coefs.d() * x + coefs.e() * y + coefs.f()
|
||||||
|
/// )
|
||||||
|
/// );
|
||||||
|
/// ```
|
||||||
|
fn from_coefficients_arr(coefficients: [f32; 6]) -> Affine2;
|
||||||
|
|
||||||
fn a(&self) -> f32;
|
fn a(&self) -> f32;
|
||||||
fn b(&self) -> f32;
|
fn b(&self) -> f32;
|
||||||
fn c(&self) -> f32;
|
fn c(&self) -> f32;
|
||||||
@@ -47,10 +66,23 @@ pub trait Coefficients2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Coefficients2 for Affine2 {
|
impl Coefficients2 for Affine2 {
|
||||||
|
#[inline]
|
||||||
fn from_coefficients(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Affine2 {
|
fn from_coefficients(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Affine2 {
|
||||||
Affine2::from_cols_array(&[a, d, b, e, c, f])
|
Affine2::from_cols_array(&[a, d, b, e, c, f])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn from_coefficients_arr(coefficients: [f32; 6]) -> Affine2 {
|
||||||
|
Affine2::from_coefficients(
|
||||||
|
coefficients[0],
|
||||||
|
coefficients[1],
|
||||||
|
coefficients[2],
|
||||||
|
coefficients[3],
|
||||||
|
coefficients[4],
|
||||||
|
coefficients[5],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn a(&self) -> f32 {
|
fn a(&self) -> f32 {
|
||||||
self.matrix2.x_axis.x
|
self.matrix2.x_axis.x
|
||||||
}
|
}
|
||||||
@@ -75,34 +107,3 @@ impl Coefficients2 for Affine2 {
|
|||||||
self.translation.y
|
self.translation.y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Pod, Zeroable)]
|
|
||||||
#[repr(C)]
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub struct ShaderConstants {
|
|
||||||
pub width: u32,
|
|
||||||
pub height: u32,
|
|
||||||
pub time: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv(fragment)]
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub fn main_fs(vtx_color: Vec3, output: &mut Vec4) {
|
|
||||||
*output = Vec4::from((vtx_color, 1.));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[spirv(vertex)]
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub fn main_vs(
|
|
||||||
#[spirv(vertex_index)] vert_id: i32,
|
|
||||||
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] constants: &ShaderConstants,
|
|
||||||
#[spirv(position)] vtx_pos: &mut Vec4,
|
|
||||||
vtx_color: &mut Vec3,
|
|
||||||
) {
|
|
||||||
let speed = 0.4;
|
|
||||||
let time = constants.time * speed + vert_id as f32 * (2. * PI * 120. / 360.);
|
|
||||||
let position = vec2(f32::sin(time), f32::cos(time));
|
|
||||||
*vtx_pos = Vec4::from((position, 0.0, 1.0));
|
|
||||||
|
|
||||||
*vtx_color = [vec3(1., 0., 0.), vec3(0., 1., 0.), vec3(0., 0., 1.)][vert_id as usize % 3];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,24 +3,136 @@
|
|||||||
//! Transforms are the "functions" in an iterated function system. They take in a point,
|
//! Transforms are the "functions" in an iterated function system. They take in a point,
|
||||||
//! and generate a new point. For fractal flames, transforms are always affine,
|
//! and generate a new point. For fractal flames, transforms are always affine,
|
||||||
//! but produce more interesting images once we add variations.
|
//! but produce more interesting images once we add variations.
|
||||||
|
use crate::variation::Variation;
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use glam::{Affine2, Vec2};
|
use glam::{Affine2, FloatExt, UVec2, Vec2};
|
||||||
|
use rand::Rng;
|
||||||
|
|
||||||
/// Affine transform for use in the [`chaos_game`](crate::chaos_game).
|
/// Affine transform for use in the [`chaos_game`](crate::chaos_game).
|
||||||
#[derive(Copy, Clone, Pod, Zeroable)]
|
#[derive(Copy, Clone, Pod, Zeroable)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Transform {
|
pub struct Transform {
|
||||||
coefficients: Affine2,
|
coefficients: Affine2,
|
||||||
|
coefficients_post: Affine2,
|
||||||
|
variation_range: UVec2,
|
||||||
|
color: f32,
|
||||||
|
color_speed: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Transform {
|
impl Transform {
|
||||||
/// Create a new transform from an affine transformation matrix
|
/// Create a new transform from an affine transformation matrix
|
||||||
pub fn new(coefficients: Affine2) -> Self {
|
pub fn new(
|
||||||
Transform { coefficients }
|
coefficients: Affine2,
|
||||||
|
coefficients_post: Affine2,
|
||||||
|
variation_range: UVec2,
|
||||||
|
color: f32,
|
||||||
|
color_speed: f32,
|
||||||
|
) -> Self {
|
||||||
|
Transform {
|
||||||
|
coefficients,
|
||||||
|
coefficients_post,
|
||||||
|
variation_range,
|
||||||
|
color,
|
||||||
|
color_speed,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply this transform to a point in IFS coordinates, producing a new point
|
/// Apply this transform to a point in IFS coordinates, producing a new point
|
||||||
pub fn transform_point(&self, point: Vec2) -> Vec2 {
|
pub fn transform_point<R: Rng>(
|
||||||
self.coefficients.transform_point2(point)
|
&self,
|
||||||
|
rng: &mut R,
|
||||||
|
variations: &[Variation],
|
||||||
|
point: Vec2,
|
||||||
|
) -> Vec2 {
|
||||||
|
let point = self.coefficients.transform_point2(point);
|
||||||
|
|
||||||
|
let mut point_output = Vec2::ZERO;
|
||||||
|
|
||||||
|
let variation_start = self.variation_range.x;
|
||||||
|
let variation_end = self.variation_range.y;
|
||||||
|
for variation_index in variation_start..variation_end {
|
||||||
|
let variation = &variations[variation_index as usize];
|
||||||
|
point_output += variation.transform_point(point, rng, &self.coefficients)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.coefficients_post.transform_point2(point)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Apply this transform to a color in IFS coordinates, producing a new color
|
||||||
|
pub fn transform_color(&self, color: f32) -> f32 {
|
||||||
|
self.color.lerp(color, self.color_speed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use crate::transform::Transform;
|
||||||
|
use crate::variation::{Variation, VariationKind};
|
||||||
|
use glam::{Affine2, uvec2, vec2};
|
||||||
|
use rand::SeedableRng;
|
||||||
|
use rand_xoshiro::Xoshiro256StarStar;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn transform_scaling() {
|
||||||
|
let scale_coefficients = vec2(2.0, 0.5);
|
||||||
|
let transform = Transform::new(
|
||||||
|
Affine2::from_scale(scale_coefficients),
|
||||||
|
Affine2::IDENTITY,
|
||||||
|
uvec2(0, 1),
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut rng = Xoshiro256StarStar::from_seed([0u8; 32]);
|
||||||
|
let variations = [Variation::IDENTITY];
|
||||||
|
let point = vec2(1.0, 1.0);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
transform.transform_point(&mut rng, &variations, point),
|
||||||
|
scale_coefficients
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn transform_scaling_post() {
|
||||||
|
let scale_coefficients = vec2(2.0, 0.5);
|
||||||
|
let transform_pdj =
|
||||||
|
Transform::new(Affine2::IDENTITY, Affine2::IDENTITY, uvec2(0, 1), 0.0, 0.0);
|
||||||
|
let transform_pdj_post = Transform::new(
|
||||||
|
Affine2::IDENTITY,
|
||||||
|
Affine2::from_scale(scale_coefficients),
|
||||||
|
uvec2(0, 1),
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut rng = Xoshiro256StarStar::from_seed([0; 32]);
|
||||||
|
let variations = [Variation::new(VariationKind::Pdj, 1.0, [0.0f32; 4].into())];
|
||||||
|
let point = vec2(1.0, 1.0);
|
||||||
|
|
||||||
|
let point_pdj = transform_pdj.transform_point(&mut rng, &variations, point);
|
||||||
|
let point_pdj_post = transform_pdj_post.transform_point(&mut rng, &variations, point);
|
||||||
|
|
||||||
|
assert_eq!(point_pdj * scale_coefficients, point_pdj_post);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn transform_color() {
|
||||||
|
let starting_color = 0.0;
|
||||||
|
let transform_color = 1.0;
|
||||||
|
let transform_speed = 0.5;
|
||||||
|
|
||||||
|
let transform = Transform::new(
|
||||||
|
Affine2::IDENTITY,
|
||||||
|
Affine2::IDENTITY,
|
||||||
|
uvec2(0, 1),
|
||||||
|
starting_color,
|
||||||
|
transform_speed,
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
transform.transform_color(starting_color),
|
||||||
|
starting_color * (1.0 - transform_speed) + transform_color * transform_speed
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
//! # Variation
|
||||||
|
//!
|
||||||
|
//! Variations extend the fractal flame iterated function system
|
||||||
|
//! with non-linear transforms (as opposed to [`Transform`]s,
|
||||||
|
//! which are strictly affine transformations).
|
||||||
|
use crate::Coefficients2;
|
||||||
|
use bytemuck::{Pod, Zeroable};
|
||||||
|
use core::f32::consts::PI;
|
||||||
|
use glam::{Affine2, Vec2, vec2};
|
||||||
|
use libm::{atan2f, cosf, powf, sinf, sqrtf, tanf};
|
||||||
|
use rand::distr::StandardUniform;
|
||||||
|
use rand::{Rng, RngExt};
|
||||||
|
|
||||||
|
/// Generic variation parameters
|
||||||
|
///
|
||||||
|
/// Not all variations will use these parameters, but passing them
|
||||||
|
/// as an array per variation allows shaders to use a consistent struct size
|
||||||
|
/// no matter what the variation actually needs.
|
||||||
|
#[derive(Copy, Clone, Pod, Zeroable)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct VariationParams([f32; 4]);
|
||||||
|
|
||||||
|
impl From<[f32; 4]> for VariationParams {
|
||||||
|
fn from(v: [f32; 4]) -> Self {
|
||||||
|
VariationParams(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Enum for all supported variation types
|
||||||
|
///
|
||||||
|
/// ID numbers are chosen to match the variation identifier also used by `flam3`
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(u32)]
|
||||||
|
#[allow(missing_docs)]
|
||||||
|
pub enum VariationKind {
|
||||||
|
/// Identity variation, returns the point as-is
|
||||||
|
Linear = 0,
|
||||||
|
Spherical = 2,
|
||||||
|
Julia = 13,
|
||||||
|
Popcorn = 17,
|
||||||
|
Pdj = 24,
|
||||||
|
}
|
||||||
|
|
||||||
|
// UNSAFE: Sound because enum has guaranteed layout (u32) and defined zero-value
|
||||||
|
unsafe impl bytemuck::Zeroable for VariationKind {}
|
||||||
|
// UNSAFE: Sound because enum has guaranteed layout (u32) and defined zero-value
|
||||||
|
unsafe impl bytemuck::Pod for VariationKind {}
|
||||||
|
|
||||||
|
/// Parameters required for shaders to run the variation function.
|
||||||
|
///
|
||||||
|
/// Not all variations use the [`VariationParams`], but using the struct
|
||||||
|
/// makes it easy to provide parameters to the shader.
|
||||||
|
#[derive(Copy, Clone, Pod, Zeroable)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct Variation {
|
||||||
|
kind: VariationKind,
|
||||||
|
weight: f32,
|
||||||
|
params: VariationParams,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Variation {
|
||||||
|
/// Identity variation; calling [`transform_point`] will yield
|
||||||
|
/// the same point as the input.
|
||||||
|
pub const IDENTITY: Variation = Variation {
|
||||||
|
kind: VariationKind::Linear,
|
||||||
|
weight: 1.0,
|
||||||
|
params: VariationParams([0f32; 4]),
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Create a new variation by providing the variation kind, weight, and parameters.
|
||||||
|
pub fn new(kind: VariationKind, weight: f32, params: VariationParams) -> Variation {
|
||||||
|
Variation {
|
||||||
|
kind,
|
||||||
|
weight,
|
||||||
|
params,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Transform a point by applying this variation.
|
||||||
|
///
|
||||||
|
/// Output points are scaled by this variation's weight.
|
||||||
|
pub fn transform_point<R: Rng>(
|
||||||
|
&self,
|
||||||
|
point: Vec2,
|
||||||
|
rng: &mut R,
|
||||||
|
coefficients: &Affine2,
|
||||||
|
) -> Vec2 {
|
||||||
|
(match self.kind {
|
||||||
|
VariationKind::Linear => transform_point_linear(point),
|
||||||
|
VariationKind::Spherical => transform_point_spherical(point),
|
||||||
|
VariationKind::Julia => transform_point_julia(point, rng),
|
||||||
|
VariationKind::Popcorn => transform_point_popcorn(point, coefficients),
|
||||||
|
VariationKind::Pdj => transform_point_pdj(point, &self.params),
|
||||||
|
}) * self.weight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transform_point_linear(point: Vec2) -> Vec2 {
|
||||||
|
point
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transform_point_spherical(point: Vec2) -> Vec2 {
|
||||||
|
let r2 = (point * point).element_sum();
|
||||||
|
let r2_inv = 1.0 / r2;
|
||||||
|
|
||||||
|
point * Vec2::splat(r2_inv)
|
||||||
|
}
|
||||||
|
fn transform_point_julia<R: Rng>(point: Vec2, rng: &mut R) -> Vec2 {
|
||||||
|
let x2 = powf(point.x, 2.0);
|
||||||
|
let y2 = powf(point.y, 2.0);
|
||||||
|
let r = sqrtf(x2 + y2);
|
||||||
|
|
||||||
|
let theta = atan2f(point.x, point.y);
|
||||||
|
let omega = if rng.sample::<f32, _>(StandardUniform) > 0.5 {
|
||||||
|
PI
|
||||||
|
} else {
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
let sqrt_r = sqrtf(r);
|
||||||
|
let theta_val = theta / 2.0 + omega;
|
||||||
|
|
||||||
|
vec2(sqrt_r * cosf(theta_val), sqrt_r * sinf(theta_val))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transform_point_popcorn(point: Vec2, coefficients: &Affine2) -> Vec2 {
|
||||||
|
vec2(
|
||||||
|
point.x * coefficients.c() * sinf(tanf(3.0 * point.y)),
|
||||||
|
point.y + coefficients.f() * sinf(tanf(3.0 * point.x)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transform_point_pdj(point: Vec2, params: &VariationParams) -> Vec2 {
|
||||||
|
let (pdj_a, pdj_b, pdj_c, pdj_d) = (params.0[0], params.0[1], params.0[2], params.0[3]);
|
||||||
|
vec2(
|
||||||
|
sinf(pdj_a * point.y) - cosf(pdj_b * point.x),
|
||||||
|
sinf(pdj_c * point.x) - cosf(pdj_d * point.y),
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user