Compare commits
14 commits
71d1ddfa2a
...
be4c634614
Author | SHA1 | Date | |
---|---|---|---|
Alex Janka | be4c634614 | ||
Alex Janka | b2de1697d7 | ||
Alex Janka | 60d9f0766e | ||
Alex Janka | f3a5712a8c | ||
35f499f5e1 | |||
6ce711db26 | |||
d4b4366836 | |||
c646086df4 | |||
f6cf642e50 | |||
98958dfb5e | |||
b5d523e9f3 | |||
5e9ce1207c | |||
1b0574c140 | |||
b84e104212 |
4
.github/workflows/package-obs.yml
vendored
4
.github/workflows/package-obs.yml
vendored
|
@ -27,10 +27,6 @@ jobs:
|
|||
spec: librashader.spec
|
||||
can_fail: true
|
||||
name: Ubuntu 23.10 (.deb)
|
||||
- repo: Arch
|
||||
spec: PKGBUILD
|
||||
can_fail: false
|
||||
name: Arch (PKGBUILD)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [approve-obs-build]
|
||||
continue-on-error: ${{ matrix.can_fail }}
|
||||
|
|
3
.github/workflows/publish-obs.yml
vendored
3
.github/workflows/publish-obs.yml
vendored
|
@ -18,9 +18,6 @@ jobs:
|
|||
- repo: xUbuntu_23.10
|
||||
spec: librashader.spec
|
||||
can_fail: true
|
||||
- repo: Arch
|
||||
spec: PKGBUILD
|
||||
can_fail: false
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.can_fail }}
|
||||
container:
|
||||
|
|
292
Cargo.lock
generated
292
Cargo.lock
generated
|
@ -125,7 +125,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -158,32 +158,23 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.37.3+1.3.251"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a"
|
||||
dependencies = [
|
||||
"libloading 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.38.0+1.3.281"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
|
||||
dependencies = [
|
||||
"libloading 0.8.3",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ash-window"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab"
|
||||
checksum = "52bca67b61cb81e5553babde81b8211f713cb6db79766f80168f3e5f40ea6c82"
|
||||
dependencies = [
|
||||
"ash 0.37.3+1.3.251",
|
||||
"raw-window-handle 0.5.2",
|
||||
"ash",
|
||||
"raw-window-handle 0.6.2",
|
||||
"raw-window-metal",
|
||||
]
|
||||
|
||||
|
@ -195,7 +186,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -310,9 +301,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
|||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "2.4.0"
|
||||
version = "2.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bdba4ac537b9346c50122b6e9f9b0d2bd721e04c6032e1d15f53ce0747b054c"
|
||||
checksum = "415f8399438eb5e4b2f73ed3152a3448b98149dda642a957ee704e1daa5cf1d8"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
|
@ -375,12 +366,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.4.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e58aa60e59d8dbfcc36138f5f18be5f24394d33b38b24f7fd0b1caa33095f22f"
|
||||
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
|
||||
dependencies = [
|
||||
"block-sys",
|
||||
"objc2 0.5.1",
|
||||
"objc2 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -409,9 +399,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce"
|
|||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.16.0"
|
||||
version = "1.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5"
|
||||
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
@ -424,7 +414,7 @@ checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -853,7 +843,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"libloading 0.7.4",
|
||||
"libloading",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -906,7 +896,7 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading 0.8.3",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1048,7 +1038,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1204,7 +1194,7 @@ checksum = "c6287b8071643d2f88055233b1ecfec954819cd5f91ff4095d5f2e2739a37b3a"
|
|||
dependencies = [
|
||||
"glslang-sys",
|
||||
"once_cell",
|
||||
"rustc-hash",
|
||||
"rustc-hash 1.1.0",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -1246,18 +1236,6 @@ dependencies = [
|
|||
"bitflags 2.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-allocator"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
|
||||
dependencies = [
|
||||
"ash 0.37.3+1.3.251",
|
||||
"log",
|
||||
"presser",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-allocator"
|
||||
version = "0.26.0"
|
||||
|
@ -1271,6 +1249,18 @@ dependencies = [
|
|||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-allocator"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"log",
|
||||
"presser",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-descriptor"
|
||||
version = "0.3.0"
|
||||
|
@ -1338,7 +1328,7 @@ dependencies = [
|
|||
"bitflags 2.6.0",
|
||||
"com",
|
||||
"libc",
|
||||
"libloading 0.8.3",
|
||||
"libloading",
|
||||
"thiserror",
|
||||
"widestring",
|
||||
"winapi",
|
||||
|
@ -1371,6 +1361,12 @@ version = "0.3.9"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
|
||||
|
||||
[[package]]
|
||||
name = "hexf-parse"
|
||||
version = "0.2.1"
|
||||
|
@ -1394,16 +1390,6 @@ dependencies = [
|
|||
"objc2 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icrate"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fb69199826926eb864697bddd27f73d9fddcffc004f5733131e15b465e30642"
|
||||
dependencies = [
|
||||
"block2 0.4.0",
|
||||
"objc2 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.25.1"
|
||||
|
@ -1471,7 +1457,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1564,7 +1550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"libloading 0.8.3",
|
||||
"libloading",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
|
@ -1576,9 +1562,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
|||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lebe"
|
||||
|
@ -1603,16 +1589,6 @@ dependencies = [
|
|||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.3"
|
||||
|
@ -1625,12 +1601,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"ash 0.38.0+1.3.281",
|
||||
"ash",
|
||||
"glob",
|
||||
"halfbrown",
|
||||
"icrate 0.1.2",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
|
@ -1644,7 +1619,8 @@ dependencies = [
|
|||
"librashader-runtime-mtl",
|
||||
"librashader-runtime-vk",
|
||||
"librashader-runtime-wgpu",
|
||||
"objc2 0.5.1",
|
||||
"objc2 0.5.2",
|
||||
"objc2-metal",
|
||||
"once_cell",
|
||||
"rayon",
|
||||
"wgpu",
|
||||
|
@ -1662,7 +1638,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-cache"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"blake3",
|
||||
|
@ -1678,16 +1654,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-capi"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"ash 0.37.3+1.3.251",
|
||||
"ash",
|
||||
"gl",
|
||||
"icrate 0.1.2",
|
||||
"librashader",
|
||||
"librashader-spirv-cross",
|
||||
"objc2 0.5.1",
|
||||
"objc2 0.5.2",
|
||||
"objc2-metal",
|
||||
"paste",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.0.0",
|
||||
"sptr",
|
||||
"thiserror",
|
||||
"windows",
|
||||
|
@ -1695,21 +1671,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-common"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"ash 0.38.0+1.3.281",
|
||||
"ash",
|
||||
"gl",
|
||||
"halfbrown",
|
||||
"icrate 0.1.2",
|
||||
"num-traits",
|
||||
"rustc-hash",
|
||||
"objc2-metal",
|
||||
"rustc-hash 2.0.0",
|
||||
"wgpu-types",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-preprocess"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"glob",
|
||||
|
@ -1721,7 +1697,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-presets"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"librashader-common",
|
||||
|
@ -1737,7 +1713,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-reflect"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"bytemuck",
|
||||
|
@ -1750,7 +1726,7 @@ dependencies = [
|
|||
"matches",
|
||||
"naga",
|
||||
"rspirv",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.0.0",
|
||||
"serde",
|
||||
"spirv",
|
||||
"spirv-to-dxil",
|
||||
|
@ -1759,7 +1735,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
|
@ -1774,7 +1750,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime-d3d11"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
|
@ -1792,7 +1768,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime-d3d12"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"array-init",
|
||||
|
@ -1814,7 +1790,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime-d3d9"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
|
@ -1832,7 +1808,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime-gl"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"gl",
|
||||
|
@ -1851,31 +1827,32 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime-mtl"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
"icrate 0.1.2",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
"librashader-reflect",
|
||||
"librashader-runtime",
|
||||
"objc2 0.5.1",
|
||||
"objc2 0.5.2",
|
||||
"objc2-foundation",
|
||||
"objc2-metal",
|
||||
"rayon",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime-vk"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"ash 0.37.3+1.3.251",
|
||||
"ash",
|
||||
"ash-window",
|
||||
"bytemuck",
|
||||
"glfw 0.49.1",
|
||||
"gpu-allocator 0.25.0",
|
||||
"gpu-allocator 0.27.0",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
|
@ -1884,7 +1861,7 @@ dependencies = [
|
|||
"librashader-runtime",
|
||||
"num",
|
||||
"parking_lot",
|
||||
"raw-window-handle 0.5.2",
|
||||
"raw-window-handle 0.6.2",
|
||||
"rayon",
|
||||
"thiserror",
|
||||
"winit",
|
||||
|
@ -1892,13 +1869,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-runtime-wgpu"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
"config",
|
||||
"env_logger",
|
||||
"image",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
|
@ -2061,9 +2039,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
|
||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"simd-adler32",
|
||||
|
@ -2071,9 +2049,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "22.0.0"
|
||||
version = "22.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09eeccb9b50f4f7839b214aa3e08be467159506a986c18e0702170ccf720a453"
|
||||
checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-set",
|
||||
|
@ -2084,8 +2062,7 @@ dependencies = [
|
|||
"indexmap 2.2.6",
|
||||
"log",
|
||||
"petgraph",
|
||||
"pp-rs",
|
||||
"rustc-hash",
|
||||
"rustc-hash 1.1.0",
|
||||
"spirv",
|
||||
"termcolor",
|
||||
"thiserror",
|
||||
|
@ -2103,7 +2080,6 @@ dependencies = [
|
|||
"log",
|
||||
"ndk-sys",
|
||||
"num_enum",
|
||||
"raw-window-handle 0.5.2",
|
||||
"raw-window-handle 0.6.2",
|
||||
"thiserror",
|
||||
]
|
||||
|
@ -2197,7 +2173,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2258,7 +2234,7 @@ dependencies = [
|
|||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2288,9 +2264,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objc2"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4b25e1034d0e636cd84707ccdaa9f81243d399196b8a773946dcffec0401659"
|
||||
checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
|
||||
dependencies = [
|
||||
"objc-sys",
|
||||
"objc2-encode 4.0.3",
|
||||
|
@ -2308,6 +2284,30 @@ version = "4.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8"
|
||||
|
||||
[[package]]
|
||||
name = "objc2-foundation"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2 0.5.1",
|
||||
"libc",
|
||||
"objc2 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-metal"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2 0.5.1",
|
||||
"objc2 0.5.2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
|
@ -2439,7 +2439,7 @@ dependencies = [
|
|||
"pest_meta",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2499,13 +2499,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "3.7.1"
|
||||
version = "3.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6a007746f34ed64099e88783b0ae369eaa3da6392868ba262e2af9b8fbaea1"
|
||||
checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"hermit-abi 0.3.9",
|
||||
"hermit-abi 0.4.0",
|
||||
"pin-project-lite",
|
||||
"rustix",
|
||||
"tracing",
|
||||
|
@ -2518,15 +2518,6 @@ version = "0.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
|
||||
|
||||
[[package]]
|
||||
name = "pp-rs"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb458bb7f6e250e6eb79d5026badc10a3ebb8f9a15d1fff0f13d17c71f4d6dee"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
|
@ -2574,9 +2565,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.85"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
||||
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2597,7 +2588,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2712,9 +2703,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ravif"
|
||||
version = "0.11.5"
|
||||
version = "0.11.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc13288f5ab39e6d7c9d501759712e6969fcc9734220846fc9ed26cae2cc4234"
|
||||
checksum = "67376f469e7e7840d0040bbf4b9b3334005bb167f814621326e4c7ab8cd6e944"
|
||||
dependencies = [
|
||||
"avif-serialize",
|
||||
"imgref",
|
||||
|
@ -2748,14 +2739,14 @@ checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
|
|||
|
||||
[[package]]
|
||||
name = "raw-window-metal"
|
||||
version = "0.3.2"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac4ea493258d54c24cb46aa9345d099e58e2ea3f30dd63667fc54fc892f18e76"
|
||||
checksum = "76e8caa82e31bb98fee12fa8f051c94a6aa36b07cddb03f0d4fc558988360ff1"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-graphics",
|
||||
"objc",
|
||||
"raw-window-handle 0.5.2",
|
||||
"raw-window-handle 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2877,7 +2868,7 @@ version = "0.12.0+sdk-1.3.268.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cf3a93856b6e5946537278df0d3075596371b1950ccff012f02b0f7eafec8d"
|
||||
dependencies = [
|
||||
"rustc-hash",
|
||||
"rustc-hash 1.1.0",
|
||||
"spirv",
|
||||
]
|
||||
|
||||
|
@ -2897,6 +2888,12 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.34"
|
||||
|
@ -2973,7 +2970,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3158,9 +3155,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.66"
|
||||
version = "2.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
|
||||
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3236,7 +3233,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3474,7 +3471,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -3508,7 +3505,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -3656,9 +3653,9 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
|
|||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "22.0.0"
|
||||
version = "22.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c87e07e87a179614940ad845397e03201847453a37b43a31a3b54eee2e6e32ce"
|
||||
checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"cfg_aliases",
|
||||
|
@ -3681,9 +3678,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "22.0.0"
|
||||
version = "22.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0f191908a21968991463fcf3b42cb6c9648c0fb7fa301b8fc733bc21a9ed9bd"
|
||||
checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
|
@ -3697,7 +3694,7 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"profiling",
|
||||
"raw-window-handle 0.6.2",
|
||||
"rustc-hash",
|
||||
"rustc-hash 1.1.0",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"wgpu-hal",
|
||||
|
@ -3712,7 +3709,7 @@ checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f"
|
|||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
"ash 0.38.0+1.3.281",
|
||||
"ash",
|
||||
"bit-set",
|
||||
"bitflags 2.6.0",
|
||||
"block",
|
||||
|
@ -3728,7 +3725,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"khronos-egl",
|
||||
"libc",
|
||||
"libloading 0.8.3",
|
||||
"libloading",
|
||||
"log",
|
||||
"metal",
|
||||
"naga",
|
||||
|
@ -3740,7 +3737,7 @@ dependencies = [
|
|||
"range-alloc",
|
||||
"raw-window-handle 0.6.2",
|
||||
"renderdoc-sys",
|
||||
"rustc-hash",
|
||||
"rustc-hash 1.1.0",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
|
@ -4037,7 +4034,7 @@ dependencies = [
|
|||
"core-foundation",
|
||||
"core-graphics",
|
||||
"cursor-icon",
|
||||
"icrate 0.0.4",
|
||||
"icrate",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"log",
|
||||
|
@ -4048,7 +4045,6 @@ dependencies = [
|
|||
"once_cell",
|
||||
"orbclient",
|
||||
"percent-encoding",
|
||||
"raw-window-handle 0.5.2",
|
||||
"raw-window-handle 0.6.2",
|
||||
"redox_syscall 0.3.5",
|
||||
"rustix",
|
||||
|
@ -4117,7 +4113,7 @@ dependencies = [
|
|||
"as-raw-xcb-connection",
|
||||
"gethostname",
|
||||
"libc",
|
||||
"libloading 0.8.3",
|
||||
"libloading",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"x11rb-protocol",
|
||||
|
@ -4186,7 +4182,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.67",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -47,7 +47,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#import <Metal/Metal.h>
|
||||
#endif
|
||||
#if defined(LIBRA_RUNTIME_VULKAN)
|
||||
#include <vulkan\vulkan.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "librashader-cache"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -12,8 +12,8 @@ description = "RetroArch shaders for all."
|
|||
|
||||
[dependencies]
|
||||
serde = { version = "1.0" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7", features = ["serialize"] }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8", features = ["serialize"] }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
platform-dirs = "0.3.0"
|
||||
blake3 = { version = "1.3.3" }
|
||||
thiserror = "1.0.38"
|
||||
|
|
|
@ -16,3 +16,13 @@ impl Cacheable for Vec<u8> {
|
|||
Some(self.to_vec())
|
||||
}
|
||||
}
|
||||
|
||||
impl Cacheable for Option<Vec<u8>> {
|
||||
fn from_bytes(bytes: &[u8]) -> Option<Self> {
|
||||
Some(Some(Vec::from(bytes)))
|
||||
}
|
||||
|
||||
fn to_bytes(&self) -> Option<Vec<u8>> {
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-capi"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -29,20 +29,20 @@ __cbindgen_internal = ["runtime-all"]
|
|||
|
||||
# make runtime-metal depend on this, so its automatically implied.
|
||||
# this will make cbindgen generate __OBJC__ ifdefs for metal functions.
|
||||
__cbindgen_internal_objc = ["icrate", "objc2"]
|
||||
__cbindgen_internal_objc = ["objc2-metal", "objc2"]
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1.0.37"
|
||||
paste = "1.0.9"
|
||||
gl = { version = "0.14.0", optional = true }
|
||||
rustc-hash = "1.1.0"
|
||||
ash = { version = "0.37", optional = true }
|
||||
rustc-hash = "2.0.0"
|
||||
ash = { version = "0.38", optional = true }
|
||||
spirv_cross = { package = "librashader-spirv-cross", version = "0.25.1" }
|
||||
sptr = "0.3.2"
|
||||
|
||||
[dependencies.librashader]
|
||||
path = "../librashader"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
default-features = false
|
||||
features = ["reflect", "presets", "preprocess"]
|
||||
|
||||
|
@ -51,7 +51,7 @@ workspace = true
|
|||
optional = true
|
||||
|
||||
[target.'cfg(target_vendor="apple")'.dependencies]
|
||||
icrate = { version = "0.1.0" , features = [ "Metal", "Metal_all" ], optional = true }
|
||||
objc2-metal = { version = "0.2.0" , features = [ "all" ], optional = true }
|
||||
objc2 = { version = "0.5.0", features = ["apple"] , optional = true }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
|
|
@ -45,7 +45,7 @@ after_includes = """
|
|||
#import <Metal/Metal.h>
|
||||
#endif
|
||||
#if defined(LIBRA_RUNTIME_VULKAN)
|
||||
#include <vulkan\\vulkan.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
"""
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ pub(crate) use config_struct;
|
|||
pub(crate) use config_version_set;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deny(deprecated)]
|
||||
#[deprecated = "Forward declarations for cbindgen, do not use."]
|
||||
mod __cbindgen_opaque_forward_declarations {
|
||||
macro_rules! typedef_struct {
|
||||
|
@ -188,6 +189,7 @@ mod __cbindgen_opaque_forward_declarations {
|
|||
$($(#[$($attrss)*])*
|
||||
#[allow(unused)]
|
||||
#[doc(hidden)]
|
||||
#[deny(deprecated)]
|
||||
#[deprecated]
|
||||
pub struct $name;
|
||||
)*
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
#![feature(try_blocks)]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![deny(deprecated)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ use std::slice;
|
|||
use librashader::runtime::FilterChainParameters;
|
||||
use librashader::runtime::{Size, Viewport};
|
||||
|
||||
use icrate::Metal::{MTLCommandBuffer, MTLCommandQueue, MTLTexture};
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_metal::{MTLCommandBuffer, MTLCommandQueue, MTLTexture};
|
||||
|
||||
use crate::LIBRASHADER_API_VERSION;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-common"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -20,14 +20,14 @@ d3d12 = ["windows", "dxgi"]
|
|||
dxgi = ["windows"]
|
||||
vulkan = ["ash"]
|
||||
wgpu = ["wgpu-types"]
|
||||
metal = ["icrate"]
|
||||
metal = ["objc2-metal"]
|
||||
|
||||
[dependencies]
|
||||
gl = { version = "0.14.0", optional = true }
|
||||
ash = { version = "0.38", optional = true }
|
||||
wgpu-types = { version = "22.0.0", optional = true }
|
||||
wgpu-types = { version = "22", optional = true }
|
||||
num-traits = "0.2.15"
|
||||
rustc-hash = "1.1.0"
|
||||
rustc-hash = "2.0.0"
|
||||
halfbrown = "0.2.4"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.windows]
|
||||
|
@ -42,7 +42,7 @@ features = [
|
|||
"Win32_Graphics_Direct3D12",
|
||||
]
|
||||
|
||||
[target.'cfg(target_vendor="apple")'.dependencies.icrate]
|
||||
[target.'cfg(target_vendor="apple")'.dependencies.objc2-metal]
|
||||
optional = true
|
||||
version = "0.1.0"
|
||||
features = ["Metal", "Metal_all"]
|
||||
version = "0.2.0"
|
||||
features = ["MTLPixelFormat", "MTLRenderCommandEncoder", "MTLSampler"]
|
||||
|
|
|
@ -1,46 +1,48 @@
|
|||
use crate::{FilterMode, ImageFormat, Size, WrapMode};
|
||||
use icrate::Metal;
|
||||
use objc2_metal::{
|
||||
MTLPixelFormat, MTLSamplerAddressMode, MTLSamplerMinMagFilter, MTLSamplerMipFilter, MTLViewport,
|
||||
};
|
||||
|
||||
impl From<ImageFormat> for Metal::MTLPixelFormat {
|
||||
impl From<ImageFormat> for MTLPixelFormat {
|
||||
fn from(format: ImageFormat) -> Self {
|
||||
match format {
|
||||
ImageFormat::Unknown => 0 as Metal::MTLPixelFormat,
|
||||
ImageFormat::R8Unorm => Metal::MTLPixelFormatR8Unorm,
|
||||
ImageFormat::R8Uint => Metal::MTLPixelFormatR8Uint,
|
||||
ImageFormat::R8Sint => Metal::MTLPixelFormatR8Sint,
|
||||
ImageFormat::R8G8Unorm => Metal::MTLPixelFormatRG8Unorm,
|
||||
ImageFormat::R8G8Uint => Metal::MTLPixelFormatRG8Uint,
|
||||
ImageFormat::R8G8Sint => Metal::MTLPixelFormatRG8Sint,
|
||||
ImageFormat::R8G8B8A8Unorm => Metal::MTLPixelFormatRGBA8Unorm,
|
||||
ImageFormat::R8G8B8A8Uint => Metal::MTLPixelFormatRGBA8Uint,
|
||||
ImageFormat::R8G8B8A8Sint => Metal::MTLPixelFormatRGBA8Sint,
|
||||
ImageFormat::R8G8B8A8Srgb => Metal::MTLPixelFormatRGBA8Unorm_sRGB,
|
||||
ImageFormat::A2B10G10R10UnormPack32 => Metal::MTLPixelFormatRGB10A2Unorm,
|
||||
ImageFormat::A2B10G10R10UintPack32 => Metal::MTLPixelFormatRGB10A2Uint,
|
||||
ImageFormat::R16Uint => Metal::MTLPixelFormatR16Uint,
|
||||
ImageFormat::R16Sint => Metal::MTLPixelFormatR16Sint,
|
||||
ImageFormat::R16Sfloat => Metal::MTLPixelFormatR16Float,
|
||||
ImageFormat::R16G16Uint => Metal::MTLPixelFormatRG16Uint,
|
||||
ImageFormat::R16G16Sint => Metal::MTLPixelFormatRG16Sint,
|
||||
ImageFormat::R16G16Sfloat => Metal::MTLPixelFormatRG16Float,
|
||||
ImageFormat::R16G16B16A16Uint => Metal::MTLPixelFormatRGBA16Uint,
|
||||
ImageFormat::R16G16B16A16Sint => Metal::MTLPixelFormatRGBA16Sint,
|
||||
ImageFormat::R16G16B16A16Sfloat => Metal::MTLPixelFormatRGBA16Float,
|
||||
ImageFormat::R32Uint => Metal::MTLPixelFormatR32Uint,
|
||||
ImageFormat::R32Sint => Metal::MTLPixelFormatR32Sint,
|
||||
ImageFormat::R32Sfloat => Metal::MTLPixelFormatR32Float,
|
||||
ImageFormat::R32G32Uint => Metal::MTLPixelFormatRG32Uint,
|
||||
ImageFormat::R32G32Sint => Metal::MTLPixelFormatRG32Sint,
|
||||
ImageFormat::R32G32Sfloat => Metal::MTLPixelFormatRG32Float,
|
||||
ImageFormat::R32G32B32A32Uint => Metal::MTLPixelFormatRGBA32Uint,
|
||||
ImageFormat::R32G32B32A32Sint => Metal::MTLPixelFormatRGBA32Sint,
|
||||
ImageFormat::R32G32B32A32Sfloat => Metal::MTLPixelFormatRGBA32Float,
|
||||
ImageFormat::Unknown => MTLPixelFormat(0),
|
||||
ImageFormat::R8Unorm => MTLPixelFormat::R8Unorm,
|
||||
ImageFormat::R8Uint => MTLPixelFormat::R8Uint,
|
||||
ImageFormat::R8Sint => MTLPixelFormat::R8Sint,
|
||||
ImageFormat::R8G8Unorm => MTLPixelFormat::RG8Unorm,
|
||||
ImageFormat::R8G8Uint => MTLPixelFormat::RG8Uint,
|
||||
ImageFormat::R8G8Sint => MTLPixelFormat::RG8Sint,
|
||||
ImageFormat::R8G8B8A8Unorm => MTLPixelFormat::RGBA8Unorm,
|
||||
ImageFormat::R8G8B8A8Uint => MTLPixelFormat::RGBA8Uint,
|
||||
ImageFormat::R8G8B8A8Sint => MTLPixelFormat::RGBA8Sint,
|
||||
ImageFormat::R8G8B8A8Srgb => MTLPixelFormat::RGBA8Unorm_sRGB,
|
||||
ImageFormat::A2B10G10R10UnormPack32 => MTLPixelFormat::RGB10A2Unorm,
|
||||
ImageFormat::A2B10G10R10UintPack32 => MTLPixelFormat::RGB10A2Uint,
|
||||
ImageFormat::R16Uint => MTLPixelFormat::R16Uint,
|
||||
ImageFormat::R16Sint => MTLPixelFormat::R16Sint,
|
||||
ImageFormat::R16Sfloat => MTLPixelFormat::R16Float,
|
||||
ImageFormat::R16G16Uint => MTLPixelFormat::RG16Uint,
|
||||
ImageFormat::R16G16Sint => MTLPixelFormat::RG16Sint,
|
||||
ImageFormat::R16G16Sfloat => MTLPixelFormat::RG16Float,
|
||||
ImageFormat::R16G16B16A16Uint => MTLPixelFormat::RGBA16Uint,
|
||||
ImageFormat::R16G16B16A16Sint => MTLPixelFormat::RGBA16Sint,
|
||||
ImageFormat::R16G16B16A16Sfloat => MTLPixelFormat::RGBA16Float,
|
||||
ImageFormat::R32Uint => MTLPixelFormat::R32Uint,
|
||||
ImageFormat::R32Sint => MTLPixelFormat::R32Sint,
|
||||
ImageFormat::R32Sfloat => MTLPixelFormat::R32Float,
|
||||
ImageFormat::R32G32Uint => MTLPixelFormat::RG32Uint,
|
||||
ImageFormat::R32G32Sint => MTLPixelFormat::RG32Sint,
|
||||
ImageFormat::R32G32Sfloat => MTLPixelFormat::RG32Float,
|
||||
ImageFormat::R32G32B32A32Uint => MTLPixelFormat::RGBA32Uint,
|
||||
ImageFormat::R32G32B32A32Sint => MTLPixelFormat::RGBA32Sint,
|
||||
ImageFormat::R32G32B32A32Sfloat => MTLPixelFormat::RGBA32Float,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Metal::MTLViewport> for Size<u32> {
|
||||
fn from(value: Metal::MTLViewport) -> Self {
|
||||
impl From<MTLViewport> for Size<u32> {
|
||||
fn from(value: MTLViewport) -> Self {
|
||||
Size {
|
||||
width: value.width as u32,
|
||||
height: value.height as u32,
|
||||
|
@ -48,9 +50,9 @@ impl From<Metal::MTLViewport> for Size<u32> {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Size<u32>> for Metal::MTLViewport {
|
||||
impl From<Size<u32>> for MTLViewport {
|
||||
fn from(value: Size<u32>) -> Self {
|
||||
Metal::MTLViewport {
|
||||
MTLViewport {
|
||||
originX: 0.0,
|
||||
originY: 0.0,
|
||||
width: value.width as f64,
|
||||
|
@ -61,32 +63,32 @@ impl From<Size<u32>> for Metal::MTLViewport {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<WrapMode> for Metal::MTLSamplerAddressMode {
|
||||
impl From<WrapMode> for MTLSamplerAddressMode {
|
||||
fn from(value: WrapMode) -> Self {
|
||||
match value {
|
||||
WrapMode::ClampToBorder => Metal::MTLSamplerAddressModeClampToBorderColor,
|
||||
WrapMode::ClampToEdge => Metal::MTLSamplerAddressModeClampToEdge,
|
||||
WrapMode::Repeat => Metal::MTLSamplerAddressModeRepeat,
|
||||
WrapMode::MirroredRepeat => Metal::MTLSamplerAddressModeMirrorRepeat,
|
||||
WrapMode::ClampToBorder => MTLSamplerAddressMode::ClampToBorderColor,
|
||||
WrapMode::ClampToEdge => MTLSamplerAddressMode::ClampToEdge,
|
||||
WrapMode::Repeat => MTLSamplerAddressMode::Repeat,
|
||||
WrapMode::MirroredRepeat => MTLSamplerAddressMode::MirrorRepeat,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FilterMode> for Metal::MTLSamplerMinMagFilter {
|
||||
impl From<FilterMode> for MTLSamplerMinMagFilter {
|
||||
fn from(value: FilterMode) -> Self {
|
||||
match value {
|
||||
FilterMode::Linear => Metal::MTLSamplerMinMagFilterLinear,
|
||||
_ => Metal::MTLSamplerMipFilterNearest,
|
||||
FilterMode::Linear => MTLSamplerMinMagFilter::Linear,
|
||||
_ => MTLSamplerMinMagFilter::Nearest,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FilterMode {
|
||||
/// Get the mipmap filtering mode for the given combination.
|
||||
pub fn mtl_mip(&self, mip: FilterMode) -> Metal::MTLSamplerMipFilter {
|
||||
pub fn mtl_mip(&self, _mip: FilterMode) -> MTLSamplerMipFilter {
|
||||
match self {
|
||||
FilterMode::Linear => Metal::MTLSamplerMipFilterLinear,
|
||||
FilterMode::Nearest => Metal::MTLSamplerMipFilterNearest,
|
||||
FilterMode::Linear => MTLSamplerMipFilter::Linear,
|
||||
FilterMode::Nearest => MTLSamplerMipFilter::Nearest,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-preprocess"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -14,7 +14,7 @@ description = "RetroArch shaders for all."
|
|||
[dependencies]
|
||||
thiserror = "1.0.37"
|
||||
nom = "7.1.1"
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.8" }
|
||||
encoding_rs = "0.8.31"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-presets"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -15,7 +15,7 @@ description = "RetroArch shaders for all."
|
|||
thiserror = "1.0.37"
|
||||
nom = "7.1.1"
|
||||
nom_locate = "4.0.0"
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.8" }
|
||||
num-traits = "0.2"
|
||||
once_cell = "1"
|
||||
# we don't need unicode
|
||||
|
|
|
@ -25,7 +25,7 @@ pub enum ParsePresetError {
|
|||
#[error("shader presets must be resolved against an absolute path")]
|
||||
RootPathWasNotAbsolute,
|
||||
/// An IO error occurred when reading the shader preset.
|
||||
#[error("the file was not found during resolution")]
|
||||
#[error("io error on file {0:?}: {1}")]
|
||||
IOError(PathBuf, std::io::Error),
|
||||
/// The shader preset did not contain valid UTF-8 bytes.
|
||||
#[error("expected utf8 bytes but got invalid utf8")]
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-reflect"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -18,21 +18,21 @@ bytemuck = "1.13.0"
|
|||
thiserror = "1.0.37"
|
||||
bitflags = "2.4.2"
|
||||
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
|
||||
spirv_cross = { package = "librashader-spirv-cross", version = "0.25.1", optional = true }
|
||||
|
||||
naga = { version = "22.0.0", optional = true }
|
||||
naga = { version = "22", optional = true }
|
||||
rspirv = { version = "0.12.0", optional = true }
|
||||
spirv = { version = "0.3.0", optional = true }
|
||||
spirv = { version = "0.3.0", optional = true}
|
||||
|
||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
|
||||
indexmap = { version = "2.1.0", features = [] }
|
||||
matches = { version = "0.1.10", features = [] }
|
||||
rustc-hash = "1.1.0"
|
||||
rustc-hash = "2.0.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.spirv-to-dxil]
|
||||
version = "0.4.7"
|
||||
|
@ -42,20 +42,7 @@ optional = true
|
|||
default = ["cross", "naga", "serialize", "wgsl", "msl"]
|
||||
dxil = ["spirv_cross/hlsl", "spirv-to-dxil"]
|
||||
wgsl = ["cross", "naga/wgsl-out", "spirv", "rspirv"]
|
||||
cross = [
|
||||
"spirv_cross",
|
||||
"spirv_cross/glsl",
|
||||
"spirv_cross/hlsl",
|
||||
"spirv_cross/msl",
|
||||
]
|
||||
naga = [
|
||||
"rspirv",
|
||||
"spirv",
|
||||
"naga/spv-in",
|
||||
"naga/spv-out",
|
||||
"naga/wgsl-out",
|
||||
"naga/msl-out",
|
||||
]
|
||||
unstable-naga = ["naga", "naga/glsl-in"]
|
||||
serialize = ["serde"]
|
||||
msl = ["spirv_cross/msl", "naga/msl-out"]
|
||||
cross = [ "spirv_cross", "spirv_cross/glsl", "spirv_cross/hlsl", "spirv_cross/msl" ]
|
||||
naga = [ "rspirv", "spirv", "naga/spv-in", "naga/spv-out", "naga/wgsl-out", "naga/msl-out" ]
|
||||
serialize = [ "serde" ]
|
||||
msl = [ "spirv_cross/msl", "naga/msl-out" ]
|
||||
|
|
|
@ -130,10 +130,7 @@ mod test {
|
|||
use librashader_preprocess::ShaderSource;
|
||||
|
||||
pub fn test() {
|
||||
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
|
||||
"../test/basic.slang".into(),
|
||||
))
|
||||
.unwrap();
|
||||
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
||||
let _cross = Glslang::compile(&result).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ mod test {
|
|||
use crate::reflect::naga::NagaLoweringOptions;
|
||||
use crate::reflect::semantics::{Semantic, ShaderSemantics, UniformSemantic, UniqueSemantics};
|
||||
use crate::reflect::ReflectShader;
|
||||
use bitflags::Flags;
|
||||
use librashader_common::map::FastHashMap;
|
||||
use librashader_preprocess::ShaderSource;
|
||||
|
||||
|
@ -42,10 +43,7 @@ mod test {
|
|||
pub fn test_into() {
|
||||
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
|
||||
// let result = ShaderSource::load("../test/shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang").unwrap();
|
||||
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
|
||||
"../test/basic.slang".into(),
|
||||
))
|
||||
.unwrap();
|
||||
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
||||
|
||||
let mut uniform_semantics: FastHashMap<String, UniformSemantic> = Default::default();
|
||||
|
||||
|
|
|
@ -57,10 +57,7 @@ mod test {
|
|||
use librashader_preprocess::ShaderSource;
|
||||
#[test]
|
||||
pub fn compile_shader() {
|
||||
let result = ShaderSource::load(&librashader_common::ShaderStorage::Path(
|
||||
"../test/basic.slang".into(),
|
||||
))
|
||||
.unwrap();
|
||||
let result = ShaderSource::load("../test/basic.slang").unwrap();
|
||||
let _spirv = compile_spirv(&result).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ impl CompileShader<MSL> for NagaReflect {
|
|||
let pipeline_options = PipelineOptions {
|
||||
allow_and_force_point_size: false,
|
||||
vertex_pulling_transform: false,
|
||||
vertex_buffer_mappings: Vec::new(),
|
||||
vertex_buffer_mappings: vec![],
|
||||
};
|
||||
|
||||
let msl = naga::back::msl::write_string(module, &info, &options, &pipeline_options)?;
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime-d3d11"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -12,12 +12,12 @@ keywords = ["shader", "retroarch", "SPIR-V"]
|
|||
description = "RetroArch shaders for all."
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = ["d3d11"], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.7" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.7", features = ["d3d"] }
|
||||
librashader-common = { path = "../librashader-common", features = ["d3d11"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8", features = ["d3d"] }
|
||||
|
||||
thiserror = "1.0.37"
|
||||
bytemuck = "1.12.3"
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime-d3d12"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -12,12 +12,12 @@ keywords = ["shader", "retroarch", "SPIR-V"]
|
|||
description = "RetroArch shaders for all."
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = ["d3d12"], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7", features = ["dxil"] }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.7" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.7", features = ["d3d"] }
|
||||
librashader-common = { path = "../librashader-common", features = ["d3d12"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8", features = ["dxil"] }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8", features = ["d3d"] }
|
||||
|
||||
thiserror = "1.0.37"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime-d3d9"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -12,12 +12,12 @@ keywords = ["shader", "retroarch", "SPIR-V"]
|
|||
description = "RetroArch shaders for all."
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = ["d3d9", "d3d11"], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.7" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.7", features = ["d3d"] }
|
||||
librashader-common = { path = "../librashader-common", features = ["d3d9", "d3d11"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8", features = ["d3d"] }
|
||||
|
||||
thiserror = "1.0.37"
|
||||
bytemuck = "1.12.3"
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime-gl"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -12,12 +12,12 @@ keywords = ["shader", "retroarch", "SPIR-V"]
|
|||
description = "RetroArch shaders for all."
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = ["opengl"], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.7" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", features = ["opengl"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8" }
|
||||
spirv_cross = { package = "librashader-spirv-cross", version = "0.25.1" }
|
||||
|
||||
gl = "0.14.0"
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime-mtl"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -14,11 +14,11 @@ description = "RetroArch shaders for all."
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = ["metal"], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", features = ["metal"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.8" }
|
||||
|
||||
thiserror = "1.0"
|
||||
array-concat = "0.5.2"
|
||||
|
@ -34,12 +34,14 @@ harness = false
|
|||
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin", "aarch64-apple-ios"]
|
||||
|
||||
[target.'cfg(target_vendor="apple")'.dependencies]
|
||||
icrate = { version = "0.1.0" , features = [ "Metal", "Metal_all" ] }
|
||||
objc2-metal = { version = "0.2", features = ["all"] }
|
||||
objc2-foundation = { version = "0.2", features = ["NSError"] }
|
||||
|
||||
objc2 = { version = "0.5.0", features = ["apple"] }
|
||||
|
||||
[features]
|
||||
|
||||
run_test = ["icrate/AppKit", "icrate/AppKit_all", "icrate/Foundation", "icrate/Foundation_all", "icrate/MetalKit", "icrate/MetalKit_all"]
|
||||
# run_test = ["icrate/AppKit", "i "icrate/Foundation_all", "icrate/MetalKit", "icrate/MetalKit_all"]
|
||||
|
||||
#[lib]
|
||||
#crate-type = ["lib", "staticlib"]
|
|
@ -1,16 +1,13 @@
|
|||
use crate::error;
|
||||
use crate::error::FilterChainError;
|
||||
use icrate::Foundation::{NSRange, NSString};
|
||||
use icrate::Metal::{
|
||||
MTLBuffer, MTLDevice, MTLResource, MTLResourceOptions, MTLResourceStorageModeManaged,
|
||||
MTLResourceStorageModeShared,
|
||||
};
|
||||
use objc2::rc::Id;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_foundation::{NSRange, NSString};
|
||||
use objc2_metal::{MTLBuffer, MTLDevice, MTLResource, MTLResourceOptions};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
pub struct MetalBuffer {
|
||||
buffer: Id<ProtocolObject<dyn MTLBuffer>>,
|
||||
buffer: Retained<ProtocolObject<dyn MTLBuffer>>,
|
||||
size: usize,
|
||||
storage_mode: MTLResourceOptions,
|
||||
}
|
||||
|
@ -28,9 +25,9 @@ impl MetalBuffer {
|
|||
label: &str,
|
||||
) -> error::Result<Self> {
|
||||
let storage_mode = if cfg!(all(target_arch = "aarch64", target_vendor = "apple")) {
|
||||
MTLResourceStorageModeShared
|
||||
MTLResourceOptions::MTLResourceStorageModeShared
|
||||
} else {
|
||||
MTLResourceStorageModeManaged
|
||||
MTLResourceOptions::MTLResourceStorageModeManaged
|
||||
};
|
||||
|
||||
// Can't create buffer of size 0.
|
||||
|
@ -53,7 +50,7 @@ impl MetalBuffer {
|
|||
|
||||
pub fn flush(&self) {
|
||||
// We don't know what was actually written to so...
|
||||
if self.storage_mode == MTLResourceStorageModeManaged {
|
||||
if self.storage_mode == MTLResourceOptions::MTLResourceStorageModeManaged {
|
||||
self.buffer.didModifyRange(NSRange {
|
||||
location: 0,
|
||||
length: self.size,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use array_concat::concat_arrays;
|
||||
use icrate::Metal::{
|
||||
MTLBuffer, MTLDevice, MTLPrimitiveTypeTriangleStrip, MTLRenderCommandEncoder,
|
||||
MTLResourceStorageModeManaged, MTLResourceStorageModeShared,
|
||||
};
|
||||
use librashader_runtime::quad::{QuadType, VertexInput};
|
||||
use objc2::rc::Id;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_metal::{
|
||||
MTLBuffer, MTLDevice, MTLPrimitiveType, MTLRenderCommandEncoder, MTLResourceOptions,
|
||||
};
|
||||
use std::ffi::c_void;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
|
@ -53,7 +52,7 @@ const FINAL_VBO_DATA: [VertexInput; 4] = [
|
|||
const VBO_DATA: [VertexInput; 8] = concat_arrays!(OFFSCREEN_VBO_DATA, FINAL_VBO_DATA);
|
||||
|
||||
pub struct DrawQuad {
|
||||
buffer: Id<ProtocolObject<dyn MTLBuffer>>,
|
||||
buffer: Retained<ProtocolObject<dyn MTLBuffer>>,
|
||||
}
|
||||
|
||||
impl DrawQuad {
|
||||
|
@ -83,9 +82,9 @@ impl DrawQuad {
|
|||
NonNull::new_unchecked(vbo_data.as_ptr() as *mut c_void),
|
||||
vbo_data.len(),
|
||||
if cfg!(target_os = "ios") {
|
||||
MTLResourceStorageModeShared
|
||||
MTLResourceOptions::MTLResourceStorageModeShared
|
||||
} else {
|
||||
MTLResourceStorageModeManaged
|
||||
MTLResourceOptions::MTLResourceStorageModeManaged
|
||||
},
|
||||
)
|
||||
.ok_or(FilterChainError::BufferError)?
|
||||
|
@ -103,7 +102,7 @@ impl DrawQuad {
|
|||
|
||||
unsafe {
|
||||
cmd.setVertexBuffer_offset_atIndex(Some(&self.buffer), 0, VERTEX_BUFFER_INDEX);
|
||||
cmd.drawPrimitives_vertexStart_vertexCount(MTLPrimitiveTypeTriangleStrip, offset, 4);
|
||||
cmd.drawPrimitives_vertexStart_vertexCount(MTLPrimitiveType::TriangleStrip, offset, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//! Metal shader runtime errors.
|
||||
use icrate::Foundation::NSError;
|
||||
use librashader_common::{FilterMode, WrapMode};
|
||||
use librashader_preprocess::PreprocessError;
|
||||
use librashader_presets::ParsePresetError;
|
||||
use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
|
||||
use librashader_runtime::image::ImageError;
|
||||
use objc2::rc::Id;
|
||||
use objc2::rc::Retained;
|
||||
use objc2_foundation::NSError;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Cumulative error type for Metal filter chains.
|
||||
|
@ -26,7 +26,7 @@ pub enum FilterChainError {
|
|||
#[error("buffer creation error")]
|
||||
BufferError,
|
||||
#[error("metal error")]
|
||||
MetalError(#[from] Id<NSError>),
|
||||
MetalError(#[from] Retained<NSError>),
|
||||
#[error("couldn't find entry for shader")]
|
||||
ShaderWrongEntryName,
|
||||
#[error("couldn't create render pass")]
|
||||
|
|
|
@ -8,12 +8,6 @@ use crate::luts::LutTexture;
|
|||
use crate::options::{FilterChainOptionsMetal, FrameOptionsMetal};
|
||||
use crate::samplers::SamplerSet;
|
||||
use crate::texture::{get_texture_size, InputTexture, MetalTextureRef, OwnedTexture};
|
||||
use icrate::Foundation::NSString;
|
||||
use icrate::Metal::{
|
||||
MTLCommandBuffer, MTLCommandEncoder, MTLCommandQueue, MTLDevice, MTLLoadActionClear,
|
||||
MTLPixelFormat, MTLPixelFormatRGBA8Unorm, MTLRenderPassDescriptor, MTLResource,
|
||||
MTLStoreActionDontCare, MTLStoreActionStore, MTLTexture,
|
||||
};
|
||||
use librashader_common::map::FastHashMap;
|
||||
use librashader_common::{ImageFormat, Size, Viewport};
|
||||
use librashader_presets::context::VideoDriver;
|
||||
|
@ -35,6 +29,11 @@ use librashader_runtime::scaling::ScaleFramebuffer;
|
|||
use librashader_runtime::uniforms::UniformStorage;
|
||||
use objc2::rc::Id;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_foundation::NSString;
|
||||
use objc2_metal::{
|
||||
MTLCommandBuffer, MTLCommandEncoder, MTLCommandQueue, MTLDevice, MTLLoadAction, MTLPixelFormat,
|
||||
MTLRenderPassDescriptor, MTLResource, MTLStoreAction, MTLTexture,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
|
@ -184,8 +183,8 @@ impl FilterChainMetal {
|
|||
let graphics_pipeline = MetalGraphicsPipeline::new(
|
||||
&device,
|
||||
&msl,
|
||||
if render_pass_format == 0 {
|
||||
MTLPixelFormatRGBA8Unorm
|
||||
if render_pass_format == MTLPixelFormat(0) {
|
||||
MTLPixelFormat::RGBA8Unorm
|
||||
} else {
|
||||
render_pass_format
|
||||
},
|
||||
|
@ -344,11 +343,11 @@ impl FilterChainMetal {
|
|||
let desc = MTLRenderPassDescriptor::new();
|
||||
desc.colorAttachments()
|
||||
.objectAtIndexedSubscript(0)
|
||||
.setLoadAction(MTLLoadActionClear);
|
||||
.setLoadAction(MTLLoadAction::Clear);
|
||||
|
||||
desc.colorAttachments()
|
||||
.objectAtIndexedSubscript(0)
|
||||
.setStoreAction(MTLStoreActionDontCare);
|
||||
.setStoreAction(MTLStoreAction::DontCare);
|
||||
desc
|
||||
};
|
||||
|
||||
|
@ -360,8 +359,8 @@ impl FilterChainMetal {
|
|||
.colorAttachments()
|
||||
.objectAtIndexedSubscript(index);
|
||||
ca.setTexture(Some(&history.texture));
|
||||
ca.setLoadAction(MTLLoadActionClear);
|
||||
ca.setStoreAction(MTLStoreActionStore);
|
||||
ca.setLoadAction(MTLLoadAction::Clear);
|
||||
ca.setStoreAction(MTLStoreAction::Store);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ use crate::graphics_pipeline::MetalGraphicsPipeline;
|
|||
use crate::options::FrameOptionsMetal;
|
||||
use crate::samplers::SamplerSet;
|
||||
use crate::texture::{get_texture_size, InputTexture};
|
||||
use icrate::Metal::{MTLCommandBuffer, MTLCommandEncoder, MTLRenderCommandEncoder, MTLTexture};
|
||||
use librashader_common::map::FastHashMap;
|
||||
use librashader_common::{ImageFormat, Size, Viewport};
|
||||
use librashader_preprocess::ShaderSource;
|
||||
|
@ -18,6 +17,7 @@ use librashader_runtime::quad::QuadType;
|
|||
use librashader_runtime::render_target::RenderTarget;
|
||||
use librashader_runtime::uniforms::{NoUniformBinder, UniformStorage};
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_metal::{MTLCommandBuffer, MTLCommandEncoder, MTLRenderCommandEncoder, MTLTexture};
|
||||
|
||||
impl TextureInput for InputTexture {
|
||||
fn size(&self) -> Size<u32> {
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
use crate::error::{FilterChainError, Result};
|
||||
use crate::select_optimal_pixel_format;
|
||||
use bytemuck::offset_of;
|
||||
use icrate::Foundation::NSString;
|
||||
use icrate::Metal::{
|
||||
MTLBlendFactorOneMinusSourceAlpha, MTLBlendFactorSourceAlpha, MTLCommandBuffer,
|
||||
MTLCommandEncoder, MTLDevice, MTLFunction, MTLLibrary, MTLLoadActionDontCare, MTLPixelFormat,
|
||||
MTLPrimitiveTopologyClassTriangle, MTLRenderCommandEncoder, MTLRenderPassDescriptor,
|
||||
MTLRenderPipelineColorAttachmentDescriptor, MTLRenderPipelineDescriptor,
|
||||
MTLRenderPipelineState, MTLScissorRect, MTLStoreActionStore, MTLTexture,
|
||||
MTLVertexAttributeDescriptor, MTLVertexBufferLayoutDescriptor, MTLVertexDescriptor,
|
||||
MTLVertexFormatFloat2, MTLVertexFormatFloat4, MTLVertexStepFunctionPerVertex, MTLViewport,
|
||||
};
|
||||
use librashader_reflect::back::msl::{CrossMslContext, NagaMslContext};
|
||||
use librashader_reflect::back::ShaderCompilerOutput;
|
||||
use librashader_runtime::quad::VertexInput;
|
||||
use librashader_runtime::render_target::RenderTarget;
|
||||
use objc2_foundation::NSString;
|
||||
use objc2_metal::{
|
||||
MTLBlendFactor, MTLCommandBuffer, MTLCommandEncoder, MTLDevice, MTLFunction, MTLLibrary,
|
||||
MTLLoadAction, MTLPixelFormat, MTLPrimitiveTopologyClass, MTLRenderCommandEncoder,
|
||||
MTLRenderPassDescriptor, MTLRenderPipelineColorAttachmentDescriptor,
|
||||
MTLRenderPipelineDescriptor, MTLRenderPipelineState, MTLScissorRect, MTLStoreAction,
|
||||
MTLTexture, MTLVertexAttributeDescriptor, MTLVertexBufferLayoutDescriptor, MTLVertexDescriptor,
|
||||
MTLVertexFormat, MTLVertexStepFunction, MTLViewport,
|
||||
};
|
||||
|
||||
use objc2::rc::Id;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
|
||||
/// This is only really plausible for SPIRV-Cross, for Naga we need to supply the next plausible binding.
|
||||
|
@ -24,29 +23,29 @@ pub const VERTEX_BUFFER_INDEX: usize = 4;
|
|||
|
||||
pub struct MetalGraphicsPipeline {
|
||||
pub layout: PipelineLayoutObjects,
|
||||
render_pipeline: Id<ProtocolObject<dyn MTLRenderPipelineState>>,
|
||||
render_pipeline: Retained<ProtocolObject<dyn MTLRenderPipelineState>>,
|
||||
pub render_pass_format: MTLPixelFormat,
|
||||
}
|
||||
|
||||
pub struct PipelineLayoutObjects {
|
||||
_vertex_lib: Id<ProtocolObject<dyn MTLLibrary>>,
|
||||
_fragment_lib: Id<ProtocolObject<dyn MTLLibrary>>,
|
||||
vertex_entry: Id<ProtocolObject<dyn MTLFunction>>,
|
||||
fragment_entry: Id<ProtocolObject<dyn MTLFunction>>,
|
||||
_vertex_lib: Retained<ProtocolObject<dyn MTLLibrary>>,
|
||||
_fragment_lib: Retained<ProtocolObject<dyn MTLLibrary>>,
|
||||
vertex_entry: Retained<ProtocolObject<dyn MTLFunction>>,
|
||||
fragment_entry: Retained<ProtocolObject<dyn MTLFunction>>,
|
||||
}
|
||||
|
||||
pub(crate) trait MslEntryPoint {
|
||||
fn entry_point() -> Id<NSString>;
|
||||
fn entry_point() -> Retained<NSString>;
|
||||
}
|
||||
|
||||
impl MslEntryPoint for CrossMslContext {
|
||||
fn entry_point() -> Id<NSString> {
|
||||
fn entry_point() -> Retained<NSString> {
|
||||
NSString::from_str("main0")
|
||||
}
|
||||
}
|
||||
|
||||
impl MslEntryPoint for NagaMslContext {
|
||||
fn entry_point() -> Id<NSString> {
|
||||
fn entry_point() -> Retained<NSString> {
|
||||
NSString::from_str("main_")
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +77,7 @@ impl PipelineLayoutObjects {
|
|||
})
|
||||
}
|
||||
|
||||
unsafe fn create_vertex_descriptor() -> Id<MTLVertexDescriptor> {
|
||||
unsafe fn create_vertex_descriptor() -> Retained<MTLVertexDescriptor> {
|
||||
let descriptor = MTLVertexDescriptor::new();
|
||||
let attributes = descriptor.attributes();
|
||||
let layouts = descriptor.layouts();
|
||||
|
@ -89,11 +88,11 @@ impl PipelineLayoutObjects {
|
|||
let texcoord = MTLVertexAttributeDescriptor::new();
|
||||
|
||||
// hopefully metal fills in vertices otherwise we'll need to use the vec4 stuff.
|
||||
position.setFormat(MTLVertexFormatFloat4);
|
||||
position.setFormat(MTLVertexFormat::Float4);
|
||||
position.setBufferIndex(VERTEX_BUFFER_INDEX);
|
||||
position.setOffset(offset_of!(VertexInput, position));
|
||||
|
||||
texcoord.setFormat(MTLVertexFormatFloat2);
|
||||
texcoord.setFormat(MTLVertexFormat::Float2);
|
||||
texcoord.setBufferIndex(VERTEX_BUFFER_INDEX);
|
||||
texcoord.setOffset(offset_of!(VertexInput, texcoord));
|
||||
|
||||
|
@ -101,7 +100,7 @@ impl PipelineLayoutObjects {
|
|||
|
||||
attributes.setObject_atIndexedSubscript(Some(&texcoord), 1);
|
||||
|
||||
binding.setStepFunction(MTLVertexStepFunctionPerVertex);
|
||||
binding.setStepFunction(MTLVertexStepFunction::PerVertex);
|
||||
binding.setStride(std::mem::size_of::<VertexInput>());
|
||||
layouts.setObject_atIndexedSubscript(Some(&binding), VERTEX_BUFFER_INDEX);
|
||||
|
||||
|
@ -109,15 +108,15 @@ impl PipelineLayoutObjects {
|
|||
}
|
||||
|
||||
unsafe fn create_color_attachments(
|
||||
ca: Id<MTLRenderPipelineColorAttachmentDescriptor>,
|
||||
ca: Retained<MTLRenderPipelineColorAttachmentDescriptor>,
|
||||
format: MTLPixelFormat,
|
||||
) -> Id<MTLRenderPipelineColorAttachmentDescriptor> {
|
||||
) -> Retained<MTLRenderPipelineColorAttachmentDescriptor> {
|
||||
ca.setPixelFormat(select_optimal_pixel_format(format));
|
||||
ca.setBlendingEnabled(false);
|
||||
ca.setSourceAlphaBlendFactor(MTLBlendFactorSourceAlpha);
|
||||
ca.setSourceRGBBlendFactor(MTLBlendFactorSourceAlpha);
|
||||
ca.setDestinationAlphaBlendFactor(MTLBlendFactorOneMinusSourceAlpha);
|
||||
ca.setDestinationRGBBlendFactor(MTLBlendFactorOneMinusSourceAlpha);
|
||||
ca.setSourceAlphaBlendFactor(MTLBlendFactor::SourceAlpha);
|
||||
ca.setSourceRGBBlendFactor(MTLBlendFactor::SourceAlpha);
|
||||
ca.setDestinationAlphaBlendFactor(MTLBlendFactor::OneMinusSourceAlpha);
|
||||
ca.setDestinationRGBBlendFactor(MTLBlendFactor::OneMinusSourceAlpha);
|
||||
|
||||
ca
|
||||
}
|
||||
|
@ -126,12 +125,12 @@ impl PipelineLayoutObjects {
|
|||
&self,
|
||||
device: &ProtocolObject<dyn MTLDevice>,
|
||||
format: MTLPixelFormat,
|
||||
) -> Result<Id<ProtocolObject<dyn MTLRenderPipelineState>>> {
|
||||
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>> {
|
||||
let descriptor = MTLRenderPipelineDescriptor::new();
|
||||
|
||||
unsafe {
|
||||
let vertex = Self::create_vertex_descriptor();
|
||||
descriptor.setInputPrimitiveTopology(MTLPrimitiveTopologyClassTriangle);
|
||||
descriptor.setInputPrimitiveTopology(MTLPrimitiveTopologyClass::Triangle);
|
||||
descriptor.setVertexDescriptor(Some(&vertex));
|
||||
|
||||
let ca = descriptor.colorAttachments().objectAtIndexedSubscript(0);
|
||||
|
@ -176,12 +175,12 @@ impl MetalGraphicsPipeline {
|
|||
&self,
|
||||
output: &RenderTarget<ProtocolObject<dyn MTLTexture>>,
|
||||
buffer: &ProtocolObject<dyn MTLCommandBuffer>,
|
||||
) -> Result<Id<ProtocolObject<dyn MTLRenderCommandEncoder>>> {
|
||||
) -> Result<Retained<ProtocolObject<dyn MTLRenderCommandEncoder>>> {
|
||||
unsafe {
|
||||
let descriptor = MTLRenderPassDescriptor::new();
|
||||
let ca = descriptor.colorAttachments().objectAtIndexedSubscript(0);
|
||||
ca.setLoadAction(MTLLoadActionDontCare);
|
||||
ca.setStoreAction(MTLStoreActionStore);
|
||||
ca.setLoadAction(MTLLoadAction::DontCare);
|
||||
ca.setStoreAction(MTLStoreAction::Store);
|
||||
ca.setTexture(Some(output.output));
|
||||
|
||||
let rpass = buffer
|
||||
|
|
|
@ -11,10 +11,7 @@ mod samplers;
|
|||
mod texture;
|
||||
|
||||
pub use filter_chain::FilterChainMetal;
|
||||
use icrate::Metal::{
|
||||
MTLPixelFormat, MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB,
|
||||
MTLPixelFormatRGBA8Unorm, MTLPixelFormatRGBA8Unorm_sRGB,
|
||||
};
|
||||
use objc2_metal::MTLPixelFormat;
|
||||
|
||||
pub mod error;
|
||||
pub mod options;
|
||||
|
@ -24,12 +21,12 @@ impl_filter_chain_parameters!(FilterChainMetal);
|
|||
pub use texture::MetalTextureRef;
|
||||
|
||||
fn select_optimal_pixel_format(format: MTLPixelFormat) -> MTLPixelFormat {
|
||||
if format == MTLPixelFormatRGBA8Unorm {
|
||||
return MTLPixelFormatBGRA8Unorm;
|
||||
if format == MTLPixelFormat::RGBA8Unorm {
|
||||
return MTLPixelFormat::BGRA8Unorm;
|
||||
}
|
||||
|
||||
if format == MTLPixelFormatRGBA8Unorm_sRGB {
|
||||
return MTLPixelFormatBGRA8Unorm_sRGB;
|
||||
if format == MTLPixelFormat::RGBA8Unorm_sRGB {
|
||||
return MTLPixelFormat::BGRA8Unorm_sRGB;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
use crate::error::{FilterChainError, Result};
|
||||
use crate::texture::InputTexture;
|
||||
use icrate::Metal::{
|
||||
MTLBlitCommandEncoder, MTLDevice, MTLOrigin, MTLPixelFormatBGRA8Unorm, MTLRegion,
|
||||
MTLResourceStorageModeManaged, MTLResourceStorageModeShared, MTLSize, MTLTexture,
|
||||
MTLTextureDescriptor, MTLTextureUsageShaderRead,
|
||||
};
|
||||
use librashader_presets::TextureConfig;
|
||||
use librashader_runtime::image::{Image, BGRA8};
|
||||
use librashader_runtime::scaling::MipmapSize;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_metal::{
|
||||
MTLBlitCommandEncoder, MTLDevice, MTLOrigin, MTLPixelFormat, MTLRegion, MTLSize,
|
||||
MTLStorageMode, MTLTexture, MTLTextureDescriptor, MTLTextureUsage,
|
||||
};
|
||||
use std::ffi::c_void;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
|
@ -30,7 +29,7 @@ impl LutTexture {
|
|||
let descriptor = unsafe {
|
||||
let descriptor =
|
||||
MTLTextureDescriptor::texture2DDescriptorWithPixelFormat_width_height_mipmapped(
|
||||
MTLPixelFormatBGRA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
image.size.width as usize,
|
||||
image.size.height as usize,
|
||||
config.mipmap,
|
||||
|
@ -45,13 +44,13 @@ impl LutTexture {
|
|||
|
||||
descriptor.setStorageMode(
|
||||
if cfg!(all(target_arch = "aarch64", target_vendor = "apple")) {
|
||||
MTLResourceStorageModeShared
|
||||
MTLStorageMode::Shared
|
||||
} else {
|
||||
MTLResourceStorageModeManaged
|
||||
MTLStorageMode::Managed
|
||||
},
|
||||
);
|
||||
|
||||
descriptor.setUsage(MTLTextureUsageShaderRead);
|
||||
descriptor.setUsage(MTLTextureUsage::ShaderRead);
|
||||
|
||||
descriptor
|
||||
};
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
use icrate::Metal::{
|
||||
MTLCompareFunctionNever, MTLDevice, MTLSamplerAddressMode,
|
||||
MTLSamplerBorderColorTransparentBlack, MTLSamplerDescriptor, MTLSamplerMinMagFilter,
|
||||
MTLSamplerState,
|
||||
};
|
||||
use librashader_common::map::FastHashMap;
|
||||
use librashader_common::{FilterMode, WrapMode};
|
||||
use objc2::rc::Id;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_metal::{
|
||||
MTLCompareFunction, MTLDevice, MTLSamplerAddressMode, MTLSamplerBorderColor,
|
||||
MTLSamplerDescriptor, MTLSamplerMinMagFilter, MTLSamplerState,
|
||||
};
|
||||
|
||||
use crate::error::{FilterChainError, Result};
|
||||
|
||||
pub struct SamplerSet {
|
||||
// todo: may need to deal with differences in mip filter.
|
||||
samplers:
|
||||
FastHashMap<(WrapMode, FilterMode, FilterMode), Id<ProtocolObject<dyn MTLSamplerState>>>,
|
||||
samplers: FastHashMap<
|
||||
(WrapMode, FilterMode, FilterMode),
|
||||
Retained<ProtocolObject<dyn MTLSamplerState>>,
|
||||
>,
|
||||
}
|
||||
|
||||
impl SamplerSet {
|
||||
|
@ -27,7 +28,7 @@ impl SamplerSet {
|
|||
// eprintln!("{wrap}, {filter}, {mip}");
|
||||
// SAFETY: the sampler set is complete for the matrix
|
||||
// wrap x filter x mipmap
|
||||
let id: &Id<ProtocolObject<dyn MTLSamplerState>> = unsafe {
|
||||
let id: &Retained<ProtocolObject<dyn MTLSamplerState>> = unsafe {
|
||||
self.samplers
|
||||
.get(&(wrap, filter, mipmap))
|
||||
.unwrap_unchecked()
|
||||
|
@ -58,9 +59,9 @@ impl SamplerSet {
|
|||
descriptor.setMipFilter(filter_mode.mtl_mip(*mipmap_filter));
|
||||
descriptor.setLodMinClamp(0.0);
|
||||
descriptor.setLodMaxClamp(1000.0);
|
||||
descriptor.setCompareFunction(MTLCompareFunctionNever);
|
||||
descriptor.setCompareFunction(MTLCompareFunction::Never);
|
||||
descriptor.setMaxAnisotropy(1);
|
||||
descriptor.setBorderColor(MTLSamplerBorderColorTransparentBlack);
|
||||
descriptor.setBorderColor(MTLSamplerBorderColor::TransparentBlack);
|
||||
descriptor.setNormalizedCoordinates(true);
|
||||
|
||||
let Some(sampler_state) = device.newSamplerStateWithDescriptor(&descriptor)
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
use crate::error::{FilterChainError, Result};
|
||||
use crate::select_optimal_pixel_format;
|
||||
use icrate::Metal::{
|
||||
MTLBlitCommandEncoder, MTLCommandBuffer, MTLCommandEncoder, MTLDevice, MTLPixelFormat,
|
||||
MTLStorageModePrivate, MTLTexture, MTLTextureDescriptor, MTLTextureUsageRenderTarget,
|
||||
MTLTextureUsageShaderRead, MTLTextureUsageShaderWrite,
|
||||
};
|
||||
use librashader_common::{FilterMode, ImageFormat, Size, WrapMode};
|
||||
use librashader_presets::Scale2D;
|
||||
use librashader_runtime::scaling::{MipmapSize, ScaleFramebuffer, ViewportSize};
|
||||
use objc2::rc::Id;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::ProtocolObject;
|
||||
use objc2_metal::{
|
||||
MTLBlitCommandEncoder, MTLCommandBuffer, MTLCommandEncoder, MTLDevice, MTLPixelFormat,
|
||||
MTLStorageMode, MTLTexture, MTLTextureDescriptor, MTLTextureUsage,
|
||||
};
|
||||
|
||||
pub type MetalTexture = Id<ProtocolObject<dyn MTLTexture>>;
|
||||
pub type MetalTexture = Retained<ProtocolObject<dyn MTLTexture>>;
|
||||
|
||||
/// Alias to an `id<MTLTexture>`.
|
||||
pub type MetalTextureRef<'a> = &'a ProtocolObject<dyn MTLTexture>;
|
||||
|
@ -71,11 +70,11 @@ impl OwnedTexture {
|
|||
1
|
||||
});
|
||||
|
||||
descriptor.setStorageMode(MTLStorageModePrivate);
|
||||
descriptor.setStorageMode(MTLStorageMode::Private);
|
||||
descriptor.setUsage(
|
||||
MTLTextureUsageShaderRead
|
||||
| MTLTextureUsageShaderWrite
|
||||
| MTLTextureUsageRenderTarget,
|
||||
MTLTextureUsage::ShaderRead
|
||||
| MTLTextureUsage::ShaderWrite
|
||||
| MTLTextureUsage::RenderTarget,
|
||||
);
|
||||
|
||||
descriptor
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime-vk"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -14,17 +14,17 @@ description = "RetroArch shaders for all."
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = ["vulkan"], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.7" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", features = ["vulkan"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8" }
|
||||
|
||||
bytemuck = { version = "1.12.3", features = ["derive"] }
|
||||
thiserror = "1.0.37"
|
||||
ash = { version = "0.37", features = ["debug"] }
|
||||
gpu-allocator = { version = "0.25.0", default-features = false, features = ["vulkan"] }
|
||||
ash = { version = "0.38", features = ["debug"] }
|
||||
gpu-allocator = { version = "0.27.0", default-features = false, features = ["vulkan"] }
|
||||
parking_lot = "0.12.1"
|
||||
rayon = "1.6.1"
|
||||
array-concat = "0.5.2"
|
||||
|
@ -32,9 +32,9 @@ array-concat = "0.5.2"
|
|||
[dev-dependencies]
|
||||
num = "0.4.0"
|
||||
glfw = "0.49.0"
|
||||
winit = { version = "0.29.10", features = ["rwh_05"] }
|
||||
raw-window-handle = "0.5"
|
||||
ash-window = "0.12.0"
|
||||
winit = { version = "0.29.10", features = ["rwh_06"] }
|
||||
raw-window-handle = "0.6.2"
|
||||
ash-window = "0.13.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["librashader-cache/docsrs"]
|
||||
|
|
|
@ -67,7 +67,7 @@ impl TryFrom<VulkanInstance> for VulkanObjects {
|
|||
fn try_from(vulkan: VulkanInstance) -> Result<Self, FilterChainError> {
|
||||
unsafe {
|
||||
let instance = ash::Instance::load(
|
||||
&vk::StaticFn {
|
||||
&ash::StaticFn {
|
||||
get_instance_proc_addr: vulkan.get_instance_proc_addr,
|
||||
},
|
||||
vulkan.instance,
|
||||
|
@ -270,7 +270,7 @@ impl FilterChainVulkan {
|
|||
|
||||
let command_pool = unsafe {
|
||||
device.create_command_pool(
|
||||
&vk::CommandPoolCreateInfo::builder()
|
||||
&vk::CommandPoolCreateInfo::default()
|
||||
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER),
|
||||
None,
|
||||
)?
|
||||
|
@ -279,7 +279,7 @@ impl FilterChainVulkan {
|
|||
let command_buffer = unsafe {
|
||||
// panic safety: command buffer count = 1
|
||||
device.allocate_command_buffers(
|
||||
&vk::CommandBufferAllocateInfo::builder()
|
||||
&vk::CommandBufferAllocateInfo::default()
|
||||
.command_pool(command_pool)
|
||||
.level(vk::CommandBufferLevel::PRIMARY)
|
||||
.command_buffer_count(1),
|
||||
|
@ -289,7 +289,7 @@ impl FilterChainVulkan {
|
|||
unsafe {
|
||||
device.begin_command_buffer(
|
||||
command_buffer,
|
||||
&vk::CommandBufferBeginInfo::builder()
|
||||
&vk::CommandBufferBeginInfo::default()
|
||||
.flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT),
|
||||
)?
|
||||
}
|
||||
|
@ -307,9 +307,9 @@ impl FilterChainVulkan {
|
|||
device.end_command_buffer(command_buffer)?;
|
||||
|
||||
let buffers = [command_buffer];
|
||||
let submit_info = vk::SubmitInfo::builder().command_buffers(&buffers);
|
||||
let submit_info = vk::SubmitInfo::default().command_buffers(&buffers);
|
||||
|
||||
device.queue_submit(queue, &[*submit_info], vk::Fence::null())?;
|
||||
device.queue_submit(queue, &[submit_info], vk::Fence::null())?;
|
||||
device.queue_wait_idle(queue)?;
|
||||
device.free_command_buffers(command_pool, &buffers);
|
||||
device.destroy_command_pool(command_pool, None);
|
||||
|
@ -592,18 +592,18 @@ impl FilterChainVulkan {
|
|||
}
|
||||
|
||||
let original_image_view = unsafe {
|
||||
let create_info = vk::ImageViewCreateInfo::builder()
|
||||
let create_info = vk::ImageViewCreateInfo::default()
|
||||
.image(input.image)
|
||||
.format(input.format)
|
||||
.view_type(vk::ImageViewType::TYPE_2D)
|
||||
.subresource_range(
|
||||
*vk::ImageSubresourceRange::builder()
|
||||
vk::ImageSubresourceRange::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.level_count(1)
|
||||
.layer_count(1),
|
||||
)
|
||||
.components(
|
||||
*vk::ComponentMapping::builder()
|
||||
vk::ComponentMapping::default()
|
||||
.r(vk::ComponentSwizzle::R)
|
||||
.g(vk::ComponentSwizzle::G)
|
||||
.b(vk::ComponentSwizzle::B)
|
||||
|
|
|
@ -55,20 +55,20 @@ impl BindSemantics<NoUniformBinder, Option<()>, RawVulkanBuffer> for FilterPass
|
|||
device: &Self::DeviceContext,
|
||||
) {
|
||||
let sampler = samplers.get(texture.wrap_mode, texture.filter_mode, texture.mip_filter);
|
||||
let image_info = vk::DescriptorImageInfo::builder()
|
||||
let image_info = vk::DescriptorImageInfo::default()
|
||||
.sampler(sampler.handle)
|
||||
.image_view(texture.image_view)
|
||||
.image_layout(vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL);
|
||||
|
||||
let image_info = [*image_info];
|
||||
let write_desc = vk::WriteDescriptorSet::builder()
|
||||
let image_info = [image_info];
|
||||
let write_desc = vk::WriteDescriptorSet::default()
|
||||
.dst_set(*descriptors)
|
||||
.dst_binding(binding.binding)
|
||||
.dst_array_element(0)
|
||||
.descriptor_type(vk::DescriptorType::COMBINED_IMAGE_SAMPLER)
|
||||
.image_info(&image_info);
|
||||
unsafe {
|
||||
device.update_descriptor_sets(&[*write_desc], &[]);
|
||||
device.update_descriptor_sets(&[write_desc], &[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,25 +12,25 @@ pub(crate) struct OutputImage {
|
|||
|
||||
impl OutputImage {
|
||||
pub fn new(device: &ash::Device, image: VulkanImage) -> error::Result<OutputImage> {
|
||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
||||
let image_subresource = vk::ImageSubresourceRange::default()
|
||||
.base_mip_level(0)
|
||||
.base_array_layer(0)
|
||||
.level_count(1)
|
||||
.layer_count(1)
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
||||
|
||||
let swizzle_components = vk::ComponentMapping::builder()
|
||||
let swizzle_components = vk::ComponentMapping::default()
|
||||
.r(vk::ComponentSwizzle::R)
|
||||
.g(vk::ComponentSwizzle::G)
|
||||
.b(vk::ComponentSwizzle::B)
|
||||
.a(vk::ComponentSwizzle::A);
|
||||
|
||||
let view_info = vk::ImageViewCreateInfo::builder()
|
||||
let view_info = vk::ImageViewCreateInfo::default()
|
||||
.view_type(vk::ImageViewType::TYPE_2D)
|
||||
.format(image.format)
|
||||
.image(image.image)
|
||||
.subresource_range(*image_subresource)
|
||||
.components(*swizzle_components);
|
||||
.subresource_range(image_subresource)
|
||||
.components(swizzle_components);
|
||||
|
||||
let image_view = unsafe { device.create_image_view(&view_info, None)? };
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ use std::ffi::CStr;
|
|||
use std::sync::Arc;
|
||||
const ENTRY_POINT: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"main\0") };
|
||||
|
||||
pub struct PipelineDescriptors {
|
||||
pub struct PipelineDescriptors<'a> {
|
||||
pub replicas: u32,
|
||||
pub layout_bindings: Vec<vk::DescriptorSetLayoutBinding>,
|
||||
pub layout_bindings: Vec<vk::DescriptorSetLayoutBinding<'a>>,
|
||||
pub pool_sizes: Vec<vk::DescriptorPoolSize>,
|
||||
}
|
||||
|
||||
impl PipelineDescriptors {
|
||||
impl PipelineDescriptors<'_> {
|
||||
pub fn new(duplicates: u32) -> Self {
|
||||
Self {
|
||||
replicas: duplicates,
|
||||
|
@ -43,6 +43,7 @@ impl PipelineDescriptors {
|
|||
descriptor_count: 1,
|
||||
stage_flags: ubo_mask,
|
||||
p_immutable_samplers: std::ptr::null(),
|
||||
_marker: Default::default(),
|
||||
});
|
||||
|
||||
self.pool_sizes.push(vk::DescriptorPoolSize {
|
||||
|
@ -61,6 +62,7 @@ impl PipelineDescriptors {
|
|||
descriptor_count: 1,
|
||||
stage_flags: texture_mask,
|
||||
p_immutable_samplers: std::ptr::null(),
|
||||
_marker: Default::default(),
|
||||
});
|
||||
|
||||
self.pool_sizes.push(vk::DescriptorPoolSize {
|
||||
|
@ -80,7 +82,7 @@ impl PipelineDescriptors {
|
|||
) -> error::Result<vk::DescriptorSetLayout> {
|
||||
unsafe {
|
||||
let layout = device.create_descriptor_set_layout(
|
||||
&vk::DescriptorSetLayoutCreateInfo::builder().bindings(self.bindings()),
|
||||
&vk::DescriptorSetLayoutCreateInfo::default().bindings(self.bindings()),
|
||||
None,
|
||||
)?;
|
||||
Ok(layout)
|
||||
|
@ -90,9 +92,9 @@ impl PipelineDescriptors {
|
|||
|
||||
pub struct PipelineLayoutObjects {
|
||||
pub layout: vk::PipelineLayout,
|
||||
pub pool: vk::DescriptorPool,
|
||||
pub descriptor_sets: Vec<vk::DescriptorSet>,
|
||||
pub descriptor_set_layout: [vk::DescriptorSetLayout; 1],
|
||||
pub _pool: vk::DescriptorPool,
|
||||
pub _descriptor_set_layout: [vk::DescriptorSetLayout; 1],
|
||||
}
|
||||
|
||||
impl PipelineLayoutObjects {
|
||||
|
@ -108,11 +110,11 @@ impl PipelineLayoutObjects {
|
|||
let descriptor_set_layout = [descriptors.create_descriptor_set_layout(device)?];
|
||||
|
||||
let pipeline_create_info =
|
||||
vk::PipelineLayoutCreateInfo::builder().set_layouts(&descriptor_set_layout);
|
||||
vk::PipelineLayoutCreateInfo::default().set_layouts(&descriptor_set_layout);
|
||||
|
||||
let push_constant_range = reflection.push_constant.as_ref().map(|push_constant| {
|
||||
let stage_mask = util::binding_stage_to_vulkan_stage(push_constant.stage_mask);
|
||||
[*vk::PushConstantRange::builder()
|
||||
[vk::PushConstantRange::default()
|
||||
.stage_flags(stage_mask)
|
||||
.size(push_constant.size)]
|
||||
});
|
||||
|
@ -124,14 +126,14 @@ impl PipelineLayoutObjects {
|
|||
|
||||
let layout = unsafe { device.create_pipeline_layout(&pipeline_create_info, None)? };
|
||||
|
||||
let pool_info = vk::DescriptorPoolCreateInfo::builder()
|
||||
let pool_info = vk::DescriptorPoolCreateInfo::default()
|
||||
.max_sets(replicas)
|
||||
.pool_sizes(&descriptors.pool_sizes);
|
||||
|
||||
let pool = unsafe { device.create_descriptor_pool(&pool_info, None)? };
|
||||
|
||||
let mut descriptor_sets = Vec::new();
|
||||
let alloc_info = vk::DescriptorSetAllocateInfo::builder()
|
||||
let alloc_info = vk::DescriptorSetAllocateInfo::default()
|
||||
.descriptor_pool(pool)
|
||||
.set_layouts(&descriptor_set_layout);
|
||||
|
||||
|
@ -145,9 +147,9 @@ impl PipelineLayoutObjects {
|
|||
|
||||
Ok(PipelineLayoutObjects {
|
||||
layout,
|
||||
descriptor_set_layout,
|
||||
_descriptor_set_layout: descriptor_set_layout,
|
||||
descriptor_sets,
|
||||
pool,
|
||||
_pool: pool,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +196,7 @@ impl VulkanGraphicsPipeline {
|
|||
fragment_module: &VulkanShaderModule,
|
||||
render_pass: Option<&VulkanRenderPass>,
|
||||
) -> error::Result<vk::Pipeline> {
|
||||
let input_assembly = vk::PipelineInputAssemblyStateCreateInfo::builder()
|
||||
let input_assembly = vk::PipelineInputAssemblyStateCreateInfo::default()
|
||||
.topology(vk::PrimitiveTopology::TRIANGLE_STRIP);
|
||||
|
||||
let vao_state = [
|
||||
|
@ -212,17 +214,17 @@ impl VulkanGraphicsPipeline {
|
|||
},
|
||||
];
|
||||
|
||||
let input_binding = vk::VertexInputBindingDescription::builder()
|
||||
let input_binding = vk::VertexInputBindingDescription::default()
|
||||
.binding(0)
|
||||
.stride(std::mem::size_of::<VertexInput>() as u32)
|
||||
.input_rate(vk::VertexInputRate::VERTEX);
|
||||
|
||||
let input_binding = [*input_binding];
|
||||
let pipeline_input_state = vk::PipelineVertexInputStateCreateInfo::builder()
|
||||
let input_binding = [input_binding];
|
||||
let pipeline_input_state = vk::PipelineVertexInputStateCreateInfo::default()
|
||||
.vertex_binding_descriptions(&input_binding)
|
||||
.vertex_attribute_descriptions(&vao_state);
|
||||
|
||||
let raster_state = vk::PipelineRasterizationStateCreateInfo::builder()
|
||||
let raster_state = vk::PipelineRasterizationStateCreateInfo::default()
|
||||
.polygon_mode(vk::PolygonMode::FILL)
|
||||
.cull_mode(vk::CullModeFlags::NONE)
|
||||
.front_face(vk::FrontFace::COUNTER_CLOCKWISE)
|
||||
|
@ -231,19 +233,19 @@ impl VulkanGraphicsPipeline {
|
|||
.depth_bias_enable(false)
|
||||
.line_width(1.0);
|
||||
|
||||
let attachments = vk::PipelineColorBlendAttachmentState::builder()
|
||||
let attachments = vk::PipelineColorBlendAttachmentState::default()
|
||||
.blend_enable(false)
|
||||
.color_write_mask(vk::ColorComponentFlags::from_raw(0xf));
|
||||
|
||||
let attachments = [*attachments];
|
||||
let attachments = [attachments];
|
||||
let blend_state =
|
||||
vk::PipelineColorBlendStateCreateInfo::builder().attachments(&attachments);
|
||||
vk::PipelineColorBlendStateCreateInfo::default().attachments(&attachments);
|
||||
|
||||
let viewport_state = vk::PipelineViewportStateCreateInfo::builder()
|
||||
let viewport_state = vk::PipelineViewportStateCreateInfo::default()
|
||||
.viewport_count(1)
|
||||
.scissor_count(1);
|
||||
|
||||
let depth_stencil_state = vk::PipelineDepthStencilStateCreateInfo::builder()
|
||||
let depth_stencil_state = vk::PipelineDepthStencilStateCreateInfo::default()
|
||||
.depth_test_enable(false)
|
||||
.depth_write_enable(false)
|
||||
.stencil_test_enable(false)
|
||||
|
@ -251,25 +253,24 @@ impl VulkanGraphicsPipeline {
|
|||
.min_depth_bounds(1.0)
|
||||
.max_depth_bounds(1.0);
|
||||
|
||||
let multisample_state = vk::PipelineMultisampleStateCreateInfo::builder()
|
||||
let multisample_state = vk::PipelineMultisampleStateCreateInfo::default()
|
||||
.rasterization_samples(vk::SampleCountFlags::TYPE_1);
|
||||
|
||||
let states = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
||||
let dynamic_state = vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&states);
|
||||
let dynamic_state = vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&states);
|
||||
|
||||
let shader_stages = [
|
||||
vk::PipelineShaderStageCreateInfo::builder()
|
||||
vk::PipelineShaderStageCreateInfo::default()
|
||||
.stage(vk::ShaderStageFlags::VERTEX)
|
||||
.name(ENTRY_POINT)
|
||||
.module(vertex_module.shader),
|
||||
vk::PipelineShaderStageCreateInfo::builder()
|
||||
vk::PipelineShaderStageCreateInfo::default()
|
||||
.stage(vk::ShaderStageFlags::FRAGMENT)
|
||||
.name(ENTRY_POINT)
|
||||
.module(fragment_module.shader),
|
||||
];
|
||||
|
||||
let shader_stages = [*shader_stages[0], *shader_stages[1]];
|
||||
let mut pipeline_info = vk::GraphicsPipelineCreateInfo::builder()
|
||||
let mut pipeline_info = vk::GraphicsPipelineCreateInfo::default()
|
||||
.stages(&shader_stages)
|
||||
.vertex_input_state(&pipeline_input_state)
|
||||
.input_assembly_state(&input_assembly)
|
||||
|
@ -288,7 +289,7 @@ impl VulkanGraphicsPipeline {
|
|||
let pipeline = unsafe {
|
||||
// panic_safety: if this is successful this should return 1 pipelines.
|
||||
device
|
||||
.create_graphics_pipelines(*cache, &[*pipeline_info], None)
|
||||
.create_graphics_pipelines(*cache, &[pipeline_info], None)
|
||||
.map_err(|e| e.1)?[0]
|
||||
};
|
||||
|
||||
|
@ -306,9 +307,9 @@ impl VulkanGraphicsPipeline {
|
|||
let pipeline_layout = PipelineLayoutObjects::new(reflection, replicas, device)?;
|
||||
|
||||
let vertex_info =
|
||||
vk::ShaderModuleCreateInfo::builder().code(shader_assembly.vertex.as_ref());
|
||||
vk::ShaderModuleCreateInfo::default().code(shader_assembly.vertex.as_ref());
|
||||
let fragment_info =
|
||||
vk::ShaderModuleCreateInfo::builder().code(shader_assembly.fragment.as_ref());
|
||||
vk::ShaderModuleCreateInfo::default().code(shader_assembly.fragment.as_ref());
|
||||
|
||||
let vertex_module = VulkanShaderModule::new(device, &vertex_info)?;
|
||||
let fragment_module = VulkanShaderModule::new(device, &fragment_info)?;
|
||||
|
@ -325,7 +326,7 @@ impl VulkanGraphicsPipeline {
|
|||
"vulkan",
|
||||
&[&shader_assembly.vertex, &shader_assembly.fragment],
|
||||
|pipeline_data| {
|
||||
let mut cache_info = vk::PipelineCacheCreateInfo::builder();
|
||||
let mut cache_info = vk::PipelineCacheCreateInfo::default();
|
||||
if let Some(pipeline_data) = pipeline_data.as_ref() {
|
||||
cache_info = cache_info.initial_data(pipeline_data);
|
||||
}
|
||||
|
@ -394,7 +395,7 @@ impl VulkanGraphicsPipeline {
|
|||
let attachments = [output.output.image_view];
|
||||
let framebuffer = unsafe {
|
||||
self.device.create_framebuffer(
|
||||
&vk::FramebufferCreateInfo::builder()
|
||||
&vk::FramebufferCreateInfo::default()
|
||||
.render_pass(render_pass.handle)
|
||||
.attachments(&attachments)
|
||||
.width(output.output.size.width)
|
||||
|
@ -410,7 +411,7 @@ impl VulkanGraphicsPipeline {
|
|||
},
|
||||
}];
|
||||
|
||||
let render_pass_info = vk::RenderPassBeginInfo::builder()
|
||||
let render_pass_info = vk::RenderPassBeginInfo::default()
|
||||
.framebuffer(framebuffer)
|
||||
.render_pass(render_pass.handle)
|
||||
.clear_values(&clear_values)
|
||||
|
@ -428,14 +429,13 @@ impl VulkanGraphicsPipeline {
|
|||
}
|
||||
Ok(Some(framebuffer))
|
||||
} else {
|
||||
let attachments = vk::RenderingAttachmentInfo::builder()
|
||||
let attachments = [vk::RenderingAttachmentInfo::default()
|
||||
.load_op(vk::AttachmentLoadOp::DONT_CARE)
|
||||
.store_op(vk::AttachmentStoreOp::STORE)
|
||||
.image_layout(vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
||||
.image_view(output.output.image_view);
|
||||
let attachments = [*attachments];
|
||||
.image_view(output.output.image_view)];
|
||||
|
||||
let rendering_info = vk::RenderingInfo::builder()
|
||||
let rendering_info = vk::RenderingInfo::default()
|
||||
.layer_count(1)
|
||||
.render_area(vk::Rect2D {
|
||||
offset: vk::Offset2D { x: 0, y: 0 },
|
||||
|
|
|
@ -20,7 +20,7 @@ impl LutTexture {
|
|||
image: Image<BGRA8>,
|
||||
config: &TextureConfig,
|
||||
) -> error::Result<LutTexture> {
|
||||
let image_info = vk::ImageCreateInfo::builder()
|
||||
let image_info = vk::ImageCreateInfo::default()
|
||||
.image_type(vk::ImageType::TYPE_2D)
|
||||
.format(vk::Format::B8G8R8A8_UNORM)
|
||||
.extent(image.size.into())
|
||||
|
@ -46,23 +46,23 @@ impl LutTexture {
|
|||
VulkanImageMemory::new(&vulkan.device, &vulkan.alloc, mem_reqs, &texture)?
|
||||
};
|
||||
|
||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
||||
let image_subresource = vk::ImageSubresourceRange::default()
|
||||
.level_count(image_info.mip_levels)
|
||||
.layer_count(1)
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
||||
|
||||
let swizzle_components = vk::ComponentMapping::builder()
|
||||
let swizzle_components = vk::ComponentMapping::default()
|
||||
.r(vk::ComponentSwizzle::R)
|
||||
.g(vk::ComponentSwizzle::G)
|
||||
.b(vk::ComponentSwizzle::B)
|
||||
.a(vk::ComponentSwizzle::A);
|
||||
|
||||
let view_info = vk::ImageViewCreateInfo::builder()
|
||||
let view_info = vk::ImageViewCreateInfo::default()
|
||||
.view_type(vk::ImageViewType::TYPE_2D)
|
||||
.format(vk::Format::B8G8R8A8_UNORM)
|
||||
.image(texture)
|
||||
.subresource_range(*image_subresource)
|
||||
.components(*swizzle_components);
|
||||
.subresource_range(image_subresource)
|
||||
.components(swizzle_components);
|
||||
|
||||
let texture_view = unsafe { vulkan.device.create_image_view(&view_info, None)? };
|
||||
|
||||
|
@ -95,9 +95,9 @@ impl LutTexture {
|
|||
vk::QUEUE_FAMILY_IGNORED,
|
||||
);
|
||||
|
||||
let builder = vk::BufferImageCopy::builder()
|
||||
let builder = vk::BufferImageCopy::default()
|
||||
.image_subresource(
|
||||
*vk::ImageSubresourceLayers::builder()
|
||||
vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(0)
|
||||
.base_array_layer(0)
|
||||
|
@ -114,7 +114,7 @@ impl LutTexture {
|
|||
} else {
|
||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL
|
||||
},
|
||||
&[*builder],
|
||||
&[builder],
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -140,22 +140,22 @@ impl LutTexture {
|
|||
z: 1,
|
||||
},
|
||||
];
|
||||
let src_subresource = vk::ImageSubresourceLayers::builder()
|
||||
let src_subresource = vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(level - 1)
|
||||
.base_array_layer(0)
|
||||
.layer_count(1);
|
||||
|
||||
let dst_subresource = vk::ImageSubresourceLayers::builder()
|
||||
let dst_subresource = vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(level)
|
||||
.base_array_layer(0)
|
||||
.layer_count(1);
|
||||
|
||||
let image_blit = vk::ImageBlit::builder()
|
||||
.src_subresource(*src_subresource)
|
||||
let image_blit = vk::ImageBlit::default()
|
||||
.src_subresource(src_subresource)
|
||||
.src_offsets(src_offsets)
|
||||
.dst_subresource(*dst_subresource)
|
||||
.dst_subresource(dst_subresource)
|
||||
.dst_offsets(dst_offsets);
|
||||
|
||||
unsafe {
|
||||
|
@ -181,7 +181,7 @@ impl LutTexture {
|
|||
vk::ImageLayout::GENERAL,
|
||||
texture,
|
||||
vk::ImageLayout::GENERAL,
|
||||
&[*image_blit],
|
||||
&[image_blit],
|
||||
config.filter_mode.into(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ impl VulkanBuffer {
|
|||
size: usize,
|
||||
) -> error::Result<VulkanBuffer> {
|
||||
unsafe {
|
||||
let buffer_info = vk::BufferCreateInfo::builder()
|
||||
let buffer_info = vk::BufferCreateInfo::default()
|
||||
.size(size as vk::DeviceSize)
|
||||
.usage(usage)
|
||||
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
||||
|
@ -161,13 +161,12 @@ impl RawVulkanBuffer {
|
|||
storage: &impl UniformStorageAccess,
|
||||
) -> error::Result<()> {
|
||||
unsafe {
|
||||
let buffer_info = vk::DescriptorBufferInfo::builder()
|
||||
let buffer_info = [vk::DescriptorBufferInfo::default()
|
||||
.buffer(self.buffer.handle)
|
||||
.offset(0)
|
||||
.range(storage.ubo_slice().len() as vk::DeviceSize);
|
||||
.range(storage.ubo_slice().len() as vk::DeviceSize)];
|
||||
|
||||
let buffer_info = [*buffer_info];
|
||||
let write_info = vk::WriteDescriptorSet::builder()
|
||||
let write_info = vk::WriteDescriptorSet::default()
|
||||
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
||||
.dst_set(descriptor_set)
|
||||
.dst_binding(binding)
|
||||
|
@ -176,7 +175,7 @@ impl RawVulkanBuffer {
|
|||
|
||||
self.buffer
|
||||
.device
|
||||
.update_descriptor_sets(&[*write_info], &[])
|
||||
.update_descriptor_sets(&[write_info], &[])
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ pub struct VulkanRenderPass {
|
|||
impl VulkanRenderPass {
|
||||
pub fn create_render_pass(device: &ash::Device, format: vk::Format) -> error::Result<Self> {
|
||||
// format should never be undefined.
|
||||
let attachment = vk::AttachmentDescription::builder()
|
||||
let attachment = [vk::AttachmentDescription::default()
|
||||
.flags(vk::AttachmentDescriptionFlags::empty())
|
||||
.format(format)
|
||||
.samples(SampleCountFlags::TYPE_1)
|
||||
|
@ -21,20 +21,17 @@ impl VulkanRenderPass {
|
|||
.stencil_load_op(AttachmentLoadOp::DONT_CARE)
|
||||
.stencil_store_op(AttachmentStoreOp::DONT_CARE)
|
||||
.initial_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
||||
.final_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL);
|
||||
let attachment = [*attachment];
|
||||
.final_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)];
|
||||
|
||||
let attachment_ref = vk::AttachmentReference::builder()
|
||||
let attachment_ref = [vk::AttachmentReference::default()
|
||||
.attachment(0)
|
||||
.layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL);
|
||||
let attachment_ref = [*attachment_ref];
|
||||
.layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)];
|
||||
|
||||
let subpass = vk::SubpassDescription::builder()
|
||||
let subpass = [vk::SubpassDescription::default()
|
||||
.pipeline_bind_point(PipelineBindPoint::GRAPHICS)
|
||||
.color_attachments(&attachment_ref);
|
||||
let subpass = [*subpass];
|
||||
.color_attachments(&attachment_ref)];
|
||||
|
||||
let renderpass_info = vk::RenderPassCreateInfo::builder()
|
||||
let renderpass_info = vk::RenderPassCreateInfo::default()
|
||||
.flags(vk::RenderPassCreateFlags::empty())
|
||||
.attachments(&attachment)
|
||||
.subpasses(&subpass);
|
||||
|
|
|
@ -16,7 +16,7 @@ impl VulkanSampler {
|
|||
filter: FilterMode,
|
||||
mipmap: FilterMode,
|
||||
) -> error::Result<VulkanSampler> {
|
||||
let create_info = vk::SamplerCreateInfo::builder()
|
||||
let create_info = vk::SamplerCreateInfo::default()
|
||||
.mip_lod_bias(0.0)
|
||||
.max_anisotropy(1.0)
|
||||
.compare_enable(false)
|
||||
|
|
|
@ -16,9 +16,9 @@ pub struct OwnedImage {
|
|||
pub allocator: Arc<Mutex<Allocator>>,
|
||||
pub image_view: vk::ImageView,
|
||||
pub image: VulkanImage,
|
||||
pub memory: VulkanImageMemory,
|
||||
pub max_miplevels: u32,
|
||||
pub levels: u32,
|
||||
pub _memory: VulkanImageMemory,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -42,7 +42,7 @@ impl OwnedImage {
|
|||
if format == ImageFormat::Unknown {
|
||||
format = ImageFormat::R8G8B8A8Unorm
|
||||
}
|
||||
let image_create_info = vk::ImageCreateInfo::builder()
|
||||
let image_create_info = vk::ImageCreateInfo::default()
|
||||
.image_type(vk::ImageType::TYPE_2D)
|
||||
.format(format.into())
|
||||
.extent(size.into())
|
||||
|
@ -64,25 +64,25 @@ impl OwnedImage {
|
|||
let mem_reqs = unsafe { device.get_image_memory_requirements(image) };
|
||||
|
||||
let memory = VulkanImageMemory::new(&device, alloc, mem_reqs, &image)?;
|
||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
||||
let image_subresource = vk::ImageSubresourceRange::default()
|
||||
.base_mip_level(0)
|
||||
.base_array_layer(0)
|
||||
.level_count(image_create_info.mip_levels)
|
||||
.layer_count(1)
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
||||
|
||||
let swizzle_components = vk::ComponentMapping::builder()
|
||||
let swizzle_components = vk::ComponentMapping::default()
|
||||
.r(vk::ComponentSwizzle::R)
|
||||
.g(vk::ComponentSwizzle::G)
|
||||
.b(vk::ComponentSwizzle::B)
|
||||
.a(vk::ComponentSwizzle::A);
|
||||
|
||||
let view_info = vk::ImageViewCreateInfo::builder()
|
||||
let view_info = vk::ImageViewCreateInfo::default()
|
||||
.view_type(vk::ImageViewType::TYPE_2D)
|
||||
.format(format.into())
|
||||
.image(image)
|
||||
.subresource_range(*image_subresource)
|
||||
.components(*swizzle_components);
|
||||
.subresource_range(image_subresource)
|
||||
.components(swizzle_components);
|
||||
|
||||
let image_view = unsafe { device.create_image_view(&view_info, None)? };
|
||||
|
||||
|
@ -95,7 +95,7 @@ impl OwnedImage {
|
|||
size,
|
||||
format: format.into(),
|
||||
},
|
||||
memory,
|
||||
_memory: memory,
|
||||
max_miplevels,
|
||||
levels: std::cmp::min(max_miplevels, size.calculate_miplevels()),
|
||||
})
|
||||
|
@ -182,7 +182,7 @@ impl OwnedImage {
|
|||
}
|
||||
|
||||
pub fn generate_mipmaps_and_end_pass(&self, cmd: vk::CommandBuffer) {
|
||||
let input_barrier = vk::ImageMemoryBarrier::builder()
|
||||
let input_barrier = vk::ImageMemoryBarrier::default()
|
||||
.src_access_mask(vk::AccessFlags::COLOR_ATTACHMENT_WRITE)
|
||||
.dst_access_mask(vk::AccessFlags::TRANSFER_READ)
|
||||
.old_layout(vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
||||
|
@ -198,7 +198,7 @@ impl OwnedImage {
|
|||
layer_count: vk::REMAINING_ARRAY_LAYERS,
|
||||
});
|
||||
|
||||
let mipchain_barrier = vk::ImageMemoryBarrier::builder()
|
||||
let mipchain_barrier = vk::ImageMemoryBarrier::default()
|
||||
.src_access_mask(vk::AccessFlags::empty())
|
||||
.dst_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
||||
.old_layout(vk::ImageLayout::UNDEFINED)
|
||||
|
@ -222,13 +222,13 @@ impl OwnedImage {
|
|||
vk::DependencyFlags::empty(),
|
||||
&[],
|
||||
&[],
|
||||
&[*input_barrier, *mipchain_barrier],
|
||||
&[input_barrier, mipchain_barrier],
|
||||
);
|
||||
|
||||
for level in 1..self.levels {
|
||||
// need to transition from DST to SRC, one level at a time.
|
||||
if level > 1 {
|
||||
let next_barrier = vk::ImageMemoryBarrier::builder()
|
||||
let next_barrier = vk::ImageMemoryBarrier::default()
|
||||
.src_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
||||
.dst_access_mask(vk::AccessFlags::TRANSFER_READ)
|
||||
.old_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL)
|
||||
|
@ -251,7 +251,7 @@ impl OwnedImage {
|
|||
vk::DependencyFlags::empty(),
|
||||
&[],
|
||||
&[],
|
||||
&[*next_barrier],
|
||||
&[next_barrier],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -276,22 +276,22 @@ impl OwnedImage {
|
|||
},
|
||||
];
|
||||
|
||||
let src_subresource = vk::ImageSubresourceLayers::builder()
|
||||
let src_subresource = vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(level - 1)
|
||||
.base_array_layer(0)
|
||||
.layer_count(1);
|
||||
|
||||
let dst_subresource = vk::ImageSubresourceLayers::builder()
|
||||
let dst_subresource = vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(level)
|
||||
.base_array_layer(0)
|
||||
.layer_count(1);
|
||||
|
||||
let image_blit = vk::ImageBlit::builder()
|
||||
.src_subresource(*src_subresource)
|
||||
let image_blit = vk::ImageBlit::default()
|
||||
.src_subresource(src_subresource)
|
||||
.src_offsets(src_offsets)
|
||||
.dst_subresource(*dst_subresource)
|
||||
.dst_subresource(dst_subresource)
|
||||
.dst_offsets(dst_offsets);
|
||||
|
||||
self.device.cmd_blit_image(
|
||||
|
@ -300,14 +300,14 @@ impl OwnedImage {
|
|||
vk::ImageLayout::TRANSFER_SRC_OPTIMAL,
|
||||
self.image.image,
|
||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
||||
&[*image_blit],
|
||||
&[image_blit],
|
||||
vk::Filter::LINEAR,
|
||||
);
|
||||
}
|
||||
|
||||
// move everything to SHADER_READ_ONLY_OPTIMAL
|
||||
|
||||
let input_barrier = vk::ImageMemoryBarrier::builder()
|
||||
let input_barrier = vk::ImageMemoryBarrier::default()
|
||||
.src_access_mask(vk::AccessFlags::TRANSFER_READ)
|
||||
.dst_access_mask(vk::AccessFlags::SHADER_READ)
|
||||
.old_layout(vk::ImageLayout::TRANSFER_SRC_OPTIMAL)
|
||||
|
@ -323,7 +323,7 @@ impl OwnedImage {
|
|||
layer_count: vk::REMAINING_ARRAY_LAYERS,
|
||||
});
|
||||
|
||||
let mipchain_barrier = vk::ImageMemoryBarrier::builder()
|
||||
let mipchain_barrier = vk::ImageMemoryBarrier::default()
|
||||
.src_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
||||
.dst_access_mask(vk::AccessFlags::SHADER_READ)
|
||||
.old_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL)
|
||||
|
@ -348,7 +348,7 @@ impl OwnedImage {
|
|||
vk::DependencyFlags::empty(),
|
||||
&[],
|
||||
&[],
|
||||
&[*input_barrier, *mipchain_barrier],
|
||||
&[input_barrier, mipchain_barrier],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -360,16 +360,16 @@ impl OwnedImage {
|
|||
source: &VulkanImage,
|
||||
source_layout: vk::ImageLayout,
|
||||
) {
|
||||
let region = vk::ImageCopy::builder()
|
||||
let region = vk::ImageCopy::default()
|
||||
.src_subresource(
|
||||
*vk::ImageSubresourceLayers::builder()
|
||||
vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(0)
|
||||
.base_array_layer(0)
|
||||
.layer_count(1),
|
||||
)
|
||||
.dst_subresource(
|
||||
*vk::ImageSubresourceLayers::builder()
|
||||
vk::ImageSubresourceLayers::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.mip_level(0)
|
||||
.base_array_layer(0)
|
||||
|
@ -401,7 +401,7 @@ impl OwnedImage {
|
|||
source_layout,
|
||||
self.image.image,
|
||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
||||
&[*region],
|
||||
&[region],
|
||||
);
|
||||
util::vulkan_image_layout_transition_levels(
|
||||
&self.device,
|
||||
|
@ -443,7 +443,7 @@ impl OwnedImage {
|
|||
&vk::ClearColorValue {
|
||||
float32: [0.0, 0.0, 0.0, 0.0],
|
||||
},
|
||||
&[*vk::ImageSubresourceRange::builder()
|
||||
&[vk::ImageSubresourceRange::default()
|
||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
.base_mip_level(0)
|
||||
.level_count(1)
|
||||
|
|
|
@ -14,13 +14,13 @@ impl VulkanCommandPool {
|
|||
pub fn new(base: &VulkanBase, frames_in_flight: u32) -> VkResult<VulkanCommandPool> {
|
||||
let indices = find_queue_family(&base.instance, base.physical_device);
|
||||
|
||||
let create_info = vk::CommandPoolCreateInfo::builder()
|
||||
let create_info = vk::CommandPoolCreateInfo::default()
|
||||
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER)
|
||||
.queue_family_index(indices.graphics_family());
|
||||
|
||||
unsafe {
|
||||
let pool = base.device.create_command_pool(&create_info, None)?;
|
||||
let buffer_info = vk::CommandBufferAllocateInfo::builder()
|
||||
let buffer_info = vk::CommandBufferAllocateInfo::default()
|
||||
.command_pool(pool)
|
||||
.level(vk::CommandBufferLevel::PRIMARY)
|
||||
.command_buffer_count(frames_in_flight);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use ash::extensions::ext::DebugUtils;
|
||||
use ash::ext::debug_utils::Instance;
|
||||
use ash::prelude::VkResult;
|
||||
use ash::vk;
|
||||
use ash::vk::{DebugUtilsMessengerEXT, PFN_vkDebugUtilsMessengerCallbackEXT};
|
||||
|
||||
pub struct VulkanDebug {
|
||||
pub loader: DebugUtils,
|
||||
pub loader: Instance,
|
||||
messenger: DebugUtilsMessengerEXT,
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ impl VulkanDebug {
|
|||
instance: &ash::Instance,
|
||||
callback: PFN_vkDebugUtilsMessengerCallbackEXT,
|
||||
) -> VkResult<VulkanDebug> {
|
||||
let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::builder()
|
||||
let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::default()
|
||||
.message_severity(
|
||||
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
|
||||
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING
|
||||
|
@ -28,7 +28,7 @@ impl VulkanDebug {
|
|||
)
|
||||
.pfn_user_callback(callback);
|
||||
|
||||
let debug_utils_loader = DebugUtils::new(entry, instance);
|
||||
let debug_utils_loader = Instance::new(entry, instance);
|
||||
|
||||
dbg!("got to dbg");
|
||||
unsafe {
|
||||
|
|
|
@ -14,7 +14,7 @@ impl VulkanFramebuffer {
|
|||
height: u32,
|
||||
) -> VkResult<VulkanFramebuffer> {
|
||||
let attachments = &[*image_view];
|
||||
let framebuffer_info = vk::FramebufferCreateInfo::builder()
|
||||
let framebuffer_info = vk::FramebufferCreateInfo::default()
|
||||
.render_pass(*render_pass)
|
||||
.attachments(attachments)
|
||||
.width(width)
|
||||
|
|
|
@ -91,7 +91,7 @@ impl VulkanWindow {
|
|||
},
|
||||
}];
|
||||
|
||||
let render_pass_begin = vk::RenderPassBeginInfo::builder()
|
||||
let render_pass_begin = vk::RenderPassBeginInfo::default()
|
||||
.render_pass(vulkan.pipeline.renderpass)
|
||||
.framebuffer(framebuffer)
|
||||
.render_area(vk::Rect2D {
|
||||
|
@ -284,7 +284,7 @@ impl VulkanWindow {
|
|||
// vk::QUEUE_FAMILY_IGNORED,
|
||||
// );
|
||||
//
|
||||
// let blit_subresource = vk::ImageSubresourceLayers::builder()
|
||||
// let blit_subresource = vk::ImageSubresourceLayers::default()
|
||||
// .layer_count(1)
|
||||
// .aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||
// ;
|
||||
|
@ -344,7 +344,7 @@ impl VulkanWindow {
|
|||
|
||||
let stage_mask = [vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT];
|
||||
let cmd = [cmd];
|
||||
let submit_info = [*vk::SubmitInfo::builder()
|
||||
let submit_info = [vk::SubmitInfo::default()
|
||||
.wait_dst_stage_mask(&stage_mask)
|
||||
.wait_semaphores(&image_available)
|
||||
.signal_semaphores(&render_finished)
|
||||
|
@ -358,7 +358,7 @@ impl VulkanWindow {
|
|||
|
||||
let swapchain_index = [swapchain_index];
|
||||
let swapchain = [vulkan.swapchain.swapchain];
|
||||
let present_info = vk::PresentInfoKHR::builder()
|
||||
let present_info = vk::PresentInfoKHR::default()
|
||||
.wait_semaphores(&render_finished)
|
||||
.swapchains(&swapchain)
|
||||
.image_indices(&swapchain_index);
|
||||
|
|
|
@ -29,7 +29,7 @@ impl VulkanPipeline {
|
|||
pub unsafe fn new(base: &VulkanBase, swapchain: &VulkanSwapchain) -> VkResult<VulkanPipeline> {
|
||||
// upload buffers
|
||||
let index_buffer_data = [0u32, 1, 2];
|
||||
let index_buffer_info = vk::BufferCreateInfo::builder()
|
||||
let index_buffer_info = vk::BufferCreateInfo::default()
|
||||
.size(std::mem::size_of_val(&index_buffer_data) as u64)
|
||||
.usage(vk::BufferUsageFlags::INDEX_BUFFER)
|
||||
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
||||
|
@ -150,7 +150,7 @@ impl VulkanPipeline {
|
|||
let vertex_code =
|
||||
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
|
||||
let vertex_shader_info = ShaderModule::new(&base.device, vertex_code)?;
|
||||
let vertex_stage_info = vk::PipelineShaderStageCreateInfo::builder()
|
||||
let vertex_stage_info = vk::PipelineShaderStageCreateInfo::default()
|
||||
.module(vertex_shader_info.module)
|
||||
.stage(vk::ShaderStageFlags::VERTEX)
|
||||
.name(ENTRY_POINT);
|
||||
|
@ -160,16 +160,16 @@ impl VulkanPipeline {
|
|||
let frag_code =
|
||||
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
|
||||
let frag_shader_info = ShaderModule::new(&base.device, frag_code)?;
|
||||
let frag_stage_info = vk::PipelineShaderStageCreateInfo::builder()
|
||||
let frag_stage_info = vk::PipelineShaderStageCreateInfo::default()
|
||||
.module(frag_shader_info.module)
|
||||
.stage(vk::ShaderStageFlags::FRAGMENT)
|
||||
.name(ENTRY_POINT);
|
||||
|
||||
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::builder()
|
||||
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::default()
|
||||
.vertex_attribute_descriptions(&[])
|
||||
.vertex_binding_descriptions(&[]);
|
||||
|
||||
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo::builder()
|
||||
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo::default()
|
||||
.primitive_restart_enable(false)
|
||||
.topology(vk::PrimitiveTopology::TRIANGLE_LIST);
|
||||
|
||||
|
@ -194,13 +194,13 @@ impl VulkanPipeline {
|
|||
.unwrap();
|
||||
|
||||
let states = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
||||
let dynamic_state = vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&states);
|
||||
let dynamic_state = vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&states);
|
||||
|
||||
let viewport_state_info = vk::PipelineViewportStateCreateInfo::builder()
|
||||
let viewport_state_info = vk::PipelineViewportStateCreateInfo::default()
|
||||
.scissors(&scissors)
|
||||
.viewports(&viewports);
|
||||
|
||||
let rs_state_info = vk::PipelineRasterizationStateCreateInfo::builder()
|
||||
let rs_state_info = vk::PipelineRasterizationStateCreateInfo::default()
|
||||
.depth_clamp_enable(false)
|
||||
.depth_bias_enable(false)
|
||||
.rasterizer_discard_enable(false)
|
||||
|
@ -209,12 +209,12 @@ impl VulkanPipeline {
|
|||
.cull_mode(vk::CullModeFlags::BACK)
|
||||
.front_face(vk::FrontFace::CLOCKWISE);
|
||||
|
||||
let multisample = vk::PipelineMultisampleStateCreateInfo::builder()
|
||||
let multisample = vk::PipelineMultisampleStateCreateInfo::default()
|
||||
.rasterization_samples(vk::SampleCountFlags::TYPE_1)
|
||||
.min_sample_shading(1.0f32)
|
||||
.sample_shading_enable(false);
|
||||
|
||||
let color_blend_attachment = [*vk::PipelineColorBlendAttachmentState::builder()
|
||||
let color_blend_attachment = [vk::PipelineColorBlendAttachmentState::default()
|
||||
.blend_enable(false)
|
||||
.color_write_mask(vk::ColorComponentFlags::RGBA)
|
||||
.src_color_blend_factor(vk::BlendFactor::ONE)
|
||||
|
@ -224,7 +224,7 @@ impl VulkanPipeline {
|
|||
.dst_alpha_blend_factor(vk::BlendFactor::ZERO)
|
||||
.alpha_blend_op(vk::BlendOp::ADD)];
|
||||
|
||||
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
|
||||
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::default()
|
||||
.logic_op(vk::LogicOp::COPY)
|
||||
.attachments(&color_blend_attachment);
|
||||
|
||||
|
@ -252,11 +252,11 @@ impl VulkanPipeline {
|
|||
// ..Default::default()
|
||||
// }];
|
||||
|
||||
let subpass = vk::SubpassDescription::builder()
|
||||
let subpass = vk::SubpassDescription::default()
|
||||
.color_attachments(&color_attachment_refs)
|
||||
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS);
|
||||
|
||||
let renderpass_create_info = vk::RenderPassCreateInfo::builder()
|
||||
let renderpass_create_info = vk::RenderPassCreateInfo::default()
|
||||
.attachments(&renderpass_attachments)
|
||||
.subpasses(std::slice::from_ref(&subpass))
|
||||
.dependencies(&[]);
|
||||
|
@ -266,8 +266,8 @@ impl VulkanPipeline {
|
|||
.create_render_pass(&renderpass_create_info, None)
|
||||
.unwrap();
|
||||
|
||||
let infos = [*vertex_stage_info, *frag_stage_info];
|
||||
let graphic_pipeline_info = vk::GraphicsPipelineCreateInfo::builder()
|
||||
let infos = [vertex_stage_info, frag_stage_info];
|
||||
let graphic_pipeline_info = vk::GraphicsPipelineCreateInfo::default()
|
||||
.stages(&infos)
|
||||
.vertex_input_state(&vertex_input_state_info)
|
||||
.input_assembly_state(&vertex_input_assembly_state_info)
|
||||
|
@ -278,7 +278,7 @@ impl VulkanPipeline {
|
|||
.dynamic_state(&dynamic_state)
|
||||
.layout(pipeline_layout)
|
||||
.render_pass(renderpass);
|
||||
let graphic_pipeline_info = [*graphic_pipeline_info];
|
||||
let graphic_pipeline_info = [graphic_pipeline_info];
|
||||
|
||||
let graphics_pipelines = base
|
||||
.device
|
||||
|
@ -302,7 +302,7 @@ pub struct ShaderModule {
|
|||
|
||||
impl ShaderModule {
|
||||
pub fn new(device: &ash::Device, spirv: Vec<u32>) -> VkResult<ShaderModule> {
|
||||
let create_info = vk::ShaderModuleCreateInfo::builder().code(&spirv);
|
||||
let create_info = vk::ShaderModuleCreateInfo::default().code(&spirv);
|
||||
|
||||
let module = unsafe { device.create_shader_module(&create_info, None)? };
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use ash::vk;
|
|||
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
||||
|
||||
pub struct VulkanSurface {
|
||||
surface_loader: ash::extensions::khr::Surface,
|
||||
surface_loader: ash::khr::surface::Instance,
|
||||
pub surface: vk::SurfaceKHR,
|
||||
pub present_queue: vk::Queue,
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ impl VulkanSurface {
|
|||
ash_window::create_surface(
|
||||
&base.entry,
|
||||
&base.instance,
|
||||
window.raw_display_handle(),
|
||||
window.raw_window_handle(),
|
||||
window.raw_display_handle().unwrap(),
|
||||
window.raw_window_handle().unwrap(),
|
||||
None,
|
||||
)?
|
||||
};
|
||||
|
||||
let surface_loader = ash::extensions::khr::Surface::new(&base.entry, &base.instance);
|
||||
let surface_loader = ash::khr::surface::Instance::new(&base.entry, &base.instance);
|
||||
|
||||
let present_queue = unsafe {
|
||||
let queue_family = base
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::sync::Arc;
|
|||
|
||||
pub struct VulkanSwapchain {
|
||||
pub swapchain: vk::SwapchainKHR,
|
||||
pub loader: ash::extensions::khr::Swapchain,
|
||||
pub loader: ash::khr::swapchain::Device,
|
||||
pub format: vk::SurfaceFormatKHR,
|
||||
pub extent: vk::Extent2D,
|
||||
pub mode: vk::PresentModeKHR,
|
||||
|
@ -44,7 +44,7 @@ impl VulkanSwapchain {
|
|||
panic!("exclusive mode only")
|
||||
}
|
||||
|
||||
let create_info = vk::SwapchainCreateInfoKHR::builder()
|
||||
let create_info = vk::SwapchainCreateInfoKHR::default()
|
||||
.surface(surface.surface)
|
||||
.present_mode(mode)
|
||||
.min_image_count(image_count)
|
||||
|
@ -59,7 +59,7 @@ impl VulkanSwapchain {
|
|||
// todo: switch to IMAGE_USAGE_TRANSFER_DST
|
||||
.image_usage(vk::ImageUsageFlags::COLOR_ATTACHMENT);
|
||||
|
||||
let loader = ash::extensions::khr::Swapchain::new(&base.instance, &base.device);
|
||||
let loader = ash::khr::swapchain::Device::new(&base.instance, &base.device);
|
||||
|
||||
let swapchain = unsafe { loader.create_swapchain(&create_info, None)? };
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl VulkanSwapchain {
|
|||
|
||||
// create render imaghes
|
||||
for _ in 0..swapchain_images.len() {
|
||||
let create_info = vk::ImageCreateInfo::builder()
|
||||
let create_info = vk::ImageCreateInfo::default()
|
||||
.extent(Extent3D {
|
||||
width,
|
||||
height,
|
||||
|
@ -104,7 +104,7 @@ impl VulkanSwapchain {
|
|||
let swapchain_image_views: VkResult<Vec<vk::ImageView>> = swapchain_images
|
||||
.iter()
|
||||
.map(|image| {
|
||||
let create_info = vk::ImageViewCreateInfo::builder()
|
||||
let create_info = vk::ImageViewCreateInfo::default()
|
||||
.view_type(vk::ImageViewType::TYPE_2D)
|
||||
.format(format.format)
|
||||
.components(vk::ComponentMapping {
|
||||
|
@ -128,7 +128,7 @@ impl VulkanSwapchain {
|
|||
// .loader
|
||||
// .set_debug_utils_object_name(
|
||||
// base.device.handle(),
|
||||
// &vk::DebugUtilsObjectNameInfoEXT::builder()
|
||||
// &vk::DebugUtilsObjectNameInfoEXT::default()
|
||||
// .object_handle(image.as_raw())
|
||||
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
||||
// b"SwapchainImage\0",
|
||||
|
@ -141,7 +141,7 @@ impl VulkanSwapchain {
|
|||
// .loader
|
||||
// .set_debug_utils_object_name(
|
||||
// base.device.handle(),
|
||||
// &vk::DebugUtilsObjectNameInfoEXT::builder()
|
||||
// &vk::DebugUtilsObjectNameInfoEXT::default()
|
||||
// .object_handle(view.as_raw())
|
||||
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
||||
// b"SwapchainImageView\0",
|
||||
|
@ -158,7 +158,7 @@ impl VulkanSwapchain {
|
|||
let render_image_views: VkResult<Vec<vk::ImageView>> = render_images
|
||||
.iter()
|
||||
.map(|(image, _)| {
|
||||
let create_info = vk::ImageViewCreateInfo::builder()
|
||||
let create_info = vk::ImageViewCreateInfo::default()
|
||||
.view_type(vk::ImageViewType::TYPE_2D)
|
||||
.format(format.format)
|
||||
.components(vk::ComponentMapping {
|
||||
|
@ -182,7 +182,7 @@ impl VulkanSwapchain {
|
|||
// .loader
|
||||
// .set_debug_utils_object_name(
|
||||
// base.device.handle(),
|
||||
// &vk::DebugUtilsObjectNameInfoEXT::builder()
|
||||
// &vk::DebugUtilsObjectNameInfoEXT::default()
|
||||
// .object_handle(view.as_raw())
|
||||
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
||||
// b"RenderImageView\0",
|
||||
|
|
|
@ -20,7 +20,7 @@ impl SyncObjects {
|
|||
render_finished
|
||||
.push(device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?);
|
||||
in_flight.push(device.create_fence(
|
||||
&vk::FenceCreateInfo::builder().flags(vk::FenceCreateFlags::SIGNALED),
|
||||
&vk::FenceCreateInfo::default().flags(vk::FenceCreateFlags::SIGNALED),
|
||||
None,
|
||||
)?)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ pub struct VulkanBase {
|
|||
|
||||
impl VulkanBase {
|
||||
pub fn new(entry: ash::Entry) -> VkResult<VulkanBase> {
|
||||
let app_info = vk::ApplicationInfo::builder()
|
||||
let app_info = vk::ApplicationInfo::default()
|
||||
.application_name(unsafe { CStr::from_bytes_with_nul_unchecked(WINDOW_TITLE) })
|
||||
.engine_name(unsafe { CStr::from_bytes_with_nul_unchecked(WINDOW_TITLE) })
|
||||
.engine_version(0)
|
||||
|
@ -37,14 +37,14 @@ impl VulkanBase {
|
|||
dbg!("entry");
|
||||
// todo: make this xplat
|
||||
let extensions = [
|
||||
ash::extensions::khr::Surface::name().as_ptr(),
|
||||
ash::extensions::khr::Win32Surface::name().as_ptr(),
|
||||
ash::extensions::ext::DebugUtils::name().as_ptr(),
|
||||
ash::khr::surface::NAME.as_ptr(),
|
||||
ash::khr::win32_surface::NAME.as_ptr(),
|
||||
ash::ext::debug_utils::NAME.as_ptr(),
|
||||
];
|
||||
|
||||
let layers = [KHRONOS_VALIDATION.as_ptr().cast()];
|
||||
|
||||
let create_info = vk::InstanceCreateInfo::builder()
|
||||
let create_info = vk::InstanceCreateInfo::default()
|
||||
.application_info(&app_info)
|
||||
.enabled_layer_names(&layers)
|
||||
.enabled_extension_names(&extensions);
|
||||
|
@ -84,25 +84,25 @@ impl VulkanBase {
|
|||
let _debug = [unsafe { CStr::from_bytes_with_nul_unchecked(KHRONOS_VALIDATION).as_ptr() }];
|
||||
|
||||
let indices = find_queue_family(instance, *physical_device);
|
||||
let queue_info = [*vk::DeviceQueueCreateInfo::builder()
|
||||
let queue_info = [vk::DeviceQueueCreateInfo::default()
|
||||
.queue_family_index(indices.graphics_family())
|
||||
.queue_priorities(&[1.0f32])];
|
||||
|
||||
// let physical_device_features = vk::PhysicalDeviceFeatures::default();
|
||||
|
||||
let mut physical_device_features =
|
||||
vk::PhysicalDeviceVulkan13Features::builder().dynamic_rendering(true);
|
||||
vk::PhysicalDeviceVulkan13Features::default().dynamic_rendering(true);
|
||||
|
||||
// let mut physical_device_features =
|
||||
// vk::PhysicalDeviceFeatures2::builder().push_next(&mut physical_device_features)
|
||||
// vk::PhysicalDeviceFeatures2::default().push_next(&mut physical_device_features)
|
||||
// ;
|
||||
|
||||
let extensions = [
|
||||
ash::extensions::khr::Swapchain::name().as_ptr(),
|
||||
ash::extensions::khr::DynamicRendering::name().as_ptr(),
|
||||
ash::khr::swapchain::NAME.as_ptr(),
|
||||
ash::khr::dynamic_rendering::NAME.as_ptr(),
|
||||
];
|
||||
|
||||
let device_create_info = vk::DeviceCreateInfo::builder()
|
||||
let device_create_info = vk::DeviceCreateInfo::default()
|
||||
.queue_create_infos(&queue_info)
|
||||
// .enabled_layer_names(&debug)
|
||||
.enabled_extension_names(&extensions)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "librashader-runtime-wgpu"
|
||||
edition = "2021"
|
||||
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
|
@ -14,17 +14,14 @@ description = "RetroArch shaders for all."
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", features = [
|
||||
"wgpu",
|
||||
], version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7", features = [
|
||||
"wgsl",
|
||||
], default-features = false }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", features = ["wgpu"], version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8", features = ["wgsl"], default-features = false }
|
||||
librashader-runtime = { path = "../librashader-runtime" , version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8" }
|
||||
|
||||
wgpu = { version = "22.0.0", default-features = false, features = ["wgsl"] }
|
||||
wgpu = { version = "22.0", default-features = false, features = ["wgsl"] }
|
||||
image = "0.25.1"
|
||||
thiserror = "1.0.50"
|
||||
bytemuck = { version = "1.14.0", features = ["derive"] }
|
||||
|
|
|
@ -25,7 +25,7 @@ use librashader_reflect::reflect::naga::{Naga, NagaLoweringOptions};
|
|||
use librashader_runtime::framebuffer::FramebufferInit;
|
||||
use librashader_runtime::render_target::RenderTarget;
|
||||
use librashader_runtime::scaling::ScaleFramebuffer;
|
||||
use wgpu::{Device, TextureFormat};
|
||||
use wgpu::{AdapterInfo, Device, TextureFormat};
|
||||
|
||||
use crate::error;
|
||||
use crate::error::FilterChainError;
|
||||
|
@ -144,8 +144,17 @@ impl FilterChainWgpu {
|
|||
) -> error::Result<FilterChainWgpu> {
|
||||
let (passes, semantics) = compile_passes(preset.shaders, &preset.textures)?;
|
||||
|
||||
// // initialize passes
|
||||
let filters = Self::init_passes(Arc::clone(&device), passes, &semantics)?;
|
||||
// cache is opt-in for wgpu, not opt-out because of feature requirements.
|
||||
let disable_cache = options.map_or(true, |o| !o.enable_cache);
|
||||
|
||||
// initialize passes
|
||||
let filters = Self::init_passes(
|
||||
Arc::clone(&device),
|
||||
passes,
|
||||
&semantics,
|
||||
options.and_then(|o| o.adapter_info.as_ref()),
|
||||
disable_cache,
|
||||
)?;
|
||||
|
||||
let samplers = SamplerSet::new(&device);
|
||||
let mut mipmapper = MipmapGen::new(Arc::clone(&device));
|
||||
|
@ -268,6 +277,8 @@ impl FilterChainWgpu {
|
|||
device: Arc<Device>,
|
||||
passes: Vec<ShaderPassMeta>,
|
||||
semantics: &ShaderSemantics,
|
||||
adapter_info: Option<&wgpu::AdapterInfo>,
|
||||
disable_cache: bool,
|
||||
) -> error::Result<Box<[FilterPass]>> {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let filter_creation_fn = || {
|
||||
|
@ -320,6 +331,8 @@ impl FilterChainWgpu {
|
|||
&wgsl,
|
||||
&reflection,
|
||||
render_pass_format.unwrap_or(TextureFormat::Rgba8Unorm),
|
||||
adapter_info,
|
||||
disable_cache,
|
||||
);
|
||||
|
||||
Ok(FilterPass {
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
use crate::error::FilterChainError;
|
||||
use crate::framebuffer::WgpuOutputView;
|
||||
use crate::util;
|
||||
use librashader_cache::cache_pipeline;
|
||||
use librashader_reflect::back::wgsl::NagaWgslContext;
|
||||
use librashader_reflect::back::ShaderCompilerOutput;
|
||||
use librashader_reflect::reflect::ShaderReflection;
|
||||
use librashader_runtime::quad::VertexInput;
|
||||
use librashader_runtime::render_target::RenderTarget;
|
||||
use std::borrow::Cow;
|
||||
use std::convert::Infallible;
|
||||
use std::sync::Arc;
|
||||
use wgpu::{
|
||||
BindGroupLayout, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingType,
|
||||
|
@ -18,6 +21,7 @@ use wgpu::{
|
|||
pub struct WgpuGraphicsPipeline {
|
||||
pub layout: PipelineLayoutObjects,
|
||||
render_pipeline: wgpu::RenderPipeline,
|
||||
cache: Option<wgpu::PipelineCache>,
|
||||
pub format: wgpu::TextureFormat,
|
||||
}
|
||||
|
||||
|
@ -144,7 +148,11 @@ impl PipelineLayoutObjects {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_pipeline(&self, framebuffer_format: TextureFormat) -> wgpu::RenderPipeline {
|
||||
pub fn create_pipeline(
|
||||
&self,
|
||||
framebuffer_format: TextureFormat,
|
||||
cache: Option<&wgpu::PipelineCache>,
|
||||
) -> wgpu::RenderPipeline {
|
||||
self.device
|
||||
.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Render Pipeline"),
|
||||
|
@ -198,7 +206,7 @@ impl PipelineLayoutObjects {
|
|||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
multiview: None,
|
||||
cache: None,
|
||||
cache,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -209,18 +217,50 @@ impl WgpuGraphicsPipeline {
|
|||
shader_assembly: &ShaderCompilerOutput<String, NagaWgslContext>,
|
||||
reflection: &ShaderReflection,
|
||||
render_pass_format: TextureFormat,
|
||||
adapter_info: Option<&wgpu::AdapterInfo>,
|
||||
bypass_cache: bool,
|
||||
) -> Self {
|
||||
let cache = if bypass_cache {
|
||||
None
|
||||
} else {
|
||||
let name = adapter_info
|
||||
.and_then(|o| wgpu::util::pipeline_cache_key(o))
|
||||
.unwrap_or_else(|| String::from("wgpu"));
|
||||
|
||||
cache_pipeline(
|
||||
&name,
|
||||
&[
|
||||
&shader_assembly.vertex.as_str(),
|
||||
&shader_assembly.fragment.as_str(),
|
||||
],
|
||||
|pipeline_data| {
|
||||
let descriptor = wgpu::PipelineCacheDescriptor {
|
||||
label: Some("librashader-wgpu"),
|
||||
data: pipeline_data.as_deref(),
|
||||
fallback: true,
|
||||
};
|
||||
|
||||
let cache = unsafe { device.create_pipeline_cache(&descriptor) };
|
||||
Ok::<_, Infallible>(cache)
|
||||
},
|
||||
|cache| Ok(cache.get_data()),
|
||||
bypass_cache,
|
||||
)
|
||||
.ok()
|
||||
};
|
||||
|
||||
let layout = PipelineLayoutObjects::new(reflection, shader_assembly, device);
|
||||
let render_pipeline = layout.create_pipeline(render_pass_format);
|
||||
let render_pipeline = layout.create_pipeline(render_pass_format, cache.as_ref());
|
||||
Self {
|
||||
layout,
|
||||
render_pipeline,
|
||||
format: render_pass_format,
|
||||
cache,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn recompile(&mut self, format: TextureFormat) {
|
||||
let render_pipeline = self.layout.create_pipeline(format);
|
||||
let render_pipeline = self.layout.create_pipeline(format, self.cache.as_ref());
|
||||
self.render_pipeline = render_pipeline;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,4 +9,11 @@ impl_default_frame_options!(FrameOptionsWgpu);
|
|||
pub struct FilterChainOptionsWgpu {
|
||||
/// Whether or not to explicitly disable mipmap generation regardless of shader preset settings.
|
||||
pub force_no_mipmaps: bool,
|
||||
/// Enable the shader object cache. Shaders will be loaded from the cache
|
||||
/// if this is enabled.
|
||||
pub enable_cache: bool,
|
||||
/// WGPU adapter info for use to determine the name of the pipeline cache index.
|
||||
/// If this is not provided, then it will fallback to a default "wgpu" index, which
|
||||
/// may clobber the cache for a different device using WGPU.
|
||||
pub adapter_info: Option<wgpu::AdapterInfo>,
|
||||
}
|
||||
|
|
|
@ -93,9 +93,13 @@ impl<'a> State<'a> {
|
|||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
required_features: wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER,
|
||||
required_features: wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER
|
||||
| wgpu::Features::PIPELINE_CACHE
|
||||
| wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
|
||||
| wgpu::Features::FLOAT32_FILTERABLE,
|
||||
required_limits: wgpu::Limits::default(),
|
||||
label: None,
|
||||
memory_hints: Default::default(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
|
@ -118,17 +122,14 @@ impl<'a> State<'a> {
|
|||
let device = Arc::new(device);
|
||||
let queue = Arc::new(queue);
|
||||
//
|
||||
// let preset = ShaderPreset::try_parse(
|
||||
// "../test/basic.slangp",
|
||||
// )
|
||||
// .unwrap();
|
||||
// let preset = ShaderPreset::try_parse("../test/basic.slangp").unwrap();
|
||||
//
|
||||
let preset = ShaderPreset::try_parse("../test/shaders_slang/test/history.slangp").unwrap();
|
||||
// let preset = ShaderPreset::try_parse("../test/shaders_slang/test/history.slangp").unwrap();
|
||||
|
||||
// let preset = ShaderPreset::try_parse(
|
||||
// "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||
// )
|
||||
// .unwrap();
|
||||
let preset = ShaderPreset::try_parse(
|
||||
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let chain = FilterChainWgpu::load_from_preset(
|
||||
preset,
|
||||
|
@ -154,11 +155,13 @@ impl<'a> State<'a> {
|
|||
vertex: wgpu::VertexState {
|
||||
module: &shader,
|
||||
entry_point: "vs_main",
|
||||
compilation_options: Default::default(),
|
||||
buffers: &[Vertex::desc()],
|
||||
},
|
||||
fragment: Some(wgpu::FragmentState {
|
||||
module: &shader,
|
||||
entry_point: "fs_main",
|
||||
compilation_options: Default::default(),
|
||||
targets: &[Some(wgpu::ColorTargetState {
|
||||
format: config.format,
|
||||
blend: Some(wgpu::BlendState::REPLACE),
|
||||
|
@ -181,6 +184,7 @@ impl<'a> State<'a> {
|
|||
alpha_to_coverage_enabled: false,
|
||||
},
|
||||
multiview: None,
|
||||
cache: None,
|
||||
});
|
||||
|
||||
let vertex_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "librashader-runtime"
|
|||
edition = "2021"
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -12,10 +12,10 @@ keywords = ["shader", "retroarch", "SPIR-V"]
|
|||
description = "RetroArch shaders for all."
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
bytemuck = { version = "1.12.3", features = ["derive"] }
|
||||
num-traits = "0.2.15"
|
||||
array-concat = "0.5.2"
|
||||
|
|
|
@ -4,7 +4,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
license = "MPL-2.0 OR GPL-3.0-only"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
authors = ["Ronny Chan <ronny@ronnychan.ca>"]
|
||||
repository = "https://github.com/SnowflakePowered/librashader"
|
||||
readme = "../README.md"
|
||||
|
@ -13,37 +13,34 @@ keywords = ["shader", "retroarch", "SPIR-V"]
|
|||
description = "RetroArch shaders for all."
|
||||
|
||||
[dependencies]
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.7" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.7" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.7" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.7" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.7" }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.7" }
|
||||
librashader-runtime-d3d11 = { path = "../librashader-runtime-d3d11", version = "0.2.7", optional = true }
|
||||
librashader-runtime-d3d12 = { path = "../librashader-runtime-d3d12", version = "0.2.7", optional = true }
|
||||
librashader-runtime-d3d9 = { path = "../librashader-runtime-d3d9", version = "0.2.7", optional = true }
|
||||
librashader-runtime-gl = { path = "../librashader-runtime-gl", version = "0.2.7", optional = true }
|
||||
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.7", optional = true }
|
||||
librashader-runtime-mtl = { path = "../librashader-runtime-mtl", version = "0.2.7", optional = true }
|
||||
librashader-common = { path = "../librashader-common", version = "0.2.8" }
|
||||
librashader-presets = { path = "../librashader-presets", version = "0.2.8" }
|
||||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.8" }
|
||||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.8" }
|
||||
librashader-cache = { path = "../librashader-cache", version = "0.2.8" }
|
||||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.8" }
|
||||
librashader-runtime-d3d11 = { path = "../librashader-runtime-d3d11", version = "0.2.8", optional = true }
|
||||
librashader-runtime-d3d12 = { path = "../librashader-runtime-d3d12", version = "0.2.8", optional = true }
|
||||
librashader-runtime-d3d9 = { path = "../librashader-runtime-d3d9", version = "0.2.8", optional = true }
|
||||
librashader-runtime-gl = { path = "../librashader-runtime-gl", version = "0.2.8", optional = true }
|
||||
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.8", optional = true }
|
||||
librashader-runtime-mtl = { path = "../librashader-runtime-mtl", version = "0.2.8", optional = true }
|
||||
|
||||
ash = { version = "0.38.0", optional = true }
|
||||
ash = { version = "0.38", optional = true }
|
||||
halfbrown = "0.2.4"
|
||||
|
||||
[target.'cfg(not(all(target_vendor="apple", docsrs)))'.dependencies]
|
||||
wgpu = { version = "22.0.0", default-features = false, optional = true }
|
||||
librashader-runtime-wgpu = { path = "../librashader-runtime-wgpu", version = "0.2.7", optional = true }
|
||||
wgpu-types = { version = "22.0.0", optional = true }
|
||||
wgpu = { version = "22", default-features = false, optional = true }
|
||||
librashader-runtime-wgpu = { path = "../librashader-runtime-wgpu", version = "0.2.8", optional = true }
|
||||
wgpu-types = { version = "22", optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies.windows]
|
||||
workspace = true
|
||||
optional = true
|
||||
|
||||
[target.'cfg(target_vendor="apple")'.dependencies]
|
||||
icrate = { version = "0.1.0", features = [
|
||||
"Metal",
|
||||
"Metal_all",
|
||||
], optional = true }
|
||||
objc2 = { version = "0.5.0", features = ["apple"], optional = true }
|
||||
objc2-metal = { version = "0.2.0" , features = [ "all" ], optional = true}
|
||||
objc2 = { version = "0.5.0", features = ["apple"] , optional = true }
|
||||
|
||||
[features]
|
||||
# core features and definitions
|
||||
|
@ -54,87 +51,31 @@ presets = []
|
|||
|
||||
# runtimes
|
||||
|
||||
runtime-gl = [
|
||||
"runtime",
|
||||
"reflect-cross",
|
||||
"librashader-common/opengl",
|
||||
"librashader-runtime-gl",
|
||||
]
|
||||
runtime-d3d11 = [
|
||||
"runtime",
|
||||
"reflect-cross",
|
||||
"librashader-common/d3d11",
|
||||
"librashader-runtime-d3d11",
|
||||
"windows/Win32_Graphics_Direct3D11",
|
||||
]
|
||||
runtime-d3d12 = [
|
||||
"runtime",
|
||||
"reflect-cross",
|
||||
"reflect-dxil",
|
||||
"librashader-common/d3d12",
|
||||
"librashader-runtime-d3d12",
|
||||
"windows/Win32_Graphics_Direct3D12",
|
||||
]
|
||||
runtime-d3d9 = [
|
||||
"runtime",
|
||||
"reflect-cross",
|
||||
"librashader-common/d3d9",
|
||||
"librashader-runtime-d3d9",
|
||||
"windows/Win32_Graphics_Direct3D9",
|
||||
]
|
||||
runtime-gl = [ "runtime", "reflect-cross", "librashader-common/opengl", "librashader-runtime-gl" ]
|
||||
runtime-d3d11 = [ "runtime", "reflect-cross","librashader-common/d3d11", "librashader-runtime-d3d11", "windows/Win32_Graphics_Direct3D11" ]
|
||||
runtime-d3d12 = [ "runtime", "reflect-cross", "reflect-dxil", "librashader-common/d3d12", "librashader-runtime-d3d12", "windows/Win32_Graphics_Direct3D12" ]
|
||||
runtime-d3d9 = [ "runtime", "reflect-cross", "librashader-common/d3d9", "librashader-runtime-d3d9", "windows/Win32_Graphics_Direct3D9" ]
|
||||
|
||||
runtime-vk = [
|
||||
"runtime",
|
||||
"reflect-cross",
|
||||
"librashader-common/vulkan",
|
||||
"librashader-runtime-vk",
|
||||
"ash",
|
||||
]
|
||||
runtime-wgpu = [
|
||||
"runtime",
|
||||
"reflect-naga",
|
||||
"librashader-common/wgpu",
|
||||
"librashader-runtime-wgpu",
|
||||
"wgpu",
|
||||
"wgpu-types",
|
||||
]
|
||||
runtime-metal = [
|
||||
"runtime",
|
||||
"reflect-naga",
|
||||
"reflect-cross",
|
||||
"librashader-common/metal",
|
||||
"librashader-runtime-mtl",
|
||||
"icrate",
|
||||
"objc2",
|
||||
]
|
||||
runtime-vk = ["runtime", "reflect-cross", "librashader-common/vulkan", "librashader-runtime-vk", "ash" ]
|
||||
runtime-wgpu = [ "runtime", "reflect-naga", "librashader-common/wgpu", "librashader-runtime-wgpu", "wgpu", "wgpu-types" ]
|
||||
runtime-metal = [ "runtime", "reflect-naga", "reflect-cross", "librashader-common/metal", "librashader-runtime-mtl", "objc2-metal", "objc2" ]
|
||||
|
||||
# reflection
|
||||
reflect-cross = ["reflect", "librashader-reflect/cross"]
|
||||
reflect-dxil = ["reflect", "librashader-reflect/dxil"]
|
||||
reflect-naga = [
|
||||
"reflect",
|
||||
"librashader-reflect/naga",
|
||||
"librashader-reflect/unstable-naga",
|
||||
]
|
||||
reflect-naga = ["reflect", "librashader-reflect/naga"]
|
||||
|
||||
runtime-all = [
|
||||
"runtime-gl",
|
||||
"runtime-d3d11",
|
||||
"runtime-d3d12",
|
||||
"runtime-vk",
|
||||
"runtime-wgpu",
|
||||
"runtime-metal",
|
||||
]
|
||||
runtime-all = ["runtime-gl", "runtime-d3d11", "runtime-d3d12", "runtime-vk", "runtime-wgpu", "runtime-metal"]
|
||||
reflect-all = ["reflect-cross", "reflect-dxil", "reflect-naga"]
|
||||
|
||||
# enable all features by default
|
||||
default = ["full"]
|
||||
default = [ "full" ]
|
||||
internal = []
|
||||
|
||||
full = ["runtime-all", "reflect-all", "preprocess", "presets"]
|
||||
|
||||
# cache hack
|
||||
docsrs = ["librashader-cache/docsrs", "objc2/unstable-docsrs"]
|
||||
docsrs = ["librashader-cache/docsrs"]
|
||||
|
||||
# emits warning messages in tests
|
||||
github-ci = []
|
||||
|
@ -145,14 +86,12 @@ rayon = "1.6.1"
|
|||
once_cell = "1.19.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = [
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-apple-ios",
|
||||
"i686-pc-windows-msvc",
|
||||
"i686-unknown-linux-gnu",
|
||||
]
|
||||
targets = [ "x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-apple-ios",
|
||||
"i686-pc-windows-msvc",
|
||||
"i686-unknown-linux-gnu", ]
|
||||
features = ["docsrs"]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
|
|
Loading…
Reference in a new issue