Compare commits

...

1 commit

Author SHA1 Message Date
Alex Janka cead2f0d56 libportability 2023-10-22 10:50:17 +11:00
7 changed files with 109 additions and 93 deletions

150
Cargo.lock generated
View file

@ -326,7 +326,7 @@ version = "0.68.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078"
dependencies = [
"bitflags 2.4.0",
"bitflags 2.4.1",
"cexpr",
"clang-sys",
"lazy_static",
@ -363,9 +363,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.0"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
dependencies = [
"serde",
]
@ -691,12 +691,6 @@ dependencies = [
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
[[package]]
name = "core-foundation-sys"
version = "0.7.0"
@ -772,12 +766,12 @@ dependencies = [
[[package]]
name = "coreaudio-rs"
version = "0.11.2"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff"
checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace"
dependencies = [
"bitflags 1.3.2",
"core-foundation-sys 0.6.2",
"core-foundation-sys 0.8.4",
"coreaudio-sys",
]
@ -975,10 +969,11 @@ checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
[[package]]
name = "deranged"
version = "0.3.8"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
dependencies = [
"powerfmt",
"serde",
]
@ -1105,9 +1100,9 @@ dependencies = [
[[package]]
name = "flate2"
version = "1.0.27"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
dependencies = [
"crc32fast",
"miniz_oxide",
@ -1321,7 +1316,7 @@ dependencies = [
"fnv",
"gilrs-core",
"log",
"uuid 1.4.1",
"uuid 1.5.0",
"vec_map",
]
@ -1338,7 +1333,7 @@ dependencies = [
"libudev-sys",
"log",
"nix 0.26.4",
"uuid 1.4.1",
"uuid 1.5.0",
"vec_map",
"wasm-bindgen",
"web-sys",
@ -1419,9 +1414,9 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c"
dependencies = [
"bitflags 2.4.0",
"bitflags 2.4.1",
"gpu-descriptor-types",
"hashbrown 0.14.1",
"hashbrown 0.14.2",
]
[[package]]
@ -1430,7 +1425,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c"
dependencies = [
"bitflags 2.4.0",
"bitflags 2.4.1",
]
[[package]]
@ -1441,9 +1436,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.1"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
dependencies = [
"ahash",
"allocator-api2",
@ -1455,7 +1450,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
dependencies = [
"hashbrown 0.14.1",
"hashbrown 0.14.2",
]
[[package]]
@ -1502,16 +1497,16 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "iana-time-zone"
version = "0.1.57"
version = "0.1.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
dependencies = [
"android_system_properties",
"core-foundation-sys 0.8.4",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows 0.48.0",
"windows-core",
]
[[package]]
@ -1564,7 +1559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
dependencies = [
"equivalent",
"hashbrown 0.14.1",
"hashbrown 0.14.2",
"serde",
]
@ -1916,9 +1911,9 @@ checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
[[package]]
name = "lock_api"
version = "0.4.10"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [
"autocfg",
"scopeguard",
@ -2111,7 +2106,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ceaaa4eedaece7e4ec08c55c640ba03dbb73fb812a6570a59bcf1930d0f70e"
dependencies = [
"bit-set",
"bitflags 2.4.0",
"bitflags 2.4.1",
"codespan-reporting",
"hexf-parse",
"indexmap 1.9.3",
@ -2296,7 +2291,7 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
"bitflags 2.4.0",
"bitflags 2.4.1",
"cfg-if 1.0.0",
"libc",
]
@ -2575,13 +2570,13 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.8"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall 0.3.5",
"redox_syscall 0.4.1",
"smallvec",
"windows-targets 0.48.5",
]
@ -2704,6 +2699,12 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@ -2845,6 +2846,15 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_users"
version = "0.4.3"
@ -2867,9 +2877,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.0"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
@ -2879,9 +2889,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.1"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
@ -2890,9 +2900,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "renderdoc-sys"
@ -2925,7 +2935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
dependencies = [
"base64",
"bitflags 2.4.0",
"bitflags 2.4.1",
"serde",
"serde_derive",
]
@ -2976,11 +2986,11 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
version = "0.38.19"
version = "0.38.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed"
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
dependencies = [
"bitflags 2.4.0",
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys",
@ -3070,18 +3080,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
[[package]]
name = "serde"
version = "1.0.188"
version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.188"
version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
dependencies = [
"proc-macro2",
"quote",
@ -3110,9 +3120,9 @@ dependencies = [
[[package]]
name = "serde_with"
version = "3.3.0"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237"
checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23"
dependencies = [
"base64",
"chrono",
@ -3127,9 +3137,9 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "3.3.0"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e6be15c453eb305019bfa438b1593c731f36a289a7853f7707ee29e870b3b3c"
checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788"
dependencies = [
"darling",
"proc-macro2",
@ -3293,18 +3303,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
@ -3324,14 +3334,15 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe"
checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
dependencies = [
"deranged",
"itoa",
"libc",
"num_threads",
"powerfmt",
"serde",
"time-core",
"time-macros",
@ -3481,9 +3492,9 @@ dependencies = [
[[package]]
name = "uuid"
version = "1.4.1"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
[[package]]
name = "vcpkg"
@ -3819,9 +3830,9 @@ dependencies = [
[[package]]
name = "wide"
version = "0.7.12"
version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebecebefc38ff1860b4bc47550bbfa63af5746061cf0d29fcd7fa63171602598"
checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242"
dependencies = [
"bytemuck",
"safe_arch",
@ -3903,15 +3914,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.51.1"
@ -4109,9 +4111,9 @@ dependencies = [
[[package]]
name = "winnow"
version = "0.5.16"
version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907"
checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c"
dependencies = [
"memchr",
]

View file

@ -8,6 +8,11 @@ gb-emu-lib = { path = "./lib", features = ["config"] }
baseview = { git = "https://github.com/italicsjenga/baseview" }
nih_plug = { git = "https://github.com/italicsjenga/nih-plug", branch = "raw-window-handle-0.5.0" }
nih_plug_xtask = { git = "https://github.com/italicsjenga/nih-plug", branch = "raw-window-handle-0.5.0" }
portability = { git = "https://github.com/italicsjenga/portability" }
portability-gfx = { git = "https://github.com/italicsjenga/portability", features = [
"gfx-backend-metal",
] }
portability-icd = { git = "https://github.com/italicsjenga/portability" }
[patch.crates-io]
librashader = { git = "https://github.com/italicsjenga/librashader" }
@ -24,3 +29,6 @@ librashader-cache = { git = "https://github.com/italicsjenga/librashader" }
# librashader-capi = { git = "https://github.com/italicsjenga/librashader" }
# librashader-build-script = { git = "https://github.com/italicsjenga/librashader" }
# ash = { git = "https://github.com/ash-rs/ash" }
# [patch."https://github.com/gfx-rs/gfx"]
# gfx-hal = { git = "https://github.com/gfx-rs//gfx", rev = "889fb69" }

View file

@ -8,7 +8,7 @@ description = "TWINC Game Boy (CGB/DMG) emulator"
identifier = "com.alexjanka.TWINC"
[features]
default = ["vulkan-static"]
default = ["vulkan"]
pixels = ["gb-emu-lib/pixels-renderer"]
vulkan = ["dep:raw-window-handle", "gb-emu-lib/vulkan-renderer"]
vulkan-static = ["vulkan", "gb-emu-lib/vulkan-static"]

View file

@ -7,9 +7,13 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]
[features]
default = ["vulkan-static"]
default = ["vulkan"]
pixels = ["gb-emu-lib/pixels-renderer"]
vulkan = ["dep:raw-window-handle", "gb-emu-lib/vulkan-renderer"]
vulkan = [
"dep:raw-window-handle",
"gb-emu-lib/vulkan-renderer",
"gb-emu-lib/no-debug",
]
vulkan-static = ["vulkan", "gb-emu-lib/vulkan-static"]
[dependencies]

View file

@ -5,6 +5,7 @@ edition = "2021"
[features]
default = []
no-debug = []
clocked-serial = []
vulkan-renderer = [
"dep:ash",

View file

@ -18,7 +18,7 @@ use self::{
},
};
#[cfg(debug_assertions)]
#[cfg(all(debug_assertions, not(feature = "no-debug")))]
mod debug;
mod types;
mod utils;
@ -33,7 +33,7 @@ const VERTICES: [Vertex; 3] = [Vertex(-1.0, -1.0), Vertex(3.0, -1.0), Vertex(-1.
pub struct RendererBackendManager {
entry: Entry,
instance: Instance,
#[cfg(debug_assertions)]
#[cfg(all(debug_assertions, not(feature = "no-debug")))]
#[allow(dead_code)]
debug: debug::VulkanDebug,
}
@ -52,15 +52,15 @@ impl RendererBackendManager {
.unwrap()
.to_vec();
#[cfg(debug_assertions)]
#[cfg(all(debug_assertions, not(feature = "no-debug")))]
extension_names.push(ash::extensions::ext::DebugUtils::name().as_ptr());
#[cfg(any(target_os = "macos", target_os = "ios"))]
{
#[cfg(not(feature = "vulkan-static"))]
extension_names.push(vk::KhrPortabilityEnumerationFn::name().as_ptr());
extension_names.push(vk::KhrGetPhysicalDeviceProperties2Fn::name().as_ptr());
}
// #[cfg(any(target_os = "macos", target_os = "ios"))]
// {
// #[cfg(not(feature = "vulkan-static"))]
// extension_names.push(vk::KhrPortabilityEnumerationFn::name().as_ptr());
// extension_names.push(vk::KhrGetPhysicalDeviceProperties2Fn::name().as_ptr());
// }
let appinfo = vk::ApplicationInfo::builder()
.application_name(&name)
@ -70,11 +70,12 @@ impl RendererBackendManager {
.api_version(vk::make_api_version(0, 1, 0, 0))
.build();
let create_flags = if cfg!(any(target_os = "macos", target_os = "ios")) {
vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR
} else {
vk::InstanceCreateFlags::default()
};
let create_flags = vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR;
// if cfg!(any(target_os = "macos", target_os = "ios")) {
// vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR
// } else {
// vk::InstanceCreateFlags::default()
// };
let create_info = vk::InstanceCreateInfo::builder()
.application_info(&appinfo)
@ -85,7 +86,7 @@ impl RendererBackendManager {
let instance = unsafe { entry.create_instance(&create_info, None) }.unwrap();
Self {
#[cfg(debug_assertions)]
#[cfg(all(debug_assertions, not(feature = "no-debug")))]
debug: debug::VulkanDebug::new(&entry, &instance),
entry,
instance,

View file

@ -51,7 +51,7 @@ shutil.copyfile(
follow_symlinks=True,
)
shutil.copyfile(
join(DYLIB_PATH, VULKAN_DYLIB_NAME),
"/Users/alex/Programming/forks/portability/target/release/libportability.dylib",
VULKAN_OUT,
follow_symlinks=True,
)