BROKEN WIP: Vulkan example

This commit is contained in:
Marijn Suijten 2023-11-29 23:42:28 +01:00
parent 036ecef4bc
commit 98aed74afc
No known key found for this signature in database
GPG key ID: 23E7CB3F180C39F2
5 changed files with 1128 additions and 7 deletions

65
Cargo.lock generated
View file

@ -69,6 +69,17 @@ dependencies = [
"libloading 0.7.4",
]
[[package]]
name = "ash-window"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab"
dependencies = [
"ash",
"raw-window-handle",
"raw-window-metal",
]
[[package]]
name = "async-channel"
version = "2.3.1"
@ -270,6 +281,22 @@ dependencies = [
"libc",
]
[[package]]
name = "cocoa"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
dependencies = [
"bitflags 1.3.2",
"block",
"cocoa-foundation 0.1.2",
"core-foundation 0.9.4",
"core-graphics 0.23.2",
"foreign-types",
"libc",
"objc",
]
[[package]]
name = "cocoa"
version = "0.26.0"
@ -278,7 +305,7 @@ checksum = "f79398230a6e2c08f5c9760610eb6924b52aa9e7950a619602baba59dcbbdbb2"
dependencies = [
"bitflags 2.7.0",
"block",
"cocoa-foundation",
"cocoa-foundation 0.2.0",
"core-foundation 0.10.0",
"core-graphics 0.24.0",
"foreign-types",
@ -286,6 +313,20 @@ dependencies = [
"objc",
]
[[package]]
name = "cocoa-foundation"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
dependencies = [
"bitflags 1.3.2",
"block",
"core-foundation 0.9.4",
"core-graphics-types 0.1.3",
"libc",
"objc",
]
[[package]]
name = "cocoa-foundation"
version = "0.2.0"
@ -516,10 +557,12 @@ name = "examples"
version = "0.24.0"
dependencies = [
"anyhow",
"ash",
"ash-window",
"atomic_refcell",
"byte-slice-cast",
"cairo-rs",
"cocoa",
"cocoa 0.26.0",
"data-encoding",
"derive_more",
"futures",
@ -544,6 +587,9 @@ dependencies = [
"gstreamer-rtsp-server",
"gstreamer-sdp",
"gstreamer-video",
"gstreamer-vulkan",
"gstreamer-vulkan-wayland",
"gstreamer-vulkan-xcb",
"image",
"memfd",
"memmap2",
@ -1574,7 +1620,6 @@ dependencies = [
name = "gstreamer-vulkan"
version = "0.24.0"
dependencies = [
"ash",
"bitflags 1.3.2",
"byteorder",
"glib",
@ -2204,6 +2249,18 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
[[package]]
name = "raw-window-metal"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac4ea493258d54c24cb46aa9345d099e58e2ea3f30dd63667fc54fc892f18e76"
dependencies = [
"cocoa 0.25.0",
"core-graphics 0.23.2",
"objc",
"raw-window-handle",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
@ -2565,7 +2622,7 @@ dependencies = [
"anyhow",
"async-channel",
"byte-slice-cast",
"cocoa",
"cocoa 0.26.0",
"futures",
"glib",
"gstreamer",

View file

@ -179,3 +179,7 @@ gst-video = { package = "gstreamer-video", path = "./gstreamer-video" }
gst-vulkan = { package = "gstreamer-vulkan", path = "./gstreamer-vulkan" }
gst-vulkan-wayland = { package = "gstreamer-vulkan-wayland", path = "./gstreamer-vulkan/wayland" }
gst-vulkan-xcb = { package = "gstreamer-vulkan-xcb", path = "./gstreamer-vulkan/xcb" }
# [patch.crates-io]
# ash = { path = "../../TraverseResearch/ash/ash" }
# ash-window = { path = "../../TraverseResearch/ash/ash-window" }

View file

@ -25,9 +25,14 @@ gst-rtsp = { workspace = true, optional = true }
gst-rtsp-server = { workspace = true, optional = true }
gst-allocators = { workspace = true, optional = true }
gio = { workspace = true, optional = true }
gst-vulkan = { workspace = true, optional = true }
gst-vulkan-wayland = { workspace = true, optional = true }
gst-vulkan-xcb = { workspace = true, optional = true }
ash = { version = "0.37", optional = true }
ash-window = { version = "0.12", optional = true }
anyhow = "1.0"
byte-slice-cast = "1"
cairo-rs = { workspace = true, features=["use_glib"], optional = true }
cairo-rs = { workspace = true, features = ["use_glib"], optional = true }
derive_more = { version = "1", features = ["display", "error"] }
futures = "0.3"
# Since there's nothing Windows-specific to enable on gstreamer-rs, unconditionally enable glutin's WGL backend
@ -71,9 +76,13 @@ rtsp-server-record = ["gst-rtsp-server", "gst-rtsp", "gio"]
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
overlay-composition = ["pango", "pangocairo", "cairo-rs"]
gl = ["dep:gst-gl", "dep:gl_generator", "dep:glutin", "dep:glutin-winit", "dep:winit", "dep:raw-window-handle"]
gst-gl-x11 = ["dep:gst-gl-x11", "glutin-winit?/glx"] # glx turns on x11
gst-gl-egl = ["dep:gst-gl-egl", "glutin-winit?/egl", "glutin-winit?/x11", "glutin-winit?/wayland"] # Use X11 or Wayland via EGL
gst-gl-x11 = ["gl", "dep:gst-gl-x11", "glutin-winit?/glx"] # glx turns on x11
gst-gl-egl = ["gl", "dep:gst-gl-egl", "glutin-winit?/egl", "glutin-winit?/x11", "glutin-winit?/wayland"] # Use X11 or Wayland via EGL
allocators = ["gst-allocators", "memmap2", "memfd", "uds"]
# TODO: Suffix with gst-?
vulkan = ["dep:ash", "dep:ash-window", "dep:gst-vulkan", "dep:winit", "dep:raw-window-handle"]
gst-vulkan-xcb = ["vulkan", "dep:gst-vulkan-xcb", "winit?/x11"]
gst-vulkan-wayland = ["vulkan", "dep:gst-vulkan-wayland", "winit?/wayland"]
[[bin]]
name = "appsink"
@ -217,3 +226,7 @@ name = "audio_multichannel_interleave"
[[bin]]
name = "zoom"
required-features = ["gst-video/v1_18"]
[[bin]]
name = "vkwindow"
required-features = ["vulkan"] #, "gst-vulkan/v1_24"]

View file

@ -0,0 +1,16 @@
#[path = "../vkupload.rs"]
mod vkupload;
use vkupload::*;
#[path = "../examples-common.rs"]
pub mod examples_common;
fn example_main() {
App::new(None)
.and_then(main_loop)
.unwrap_or_else(|e| eprintln!("Error! {}", e))
}
fn main() {
examples_common::run(example_main);
}

1031
examples/src/vkupload.rs Normal file

File diff suppressed because it is too large Load diff