finish migration to renderer modules + stub for wgpu
This commit is contained in:
parent
80850d3405
commit
63301c692e
18 changed files with 607 additions and 333 deletions
618
Cargo.lock
generated
618
Cargo.lock
generated
|
@ -191,12 +191,6 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9180feb72ccbc07cfe5ef7fa8bbf86ca71490d5dc9ef8ea02c7298ba94e7f7d"
|
||||
|
||||
[[package]]
|
||||
name = "array-init"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.7"
|
||||
|
@ -403,6 +397,12 @@ version = "0.6.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||
|
||||
[[package]]
|
||||
name = "bit_field"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
|
@ -428,18 +428,6 @@ dependencies = [
|
|||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blake3"
|
||||
version = "1.5.0"
|
||||
|
@ -497,12 +485,6 @@ dependencies = [
|
|||
"objc2 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "build-target"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "832133bbabbbaa9fbdba793456a2827627a7d2b8fb96032fa1e7666d7895832b"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.14.0"
|
||||
|
@ -813,12 +795,43 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
|
||||
[[package]]
|
||||
name = "com"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6"
|
||||
dependencies = [
|
||||
"com_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "com-rs"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642"
|
||||
|
||||
[[package]]
|
||||
name = "com_macros"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5"
|
||||
dependencies = [
|
||||
"com_macros_support",
|
||||
"proc-macro2",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "com_macros_support"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.6"
|
||||
|
@ -1121,6 +1134,12 @@ version = "0.8.19"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
version = "3.4.2"
|
||||
|
@ -1148,6 +1167,17 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "d3d12"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"libloading 0.7.4",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.3"
|
||||
|
@ -1299,6 +1329,22 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "exr"
|
||||
version = "1.72.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4"
|
||||
dependencies = [
|
||||
"bit_field",
|
||||
"flume 0.11.0",
|
||||
"half",
|
||||
"lebe",
|
||||
"miniz_oxide",
|
||||
"rayon-core",
|
||||
"smallvec",
|
||||
"zune-inflate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.2.0"
|
||||
|
@ -1320,6 +1366,12 @@ dependencies = [
|
|||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.28"
|
||||
|
@ -1343,6 +1395,15 @@ dependencies = [
|
|||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
|
||||
dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
|
@ -1402,7 +1463,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "frontend-common"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
@ -1419,12 +1480,6 @@ dependencies = [
|
|||
"winit_input_helper",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.30"
|
||||
|
@ -1516,7 +1571,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gb-emu-lib"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"ash-molten",
|
||||
|
@ -1613,15 +1668,6 @@ version = "0.28.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||
|
||||
[[package]]
|
||||
name = "gl"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a94edab108827d67608095e269cf862e60d920f144a5026d3dbcfd8b877fb404"
|
||||
dependencies = [
|
||||
"gl_generator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gl_generator"
|
||||
version = "0.14.0"
|
||||
|
@ -1651,6 +1697,27 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glow"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"slotmap",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutin_wgl_sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead"
|
||||
dependencies = [
|
||||
"gl_generator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "goblin"
|
||||
version = "0.6.1"
|
||||
|
@ -1669,7 +1736,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "22beaafc29b38204457ea030f6fb7a84c9e4dd1b86e311ba0542533453d87f62"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"gpu-alloc-types",
|
||||
"gpu-alloc-types 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-alloc"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"gpu-alloc-types 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1681,6 +1758,15 @@ dependencies = [
|
|||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-alloc-types"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-allocator"
|
||||
version = "0.22.0"
|
||||
|
@ -1695,6 +1781,19 @@ dependencies = [
|
|||
"windows 0.44.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-allocator"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
|
||||
dependencies = [
|
||||
"log",
|
||||
"presser",
|
||||
"thiserror",
|
||||
"winapi",
|
||||
"windows 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpu-descriptor"
|
||||
version = "0.2.4"
|
||||
|
@ -1730,6 +1829,16 @@ dependencies = [
|
|||
"uuid 1.7.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"crunchy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
|
@ -1770,6 +1879,21 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hassle-rs"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"com",
|
||||
"libc",
|
||||
"libloading 0.7.4",
|
||||
"thiserror",
|
||||
"widestring",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
|
@ -1856,10 +1980,12 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"exr",
|
||||
"gif",
|
||||
"jpeg-decoder",
|
||||
"num-traits",
|
||||
"png",
|
||||
"qoi",
|
||||
"tiff",
|
||||
]
|
||||
|
||||
|
@ -2021,6 +2147,9 @@ name = "jpeg-decoder"
|
|||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
|
||||
dependencies = [
|
||||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
|
@ -2053,6 +2182,17 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "khronos-egl"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"libloading 0.8.1",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "khronos_api"
|
||||
version = "3.1.0"
|
||||
|
@ -2071,6 +2211,12 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "lebe"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.152"
|
||||
|
@ -2099,8 +2245,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"librashader-cache",
|
||||
|
@ -2109,17 +2255,15 @@ dependencies = [
|
|||
"librashader-presets",
|
||||
"librashader-reflect",
|
||||
"librashader-runtime",
|
||||
"librashader-runtime-d3d11",
|
||||
"librashader-runtime-d3d12",
|
||||
"librashader-runtime-gl",
|
||||
"librashader-runtime-vk",
|
||||
"windows 0.48.0",
|
||||
"librashader-runtime-wgpu",
|
||||
"wgpu 0.19.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-cache"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"blake3",
|
||||
|
@ -2130,24 +2274,22 @@ dependencies = [
|
|||
"rusqlite",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"windows 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-common"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"gl",
|
||||
"num-traits",
|
||||
"windows 0.48.0",
|
||||
"wgpu-types 0.19.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-preprocess"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"librashader-common",
|
||||
|
@ -2158,8 +2300,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-presets"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"librashader-common",
|
||||
"nom",
|
||||
|
@ -2170,26 +2312,30 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librashader-reflect"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bytemuck",
|
||||
"indexmap 2.1.0",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
"librashader-spirv-cross",
|
||||
"matches",
|
||||
"naga 0.19.0",
|
||||
"rspirv",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"shaderc",
|
||||
"spirv-to-dxil",
|
||||
"spirv 0.3.0+sdk-1.3.268.0",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"image",
|
||||
|
@ -2201,77 +2347,14 @@ dependencies = [
|
|||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime-d3d11"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
"librashader-reflect",
|
||||
"librashader-runtime",
|
||||
"librashader-spirv-cross",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"thiserror",
|
||||
"windows 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime-d3d12"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"array-init",
|
||||
"bitvec",
|
||||
"bytemuck",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
"librashader-reflect",
|
||||
"librashader-runtime",
|
||||
"librashader-spirv-cross",
|
||||
"parking_lot",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"thiserror",
|
||||
"widestring",
|
||||
"windows 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime-gl"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"gl",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
"librashader-reflect",
|
||||
"librashader-runtime",
|
||||
"librashader-spirv-cross",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime-vk"
|
||||
version = "0.2.0-beta.2"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#2d0dd5909defa9eaf9ae067e4522474401c5a9ea"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"bytemuck",
|
||||
"gpu-allocator",
|
||||
"gpu-allocator 0.22.0",
|
||||
"librashader-cache",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
|
@ -2285,6 +2368,25 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-runtime-wgpu"
|
||||
version = "0.2.0-beta.5"
|
||||
source = "git+https://git.alexjanka.com/alex/librashader#446b052657fee7cc364ae33ba2644fafc65a1587"
|
||||
dependencies = [
|
||||
"array-concat",
|
||||
"bytemuck",
|
||||
"image",
|
||||
"librashader-common",
|
||||
"librashader-preprocess",
|
||||
"librashader-presets",
|
||||
"librashader-reflect",
|
||||
"librashader-runtime",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"thiserror",
|
||||
"wgpu 0.19.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librashader-spirv-cross"
|
||||
version = "0.23.5"
|
||||
|
@ -2388,6 +2490,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.1"
|
||||
|
@ -2450,6 +2558,21 @@ dependencies = [
|
|||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"block",
|
||||
"core-graphics-types 0.1.3",
|
||||
"foreign-types 0.5.0",
|
||||
"log",
|
||||
"objc",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "midi-consts"
|
||||
version = "0.1.0"
|
||||
|
@ -2545,6 +2668,7 @@ dependencies = [
|
|||
"indexmap 2.1.0",
|
||||
"log",
|
||||
"num-traits",
|
||||
"petgraph",
|
||||
"rustc-hash",
|
||||
"spirv 0.3.0+sdk-1.3.268.0",
|
||||
"termcolor",
|
||||
|
@ -2747,7 +2871,7 @@ version = "0.10.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc4ae290027ab0d22e1405d304603e41edfaee597a81ce09cf751785b44c32a9"
|
||||
dependencies = [
|
||||
"flume",
|
||||
"flume 0.10.14",
|
||||
"image",
|
||||
"nokhwa-bindings-macos",
|
||||
"nokhwa-core",
|
||||
|
@ -2765,7 +2889,7 @@ dependencies = [
|
|||
"cocoa-foundation",
|
||||
"core-media-sys",
|
||||
"core-video-sys",
|
||||
"flume",
|
||||
"flume 0.10.14",
|
||||
"nokhwa-core",
|
||||
"objc",
|
||||
"once_cell",
|
||||
|
@ -3056,6 +3180,16 @@ version = "2.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap 2.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.3"
|
||||
|
@ -3099,7 +3233,7 @@ dependencies = [
|
|||
"raw-window-handle 0.5.2",
|
||||
"thiserror",
|
||||
"ultraviolet",
|
||||
"wgpu",
|
||||
"wgpu 0.16.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3182,6 +3316,12 @@ version = "0.2.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "presser"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.3.1"
|
||||
|
@ -3216,6 +3356,15 @@ version = "1.0.13"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d135ede8821cf6376eb7a64148901e1690b788c11ae94dc297ae917dbc91dc0e"
|
||||
|
||||
[[package]]
|
||||
name = "qoi"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.30.0"
|
||||
|
@ -3243,12 +3392,6 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
|
@ -3441,6 +3584,16 @@ dependencies = [
|
|||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rspirv"
|
||||
version = "0.12.0+sdk-1.3.268.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cf3a93856b6e5946537278df0d3075596371b1950ccff012f02b0f7eafec8d"
|
||||
dependencies = [
|
||||
"rustc-hash",
|
||||
"spirv 0.3.0+sdk-1.3.268.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rtrb"
|
||||
version = "0.2.3"
|
||||
|
@ -3758,28 +3911,6 @@ dependencies = [
|
|||
"bitflags 2.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spirv-to-dxil"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ce8b35efd4e676abda599d43a3ddf8771bd77364631745a7254079021d55895"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"spirv-to-dxil-sys",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spirv-to-dxil-sys"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "159f154ac0277748c193b397a72d27ee664446547dfa9a2589cf7a7bd9a01e5e"
|
||||
dependencies = [
|
||||
"build-target",
|
||||
"bytemuck",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
|
@ -3820,12 +3951,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.4.1"
|
||||
|
@ -4016,7 +4141,7 @@ checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"
|
|||
|
||||
[[package]]
|
||||
name = "twinc_emu_vst"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
dependencies = [
|
||||
"async-ringbuf",
|
||||
"baseview 0.1.0 (git+https://git.alexjanka.com/alex/baseview)",
|
||||
|
@ -4419,9 +4544,34 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"wgpu-core",
|
||||
"wgpu-hal",
|
||||
"wgpu-types",
|
||||
"wgpu-core 0.16.1",
|
||||
"wgpu-hal 0.16.2",
|
||||
"wgpu-types 0.16.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.19.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bfe9a310dcf2e6b85f00c46059aaeaf4184caa8e29a1ecd4b7a704c3482332d"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"cfg-if 1.0.0",
|
||||
"cfg_aliases",
|
||||
"js-sys",
|
||||
"log",
|
||||
"naga 0.19.0",
|
||||
"parking_lot",
|
||||
"profiling",
|
||||
"raw-window-handle 0.6.0",
|
||||
"smallvec",
|
||||
"static_assertions",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"wgpu-core 0.19.0",
|
||||
"wgpu-hal 0.19.1",
|
||||
"wgpu-types 0.19.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4443,8 +4593,34 @@ dependencies = [
|
|||
"smallvec",
|
||||
"thiserror",
|
||||
"web-sys",
|
||||
"wgpu-hal",
|
||||
"wgpu-types",
|
||||
"wgpu-hal 0.16.2",
|
||||
"wgpu-types 0.16.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
"bitflags 2.4.2",
|
||||
"cfg_aliases",
|
||||
"codespan-reporting",
|
||||
"indexmap 2.1.0",
|
||||
"log",
|
||||
"naga 0.19.0",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"profiling",
|
||||
"raw-window-handle 0.6.0",
|
||||
"rustc-hash",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"web-sys",
|
||||
"wgpu-hal 0.19.1",
|
||||
"wgpu-types 0.19.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4460,15 +4636,15 @@ dependencies = [
|
|||
"bitflags 2.4.2",
|
||||
"block",
|
||||
"core-graphics-types 0.1.3",
|
||||
"d3d12",
|
||||
"d3d12 0.6.0",
|
||||
"foreign-types 0.3.2",
|
||||
"glow",
|
||||
"gpu-alloc",
|
||||
"gpu-allocator",
|
||||
"glow 0.12.3",
|
||||
"gpu-alloc 0.5.4",
|
||||
"gpu-allocator 0.22.0",
|
||||
"gpu-descriptor",
|
||||
"hassle-rs",
|
||||
"hassle-rs 0.10.0",
|
||||
"js-sys",
|
||||
"khronos-egl",
|
||||
"khronos-egl 4.1.0",
|
||||
"libc",
|
||||
"libloading 0.8.1",
|
||||
"log",
|
||||
|
@ -4485,7 +4661,51 @@ dependencies = [
|
|||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
"wgpu-types",
|
||||
"wgpu-types 0.16.1",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "0.19.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3bb47856236bfafc0bc591a925eb036ac19cd987624a447ff353e7a7e7e6f72"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
"ash",
|
||||
"bit-set",
|
||||
"bitflags 2.4.2",
|
||||
"block",
|
||||
"cfg_aliases",
|
||||
"core-graphics-types 0.1.3",
|
||||
"d3d12 0.19.0",
|
||||
"glow 0.13.1",
|
||||
"glutin_wgl_sys",
|
||||
"gpu-alloc 0.6.0",
|
||||
"gpu-allocator 0.25.0",
|
||||
"gpu-descriptor",
|
||||
"hassle-rs 0.11.0",
|
||||
"js-sys",
|
||||
"khronos-egl 6.0.0",
|
||||
"libc",
|
||||
"libloading 0.7.4",
|
||||
"log",
|
||||
"metal 0.27.0",
|
||||
"naga 0.19.0",
|
||||
"objc",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"profiling",
|
||||
"range-alloc",
|
||||
"raw-window-handle 0.6.0",
|
||||
"renderdoc-sys",
|
||||
"rustc-hash",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
"wgpu-types 0.19.0",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -4500,6 +4720,17 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-types"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"js-sys",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wide"
|
||||
version = "0.7.14"
|
||||
|
@ -4580,15 +4811,6 @@ dependencies = [
|
|||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.52.0"
|
||||
|
@ -4874,15 +5096,6 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
|
||||
dependencies = [
|
||||
"tap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11"
|
||||
version = "2.21.0"
|
||||
|
@ -5009,3 +5222,12 @@ dependencies = [
|
|||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zune-inflate"
|
||||
version = "0.2.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
|
||||
dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
|
|
|
@ -9,7 +9,7 @@ frontend-common = { path = "./frontend-common" }
|
|||
baseview = { git = "https://git.alexjanka.com/alex/baseview" }
|
||||
nih_plug = { git = "https://github.com/robbert-vdh/nih-plug" }
|
||||
nih_plug_xtask = { git = "https://github.com/robbert-vdh/nih-plug" }
|
||||
librashader = { git = "https://git.alexjanka.com/alex/librashader" }
|
||||
librashader = { git = "https://git.alexjanka.com/alex/librashader", default-features = false }
|
||||
librashader-common = { git = "https://git.alexjanka.com/alex/librashader" }
|
||||
librashader-presets = { git = "https://git.alexjanka.com/alex/librashader" }
|
||||
librashader-preprocess = { git = "https://git.alexjanka.com/alex/librashader" }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#[cfg(feature = "camera")]
|
||||
use camera::Webcam;
|
||||
use clap::{ArgGroup, Parser, Subcommand, ValueEnum};
|
||||
use frontend_common::{audio, debug::Debugger, window::winit_manager::WinitWindowManager};
|
||||
use frontend_common::{audio, debug::Debugger, window::ActiveWindowManager};
|
||||
use gb_emu_lib::{
|
||||
config::{ConfigManager, CONFIG_MANAGER},
|
||||
connect::{EmulatorCoreTrait, EmulatorMessage, SerialTarget, SramType, StdoutType},
|
||||
|
@ -170,7 +170,7 @@ fn main() {
|
|||
let (record, mute, debug) = (args.record, args.mute, args.debug);
|
||||
let prepared = frontend_common::prepare(args.into(), receiver);
|
||||
let (output, stream) = audio::create_output(mute);
|
||||
let mut window_manager = WinitWindowManager::new(sender, stream, record);
|
||||
let mut window_manager = ActiveWindowManager::new(sender, stream, record);
|
||||
let mut core = frontend_common::run(prepared, &mut window_manager, output);
|
||||
if debug {
|
||||
let mut debugger = Debugger::new(Box::new(core));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "frontend-common"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
edition = "2021"
|
||||
description = "Frontend common library for TWINC Game Boy (CGB/DMG) emulator"
|
||||
|
||||
|
@ -10,13 +10,10 @@ identifier = "com.alexjanka.TWINC"
|
|||
[features]
|
||||
default = ["vulkan-static"]
|
||||
pixels = ["gb-emu-lib/pixels-renderer"]
|
||||
vulkan = [
|
||||
"dep:raw-window-handle",
|
||||
"gb-emu-lib/vulkan-renderer",
|
||||
"gb-emu-lib/vulkan-debug",
|
||||
]
|
||||
vulkan = ["gb-emu-lib/vulkan-renderer", "gb-emu-lib/vulkan-debug"]
|
||||
vulkan-static = ["vulkan", "gb-emu-lib/vulkan-static"]
|
||||
camera = ["dep:nokhwa", "dep:send_wrapper"]
|
||||
wgpu = ["gb-emu-lib/wgpu-renderer"]
|
||||
|
||||
[dependencies]
|
||||
gb-emu-lib = { workspace = true }
|
||||
|
@ -29,7 +26,7 @@ nokhwa = { version = "0.10", features = [
|
|||
send_wrapper = { version = "0.6.0", optional = true }
|
||||
winit = { version = "0.29", features = ["rwh_05"] }
|
||||
winit_input_helper = "0.15"
|
||||
raw-window-handle = { version = "0.5", optional = true }
|
||||
raw-window-handle = { version = "0.5" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
image = { version = "0.24", default-features = false, features = ["png"] }
|
||||
bytemuck = "1.14"
|
||||
|
|
|
@ -24,9 +24,17 @@ mod camera;
|
|||
pub mod debug;
|
||||
pub mod window;
|
||||
|
||||
#[cfg(all(feature = "vulkan", feature = "pixels"))]
|
||||
#[cfg(any(
|
||||
all(feature = "vulkan", feature = "pixels"),
|
||||
all(feature = "vulkan", feature = "wgpu"),
|
||||
all(feature = "wgpu", feature = "pixels")
|
||||
))]
|
||||
compile_error!("select only one rendering backend!");
|
||||
#[cfg(all(not(feature = "vulkan"), not(feature = "pixels")))]
|
||||
#[cfg(all(
|
||||
not(feature = "vulkan"),
|
||||
not(feature = "pixels"),
|
||||
not(feature = "wgpu")
|
||||
))]
|
||||
compile_error!("select one rendering backend!");
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::{path::PathBuf, sync::mpsc::Sender};
|
||||
|
||||
use gb_emu_lib::connect::RendererMessage;
|
||||
use gb_emu_lib::{connect::RendererMessage, renderer::ActiveBackend};
|
||||
|
||||
pub mod winit_manager;
|
||||
pub type ActiveWindowManager = winit_manager::WinitWindowManager<ActiveBackend>;
|
||||
|
||||
pub type RendererChannel = Sender<RendererMessage<[u8; 4]>>;
|
||||
|
||||
|
|
|
@ -8,14 +8,12 @@ use std::{
|
|||
};
|
||||
|
||||
use cpal::Stream;
|
||||
use gb_emu_lib::connect::{EmulatorMessage, JoypadState, RendererMessage, ResolutionData};
|
||||
#[cfg(feature = "pixels")]
|
||||
use gb_emu_lib::renderer::pixels::{RendererBackend, RendererBackendManager, WindowOptions};
|
||||
#[cfg(feature = "vulkan")]
|
||||
use gb_emu_lib::renderer::vulkan::{RendererBackend, RendererBackendManager, WindowOptions};
|
||||
use gb_emu_lib::{
|
||||
connect::{EmulatorMessage, JoypadState, RendererMessage, ResolutionData},
|
||||
renderer::{RendererBackend, RendererBackendManager},
|
||||
};
|
||||
use gilrs::{Button, Gilrs};
|
||||
use image::ImageBuffer;
|
||||
#[cfg(feature = "vulkan")]
|
||||
use raw_window_handle::HasRawDisplayHandle;
|
||||
use winit::{
|
||||
dpi::PhysicalSize,
|
||||
|
@ -31,16 +29,22 @@ use crate::access_config;
|
|||
|
||||
use super::{RendererChannel, WindowManager, WindowType};
|
||||
|
||||
pub struct WinitWindowManager {
|
||||
pub struct WinitWindowManager<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
event_loop: EventLoop<()>,
|
||||
data: WinitWindowManagerData,
|
||||
data: WinitWindowManagerData<Backend>,
|
||||
record_main: bool,
|
||||
}
|
||||
|
||||
struct WinitWindowManagerData {
|
||||
struct WinitWindowManagerData<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
main_window: Option<WindowId>,
|
||||
windows: HashMap<WindowId, WindowRenderer>,
|
||||
window_data_manager: Arc<RendererBackendManager>,
|
||||
windows: HashMap<WindowId, WindowRenderer<Backend>>,
|
||||
window_data_manager: Arc<Backend::RendererBackendManager>,
|
||||
input: WinitInputHelper,
|
||||
sender: Sender<EmulatorMessage<[u8; 4]>>,
|
||||
gamepad_handler: Gilrs,
|
||||
|
@ -48,18 +52,20 @@ struct WinitWindowManagerData {
|
|||
_stream: Stream,
|
||||
}
|
||||
|
||||
impl WinitWindowManager {
|
||||
impl<Backend> WinitWindowManager<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
pub fn new(
|
||||
sender: Sender<EmulatorMessage<[u8; 4]>>,
|
||||
_stream: Stream,
|
||||
record_main: bool,
|
||||
) -> Self {
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
#[cfg(feature = "vulkan")]
|
||||
let window_data_manager =
|
||||
Arc::new(RendererBackendManager::new(event_loop.raw_display_handle()));
|
||||
#[cfg(feature = "pixels")]
|
||||
let window_data_manager = Arc::new(RendererBackendManager::new());
|
||||
|
||||
let window_data_manager = Arc::new(Backend::RendererBackendManager::new(
|
||||
event_loop.raw_display_handle(),
|
||||
));
|
||||
Self {
|
||||
event_loop,
|
||||
data: WinitWindowManagerData {
|
||||
|
@ -87,7 +93,10 @@ impl WinitWindowManager {
|
|||
}
|
||||
}
|
||||
|
||||
impl WindowManager for WinitWindowManager {
|
||||
impl<Backend> WindowManager for WinitWindowManager<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
fn add(
|
||||
&mut self,
|
||||
window_type: WindowType,
|
||||
|
@ -108,7 +117,10 @@ impl WindowManager for WinitWindowManager {
|
|||
}
|
||||
}
|
||||
|
||||
impl WinitWindowManagerData {
|
||||
impl<Backend> WinitWindowManagerData<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
fn add(
|
||||
&mut self,
|
||||
factor: usize,
|
||||
|
@ -269,9 +281,12 @@ impl WinitWindowManagerData {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct WindowRenderer {
|
||||
pub struct WindowRenderer<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
receiver: Receiver<RendererMessage<[u8; 4]>>,
|
||||
renderer: RendererBackend,
|
||||
renderer: Backend,
|
||||
window: Window,
|
||||
width: usize,
|
||||
height: usize,
|
||||
|
@ -293,12 +308,15 @@ impl QueuedBuf {
|
|||
}
|
||||
}
|
||||
|
||||
impl WindowRenderer {
|
||||
impl<Backend> WindowRenderer<Backend>
|
||||
where
|
||||
Backend: RendererBackend,
|
||||
{
|
||||
#[allow(unused_variables)]
|
||||
fn new(
|
||||
factor: usize,
|
||||
event_loop: &EventLoop<()>,
|
||||
manager: Arc<RendererBackendManager>,
|
||||
manager: Arc<Backend::RendererBackendManager>,
|
||||
shader_path: Option<PathBuf>,
|
||||
resizable: bool,
|
||||
record: bool,
|
||||
|
@ -318,12 +336,7 @@ impl WindowRenderer {
|
|||
scaled_height: inner_size.height / real_factor,
|
||||
};
|
||||
|
||||
#[cfg(feature = "vulkan")]
|
||||
let options = WindowOptions { shader_path };
|
||||
#[cfg(feature = "pixels")]
|
||||
let options = WindowOptions {};
|
||||
|
||||
let renderer = RendererBackend::new(resolutions, &window, options, manager);
|
||||
let renderer = RendererBackend::new(resolutions, &window, shader_path, manager);
|
||||
|
||||
let recording = if record {
|
||||
let configs = access_config();
|
||||
|
@ -358,7 +371,7 @@ impl WindowRenderer {
|
|||
)
|
||||
}
|
||||
|
||||
fn render(&mut self, manager: &RendererBackendManager) {
|
||||
fn render(&mut self, manager: &Backend::RendererBackendManager) {
|
||||
let inner_size = self.window.inner_size();
|
||||
if !self.queued_buf.displayed {
|
||||
self.renderer.new_frame(&self.queued_buf.buf);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "twinc_emu_vst"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
@ -9,8 +9,9 @@ crate-type = ["cdylib", "rlib"]
|
|||
[features]
|
||||
default = ["plugin", "vulkan-static"]
|
||||
pixels = ["gb-emu-lib/pixels-renderer"]
|
||||
vulkan = ["dep:raw-window-handle", "gb-emu-lib/vulkan-renderer"]
|
||||
vulkan = ["gb-emu-lib/vulkan-renderer"]
|
||||
vulkan-static = ["vulkan", "gb-emu-lib/vulkan-static"]
|
||||
wgpu = ["gb-emu-lib/wgpu-renderer"]
|
||||
plugin = [
|
||||
"dep:nih_plug",
|
||||
"dep:baseview",
|
||||
|
@ -26,5 +27,5 @@ baseview = { workspace = true, optional = true }
|
|||
async-ringbuf = { version = "0.1", optional = true }
|
||||
futures = { version = "0.3", optional = true }
|
||||
keyboard-types = { version = "0.6.2", optional = true }
|
||||
raw-window-handle = { version = "0.5", optional = true }
|
||||
raw-window-handle = { version = "0.5" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
|
|
@ -3,15 +3,13 @@ use std::sync::{Arc, Mutex};
|
|||
use baseview::{
|
||||
Event, EventStatus, Size, Window, WindowEvent, WindowHandle, WindowHandler, WindowOpenOptions,
|
||||
};
|
||||
use gb_emu_lib::connect::{
|
||||
JoypadButtons, JoypadState, RendererMessage, ResolutionData, HEIGHT, WIDTH,
|
||||
use gb_emu_lib::{
|
||||
connect::{JoypadButtons, JoypadState, RendererMessage, ResolutionData, HEIGHT, WIDTH},
|
||||
renderer::{ActiveBackend, RendererBackend, RendererBackendManager},
|
||||
};
|
||||
#[cfg(feature = "pixels")]
|
||||
use gb_emu_lib::renderer::pixels::{RendererBackend, RendererBackendManager, WindowOptions};
|
||||
#[cfg(feature = "vulkan")]
|
||||
use gb_emu_lib::renderer::vulkan::{RendererBackend, RendererBackendManager, WindowOptions};
|
||||
use keyboard_types::{Code, KeyState};
|
||||
use nih_plug::prelude::*;
|
||||
use raw_window_handle::HasRawDisplayHandle;
|
||||
|
||||
use super::{access_config, EmuComms};
|
||||
|
||||
|
@ -48,7 +46,6 @@ impl Editor for TwincEditor {
|
|||
|
||||
let config = access_config();
|
||||
|
||||
#[cfg(feature = "vulkan")]
|
||||
let shader_path = {
|
||||
if super::IS_CGB.get().is_some_and(|v| *v) {
|
||||
config.emu_config.vulkan_config.cgb_shader_path.as_ref()
|
||||
|
@ -73,23 +70,12 @@ impl Editor for TwincEditor {
|
|||
scale: baseview::WindowScalePolicy::SystemScaleFactor,
|
||||
},
|
||||
move |window| {
|
||||
let manager = {
|
||||
#[cfg(feature = "vulkan")]
|
||||
{
|
||||
use raw_window_handle::HasRawDisplayHandle;
|
||||
Arc::new(RendererBackendManager::new(window.raw_display_handle()))
|
||||
}
|
||||
#[cfg(feature = "pixels")]
|
||||
Arc::new(RendererBackendManager::new())
|
||||
};
|
||||
TwincEditorWindow::new(
|
||||
window,
|
||||
rr_cloned,
|
||||
manager,
|
||||
size,
|
||||
#[cfg(feature = "vulkan")]
|
||||
shader_path,
|
||||
)
|
||||
let manager = Arc::new(
|
||||
<ActiveBackend as RendererBackend>::RendererBackendManager::new(
|
||||
window.raw_display_handle(),
|
||||
),
|
||||
);
|
||||
TwincEditorWindow::new(window, rr_cloned, manager, size, shader_path)
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -124,8 +110,8 @@ impl Drop for TwincEditorWindowHandle {
|
|||
}
|
||||
|
||||
pub struct TwincEditorWindow {
|
||||
renderer: RendererBackend,
|
||||
manager: Arc<RendererBackendManager>,
|
||||
renderer: ActiveBackend,
|
||||
manager: Arc<<ActiveBackend as RendererBackend>::RendererBackendManager>,
|
||||
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
||||
joypad_state: JoypadState,
|
||||
latest_buf: Vec<[u8; 4]>,
|
||||
|
@ -136,9 +122,9 @@ impl TwincEditorWindow {
|
|||
fn new(
|
||||
window: &mut Window,
|
||||
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
||||
manager: Arc<RendererBackendManager>,
|
||||
manager: Arc<<ActiveBackend as RendererBackend>::RendererBackendManager>,
|
||||
size: Size,
|
||||
#[cfg(feature = "vulkan")] shader_path: Option<std::path::PathBuf>,
|
||||
shader_path: Option<std::path::PathBuf>,
|
||||
) -> Self {
|
||||
let current_resolution = ResolutionData {
|
||||
real_width: size.width as u32,
|
||||
|
@ -147,13 +133,8 @@ impl TwincEditorWindow {
|
|||
scaled_height: HEIGHT as u32,
|
||||
};
|
||||
|
||||
#[cfg(feature = "vulkan")]
|
||||
let window_options = WindowOptions { shader_path };
|
||||
#[cfg(feature = "pixels")]
|
||||
let window_options = WindowOptions {};
|
||||
|
||||
let renderer =
|
||||
RendererBackend::new(current_resolution, window, window_options, manager.clone());
|
||||
RendererBackend::new(current_resolution, window, shader_path, manager.clone());
|
||||
|
||||
Self {
|
||||
renderer,
|
||||
|
|
|
@ -24,7 +24,7 @@ use frontend_common::{
|
|||
};
|
||||
use gb_emu_lib::{
|
||||
connect::{EmulatorMessage, JoypadButtons, JoypadState, RendererMessage, ResolutionData},
|
||||
renderer::vulkan::{RendererBackend, RendererBackendManager, WindowOptions},
|
||||
renderer::{ActiveBackend, RendererBackend, RendererBackendManager},
|
||||
};
|
||||
use objc::{
|
||||
class, msg_send, msg_send_id,
|
||||
|
@ -157,7 +157,7 @@ fn get_buttons(event: &Event) -> Option<JoypadButtons> {
|
|||
}
|
||||
|
||||
pub struct CacaoWindowManager {
|
||||
backend_manager: Arc<RendererBackendManager>,
|
||||
backend_manager: Arc<<ActiveBackend as RendererBackend>::RendererBackendManager>,
|
||||
windows: HashMap<WindowType, Window<CacaoWindow>>,
|
||||
handles: Option<EmulatorHandles>,
|
||||
joypad_state: JoypadState,
|
||||
|
@ -169,7 +169,9 @@ impl CacaoWindowManager {
|
|||
let _button_handler = ButtonHandler::new();
|
||||
|
||||
Self {
|
||||
backend_manager: Arc::new(RendererBackendManager::new(display_handle)),
|
||||
backend_manager: Arc::new(
|
||||
<ActiveBackend as RendererBackend>::RendererBackendManager::new(display_handle),
|
||||
),
|
||||
windows: HashMap::new(),
|
||||
handles: None,
|
||||
joypad_state: Default::default(),
|
||||
|
@ -414,8 +416,8 @@ impl Drop for MonitorThread {
|
|||
|
||||
struct CacaoWindow {
|
||||
window_type: WindowType,
|
||||
backend_manager: Arc<RendererBackendManager>,
|
||||
backend: Option<RendererBackend>,
|
||||
backend_manager: Arc<<ActiveBackend as RendererBackend>::RendererBackendManager>,
|
||||
backend: Option<ActiveBackend>,
|
||||
scale_factor: usize,
|
||||
shader_path: Option<PathBuf>,
|
||||
resolutions: ResolutionData,
|
||||
|
@ -427,7 +429,7 @@ impl CacaoWindow {
|
|||
window_type: WindowType,
|
||||
scale_factor: usize,
|
||||
shader_path: Option<std::path::PathBuf>,
|
||||
backend_manager: Arc<RendererBackendManager>,
|
||||
backend_manager: Arc<<ActiveBackend as RendererBackend>::RendererBackendManager>,
|
||||
) -> (Self, RendererChannel) {
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
let channel_thread = MonitorThread::new(receiver, window_type);
|
||||
|
@ -487,14 +489,10 @@ impl WindowDelegate for CacaoWindow {
|
|||
const NAME: &'static str = "EmulatorWindow";
|
||||
|
||||
fn did_load(&mut self, window: Window) {
|
||||
let options = WindowOptions {
|
||||
shader_path: self.shader_path.clone(),
|
||||
};
|
||||
|
||||
self.backend = Some(RendererBackend::new(
|
||||
self.resolutions,
|
||||
&WindowHandleWrapper(&window),
|
||||
options,
|
||||
self.shader_path.clone(),
|
||||
self.backend_manager.clone(),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
[package]
|
||||
name = "gb-emu-lib"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
clocked-serial = []
|
||||
vulkan-renderer = [
|
||||
"renderer",
|
||||
"dep:ash",
|
||||
"dep:ash-window",
|
||||
"dep:raw-window-handle",
|
||||
"dep:naga",
|
||||
"dep:librashader",
|
||||
"dep:librashader-presets",
|
||||
"dep:librashader-common",
|
||||
"librashader/runtime-vk",
|
||||
]
|
||||
vulkan-static = ["dep:ash-molten", "vulkan-renderer"]
|
||||
vulkan-debug = []
|
||||
pixels-renderer = ["dep:pixels"]
|
||||
pixels-renderer = ["renderer", "dep:pixels"]
|
||||
wgpu-renderer = ["renderer", "dep:librashader", "librashader/runtime-wgpu"]
|
||||
renderer = []
|
||||
config = ["dep:directories", "dep:ron"]
|
||||
error-colour = []
|
||||
|
||||
|
@ -33,7 +36,7 @@ num-traits = "0.2"
|
|||
pixels = { version = "0.13", optional = true }
|
||||
ash = { version = "0.37", features = ["linked"], optional = true }
|
||||
ash-window = { version = "0.12", optional = true }
|
||||
raw-window-handle = { version = "0.5", optional = true }
|
||||
raw-window-handle = { version = "0.5" }
|
||||
librashader = { workspace = true, optional = true }
|
||||
librashader-presets = { workspace = true, optional = true }
|
||||
librashader-common = { workspace = true, optional = true }
|
||||
|
|
|
@ -84,7 +84,7 @@ impl<Format: From<Colour>> RendererMessage<Format> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "vulkan-renderer", feature = "pixels-renderer"))]
|
||||
#[cfg(feature = "renderer")]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct ResolutionData {
|
||||
pub real_width: u32,
|
||||
|
|
|
@ -8,7 +8,11 @@ use processor::{
|
|||
};
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
||||
#[cfg(all(feature = "vulkan", feature = "pixels"))]
|
||||
#[cfg(any(
|
||||
all(feature = "vulkan-renderer", feature = "pixels-renderer"),
|
||||
all(feature = "vulkan-renderer", feature = "wgpu-renderer"),
|
||||
all(feature = "wgpu-renderer", feature = "pixels-renderer")
|
||||
))]
|
||||
compile_error!("select only one rendering backend!");
|
||||
|
||||
pub mod renderer;
|
||||
|
|
|
@ -1,4 +1,41 @@
|
|||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle};
|
||||
|
||||
use crate::connect::ResolutionData;
|
||||
|
||||
#[cfg(feature = "vulkan-renderer")]
|
||||
pub type ActiveBackend = vulkan::VulkanBackend;
|
||||
#[cfg(feature = "wgpu-renderer")]
|
||||
pub type ActiveBackend = wgpu::WgpuBackend;
|
||||
#[cfg(feature = "pixels-renderer")]
|
||||
pub type ActiveBackend = pixels::PixelsBackend;
|
||||
|
||||
#[cfg(feature = "pixels-renderer")]
|
||||
pub mod pixels;
|
||||
#[cfg(feature = "vulkan-renderer")]
|
||||
pub mod vulkan;
|
||||
#[cfg(feature = "wgpu-renderer")]
|
||||
pub mod wgpu;
|
||||
|
||||
pub trait RendererBackend {
|
||||
type RendererBackendManager: RendererBackendManager;
|
||||
|
||||
fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
resolutions: ResolutionData,
|
||||
window: &W,
|
||||
shader_path: Option<PathBuf>,
|
||||
manager: Arc<Self::RendererBackendManager>,
|
||||
) -> Self;
|
||||
fn resize<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
&mut self,
|
||||
resolutions: ResolutionData,
|
||||
window: &W,
|
||||
);
|
||||
fn new_frame(&mut self, buffer: &[[u8; 4]]);
|
||||
fn render(&mut self, resolutions: ResolutionData, manager: &Self::RendererBackendManager);
|
||||
}
|
||||
|
||||
pub trait RendererBackendManager {
|
||||
fn new(display_handle: RawDisplayHandle) -> Self;
|
||||
}
|
||||
|
|
|
@ -1,40 +1,42 @@
|
|||
use std::sync::Arc;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
use pixels::{
|
||||
raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle},
|
||||
Pixels, SurfaceTexture,
|
||||
};
|
||||
use raw_window_handle::RawDisplayHandle;
|
||||
|
||||
use crate::connect::ResolutionData;
|
||||
|
||||
pub struct RendererBackendManager {}
|
||||
use super::{RendererBackend, RendererBackendManager};
|
||||
|
||||
impl RendererBackendManager {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
pub struct PixelsBackendManager {}
|
||||
|
||||
impl RendererBackendManager for PixelsBackendManager {
|
||||
fn new(_: RawDisplayHandle) -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WindowOptions {}
|
||||
|
||||
pub struct RendererBackend {
|
||||
pub struct PixelsBackend {
|
||||
pub pixels: Pixels,
|
||||
}
|
||||
|
||||
impl RendererBackend {
|
||||
pub fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
impl RendererBackend for PixelsBackend {
|
||||
type RendererBackendManager = PixelsBackendManager;
|
||||
|
||||
fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
resolutions: ResolutionData,
|
||||
window: &W,
|
||||
_: WindowOptions,
|
||||
_: Arc<RendererBackendManager>,
|
||||
_: Option<PathBuf>,
|
||||
_: Arc<Self::RendererBackendManager>,
|
||||
) -> Self {
|
||||
Self {
|
||||
pixels: new_pixels(resolutions, window),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn resize<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
fn resize<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
&mut self,
|
||||
resolutions: ResolutionData,
|
||||
window: &W,
|
||||
|
@ -42,7 +44,7 @@ impl RendererBackend {
|
|||
self.pixels = new_pixels(resolutions, window);
|
||||
}
|
||||
|
||||
pub fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
if !buffer.is_empty() {
|
||||
self.pixels
|
||||
.frame_mut()
|
||||
|
@ -50,7 +52,7 @@ impl RendererBackend {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn render(&mut self, _: ResolutionData, _: &RendererBackendManager) {
|
||||
fn render(&mut self, _: ResolutionData, _: &PixelsBackendManager) {
|
||||
self.pixels.render().unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ use self::{
|
|||
},
|
||||
};
|
||||
|
||||
use super::{RendererBackend, RendererBackendManager};
|
||||
|
||||
#[cfg(all(debug_assertions, feature = "vulkan-debug"))]
|
||||
mod debug;
|
||||
mod types;
|
||||
|
@ -25,7 +27,7 @@ mod utils;
|
|||
|
||||
const VERTICES: [Vertex; 3] = [Vertex(-1.0, -1.0), Vertex(3.0, -1.0), Vertex(-1.0, 3.0)];
|
||||
|
||||
pub struct RendererBackendManager {
|
||||
pub struct VulkanBackendManager {
|
||||
entry: Entry,
|
||||
instance: Instance,
|
||||
#[cfg(all(debug_assertions, feature = "vulkan-debug"))]
|
||||
|
@ -33,8 +35,8 @@ pub struct RendererBackendManager {
|
|||
debug: debug::VulkanDebug,
|
||||
}
|
||||
|
||||
impl RendererBackendManager {
|
||||
pub fn new(display_handle: RawDisplayHandle) -> Self {
|
||||
impl RendererBackendManager for VulkanBackendManager {
|
||||
fn new(display_handle: RawDisplayHandle) -> Self {
|
||||
#[cfg(all(any(target_os = "macos", target_os = "ios"), feature = "vulkan-static"))]
|
||||
let entry = ash_molten::load();
|
||||
#[cfg(not(all(any(target_os = "macos", target_os = "ios"), feature = "vulkan-static")))]
|
||||
|
@ -88,7 +90,7 @@ impl RendererBackendManager {
|
|||
}
|
||||
}
|
||||
|
||||
impl Drop for RendererBackendManager {
|
||||
impl Drop for VulkanBackendManager {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.instance.destroy_instance(None);
|
||||
|
@ -96,13 +98,13 @@ impl Drop for RendererBackendManager {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct RendererBackend {
|
||||
pub struct VulkanBackend {
|
||||
inner: ManuallyDrop<VulkanWindowInner>,
|
||||
filter_chain: ManuallyDrop<FilterChain>,
|
||||
manager: Arc<RendererBackendManager>,
|
||||
manager: Arc<VulkanBackendManager>,
|
||||
}
|
||||
|
||||
impl Drop for RendererBackend {
|
||||
impl Drop for VulkanBackend {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
ManuallyDrop::drop(&mut self.filter_chain);
|
||||
|
@ -111,16 +113,18 @@ impl Drop for RendererBackend {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct WindowOptions {
|
||||
pub struct VulkanWindowOptions {
|
||||
pub shader_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl RendererBackend {
|
||||
pub fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
impl RendererBackend for VulkanBackend {
|
||||
type RendererBackendManager = VulkanBackendManager;
|
||||
|
||||
fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
resolutions: ResolutionData,
|
||||
window: &W,
|
||||
options: WindowOptions,
|
||||
manager: Arc<RendererBackendManager>,
|
||||
shader_path: Option<PathBuf>,
|
||||
manager: Arc<VulkanBackendManager>,
|
||||
) -> Self {
|
||||
let inner = unsafe { VulkanWindowInner::new(resolutions, window, manager.as_ref()) };
|
||||
|
||||
|
@ -138,7 +142,7 @@ impl RendererBackend {
|
|||
))
|
||||
.unwrap();
|
||||
|
||||
let filter_chain = match options.shader_path {
|
||||
let filter_chain = match shader_path {
|
||||
Some(path) => {
|
||||
unsafe { FilterChain::load_from_path(path, vulkan, Some(&filter_chain_options)) }
|
||||
.unwrap()
|
||||
|
@ -185,7 +189,7 @@ impl RendererBackend {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn resize<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
fn resize<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
&mut self,
|
||||
resolutions: ResolutionData,
|
||||
_window: &W,
|
||||
|
@ -193,11 +197,11 @@ impl RendererBackend {
|
|||
unsafe { self.inner.resize(resolutions, self.manager.as_ref()) };
|
||||
}
|
||||
|
||||
pub fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
fn new_frame(&mut self, buffer: &[[u8; 4]]) {
|
||||
unsafe { self.inner.new_frame(buffer) };
|
||||
}
|
||||
|
||||
pub fn render(&mut self, resolutions: ResolutionData, manager: &RendererBackendManager) {
|
||||
fn render(&mut self, resolutions: ResolutionData, manager: &VulkanBackendManager) {
|
||||
unsafe {
|
||||
self.inner
|
||||
.render(&mut self.filter_chain, resolutions, manager)
|
||||
|
@ -219,7 +223,7 @@ impl VulkanWindowInner {
|
|||
unsafe fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
resolutions: ResolutionData,
|
||||
window: &W,
|
||||
manager: &RendererBackendManager,
|
||||
manager: &VulkanBackendManager,
|
||||
) -> Self {
|
||||
let surface = SurfaceData::new(window, manager);
|
||||
|
||||
|
@ -344,7 +348,7 @@ impl VulkanWindowInner {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe fn resize(&mut self, resolutions: ResolutionData, manager: &RendererBackendManager) {
|
||||
unsafe fn resize(&mut self, resolutions: ResolutionData, manager: &VulkanBackendManager) {
|
||||
self.swapchain.manual_drop(&self.vulkan_data);
|
||||
for framebuffer in &self.framebuffers.framebuffers {
|
||||
self.vulkan_data
|
||||
|
@ -455,7 +459,7 @@ impl VulkanWindowInner {
|
|||
&mut self,
|
||||
filter_chain: &mut FilterChain,
|
||||
resolutions: ResolutionData,
|
||||
manager: &RendererBackendManager,
|
||||
manager: &VulkanBackendManager,
|
||||
) {
|
||||
let (present_index, is_suboptimal) = self
|
||||
.swapchain
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::connect::ResolutionData;
|
|||
|
||||
use super::{
|
||||
utils::{find_memorytype_index, record_submit_commandbuffer},
|
||||
RendererBackendManager,
|
||||
VulkanBackendManager,
|
||||
};
|
||||
|
||||
pub(super) const SHADER_INPUT_FORMAT: vk::Format = vk::Format::R8G8B8A8_UNORM;
|
||||
|
@ -40,7 +40,7 @@ pub(super) struct VulkanData {
|
|||
}
|
||||
|
||||
impl VulkanData {
|
||||
pub(super) unsafe fn new(manager: &RendererBackendManager, surface: &SurfaceData) -> Self {
|
||||
pub(super) unsafe fn new(manager: &VulkanBackendManager, surface: &SurfaceData) -> Self {
|
||||
let pdevices = manager
|
||||
.instance
|
||||
.enumerate_physical_devices()
|
||||
|
@ -209,7 +209,7 @@ pub(super) struct SurfaceData {
|
|||
impl SurfaceData {
|
||||
pub(super) unsafe fn new<W: HasRawDisplayHandle + HasRawWindowHandle>(
|
||||
window: &W,
|
||||
manager: &RendererBackendManager,
|
||||
manager: &VulkanBackendManager,
|
||||
) -> Self {
|
||||
let surface = ash_window::create_surface(
|
||||
&manager.entry,
|
||||
|
@ -249,7 +249,7 @@ pub(super) struct SwapchainData {
|
|||
impl SwapchainData {
|
||||
pub(super) unsafe fn new(
|
||||
resolutions: ResolutionData,
|
||||
manager: &RendererBackendManager,
|
||||
manager: &VulkanBackendManager,
|
||||
surface: &SurfaceData,
|
||||
vulkan: &VulkanData,
|
||||
) -> (Self, vk::PipelineViewportStateCreateInfo) {
|
||||
|
|
3
lib/src/renderer/wgpu.rs
Normal file
3
lib/src/renderer/wgpu.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
pub struct WgpuBackend {}
|
||||
|
||||
pub struct WgpuBackendManager {}
|
Loading…
Add table
Reference in a new issue