vst is more renderer agnostic
This commit is contained in:
parent
b3572f5262
commit
ffe677088f
2 changed files with 29 additions and 13 deletions
|
@ -8,13 +8,15 @@ name = "vst"
|
|||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["vulkan"]
|
||||
pixels = ["gb-emu-lib/pixels-renderer"]
|
||||
vulkan = ["dep:raw-window-handle", "gb-emu-lib/vulkan-static"]
|
||||
|
||||
[dependencies]
|
||||
gb-emu-lib = { path = "../lib", features = ["vulkan-renderer", "config"] }
|
||||
gb-emu-lib = { path = "../lib", features = ["config"] }
|
||||
nih_plug = { path = "../vendored/nih-plug", features = ["standalone"] }
|
||||
baseview = { path = "../vendored/baseview" }
|
||||
async-ringbuf = "0.1"
|
||||
futures = "0.3"
|
||||
keyboard-types = "0.6.2"
|
||||
raw-window-handle = "0.5"
|
||||
raw-window-handle = { version = "0.5", optional = true }
|
||||
|
|
|
@ -15,7 +15,6 @@ use gb_emu_lib::{
|
|||
};
|
||||
use keyboard_types::{Code, KeyState};
|
||||
use nih_plug::prelude::*;
|
||||
use raw_window_handle::HasRawDisplayHandle;
|
||||
|
||||
use crate::{Frame, FrameReceiver, JoypadInfo, JoypadSender};
|
||||
|
||||
|
@ -62,6 +61,7 @@ impl Editor for Emulator {
|
|||
// )
|
||||
// };
|
||||
|
||||
#[cfg(feature = "vulkan")]
|
||||
let shader_path = self.shader_path.lock().unwrap().clone();
|
||||
// let shader_path = None;
|
||||
|
||||
|
@ -73,7 +73,15 @@ impl Editor for Emulator {
|
|||
scale: baseview::WindowScalePolicy::SystemScaleFactor,
|
||||
gl_config: None,
|
||||
},
|
||||
|w| EmulatorWindow::new(w, fr_cloned, js_cloned, shader_path),
|
||||
|w| {
|
||||
EmulatorWindow::new(
|
||||
w,
|
||||
fr_cloned,
|
||||
js_cloned,
|
||||
#[cfg(feature = "vulkan")]
|
||||
shader_path,
|
||||
)
|
||||
},
|
||||
);
|
||||
Box::new(Self::new(
|
||||
self.frame_receiver.clone(),
|
||||
|
@ -110,7 +118,7 @@ impl EmulatorWindow {
|
|||
window: &mut Window,
|
||||
frame_receiver: Arc<FrameReceiver>,
|
||||
joypad_sender: Arc<JoypadSender>,
|
||||
shader_path: Option<PathBuf>,
|
||||
#[cfg(feature = "vulkan")] shader_path: Option<PathBuf>,
|
||||
) -> Self {
|
||||
let info = WindowInfo::from_logical_size(
|
||||
Size::new(WIDTH as f64, HEIGHT as f64),
|
||||
|
@ -125,14 +133,20 @@ impl EmulatorWindow {
|
|||
scaled_height: HEIGHT as u32,
|
||||
};
|
||||
|
||||
let manager = Arc::new(RendererBackendManager::new(window.raw_display_handle()));
|
||||
|
||||
let renderer = RendererBackend::new(
|
||||
current_resolution,
|
||||
window,
|
||||
#[cfg(feature = "vulkan")]
|
||||
let (manager, window_options) = {
|
||||
use raw_window_handle::HasRawDisplayHandle;
|
||||
(
|
||||
Arc::new(RendererBackendManager::new(window.raw_display_handle())),
|
||||
WindowOptions { shader_path },
|
||||
manager.clone(),
|
||||
);
|
||||
)
|
||||
};
|
||||
#[cfg(feature = "pixels")]
|
||||
let (manager, window_options) =
|
||||
{ (Arc::new(RendererBackendManager::new()), WindowOptions {}) };
|
||||
|
||||
let renderer =
|
||||
RendererBackend::new(current_resolution, window, window_options, manager.clone());
|
||||
|
||||
Self {
|
||||
renderer,
|
||||
|
|
Loading…
Add table
Reference in a new issue