feat: hardware accelerated wayland apps
This commit is contained in:
660
Cargo.lock
generated
660
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,13 @@ version = "0.16.7"
|
|||||||
git = "https://github.com/smithay/smithay.git" # Until we get stereokit to understand OES samplers and external textures
|
git = "https://github.com/smithay/smithay.git" # Until we get stereokit to understand OES samplers and external textures
|
||||||
# path = "../smithay"
|
# path = "../smithay"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["desktop", "renderer_gl", "wayland_frontend"]
|
features = [
|
||||||
|
"desktop",
|
||||||
|
"backend_egl",
|
||||||
|
"renderer_gl",
|
||||||
|
"use_system_lib",
|
||||||
|
"wayland_frontend",
|
||||||
|
]
|
||||||
version = "*"
|
version = "*"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use color_eyre::eyre::Result;
|
|||||||
use directories::ProjectDirs;
|
use directories::ProjectDirs;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use stardust_xr::server;
|
use stardust_xr::server;
|
||||||
|
use std::mem::ManuallyDrop;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -249,7 +250,7 @@ fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
drop(wayland);
|
let wayland = ManuallyDrop::new(wayland);
|
||||||
|
|
||||||
let _ = event_stop_tx.send(());
|
let _ = event_stop_tx.send(());
|
||||||
event_thread
|
event_thread
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use sk::StereoKitDraw;
|
|||||||
use smithay::backend::allocator::dmabuf::Dmabuf;
|
use smithay::backend::allocator::dmabuf::Dmabuf;
|
||||||
use smithay::backend::egl::EGLContext;
|
use smithay::backend::egl::EGLContext;
|
||||||
use smithay::backend::renderer::gles::GlesRenderer;
|
use smithay::backend::renderer::gles::GlesRenderer;
|
||||||
use smithay::backend::renderer::ImportDma;
|
use smithay::backend::renderer::{ImportDma, ImportEgl};
|
||||||
use smithay::reexports::wayland_server::{backend::GlobalId, Display, ListeningSocket};
|
use smithay::reexports::wayland_server::{backend::GlobalId, Display, ListeningSocket};
|
||||||
use std::os::unix::prelude::AsRawFd;
|
use std::os::unix::prelude::AsRawFd;
|
||||||
use std::{
|
use std::{
|
||||||
@@ -72,7 +72,7 @@ pub struct Wayland {
|
|||||||
impl Wayland {
|
impl Wayland {
|
||||||
pub fn new() -> Result<Self> {
|
pub fn new() -> Result<Self> {
|
||||||
let egl_raw_handles = get_sk_egl()?;
|
let egl_raw_handles = get_sk_egl()?;
|
||||||
let renderer = unsafe {
|
let mut renderer = unsafe {
|
||||||
GlesRenderer::new(EGLContext::from_raw(
|
GlesRenderer::new(EGLContext::from_raw(
|
||||||
egl_raw_handles.display,
|
egl_raw_handles.display,
|
||||||
egl_raw_handles.config,
|
egl_raw_handles.config,
|
||||||
@@ -82,6 +82,7 @@ impl Wayland {
|
|||||||
|
|
||||||
let display: Display<WaylandState> = Display::new()?;
|
let display: Display<WaylandState> = Display::new()?;
|
||||||
let display_handle = display.handle();
|
let display_handle = display.handle();
|
||||||
|
renderer.bind_wl_display(&display_handle)?;
|
||||||
|
|
||||||
let (dmabuf_tx, dmabuf_rx) = mpsc::unbounded_channel();
|
let (dmabuf_tx, dmabuf_rx) = mpsc::unbounded_channel();
|
||||||
let display = Arc::new(Mutex::new(display));
|
let display = Arc::new(Mutex::new(display));
|
||||||
|
|||||||
Reference in New Issue
Block a user