no errors/warnings when switching back and forth between pixels and vulkan
This commit is contained in:
parent
9b7e52d73f
commit
3551b07211
2 changed files with 20 additions and 16 deletions
|
@ -301,6 +301,7 @@ impl QueuedBuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowRenderer {
|
impl WindowRenderer {
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn new(
|
fn new(
|
||||||
factor: usize,
|
factor: usize,
|
||||||
event_loop: &EventLoop<()>,
|
event_loop: &EventLoop<()>,
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use std::{
|
use std::sync::{Arc, Mutex};
|
||||||
path::PathBuf,
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
};
|
|
||||||
|
|
||||||
use baseview::{Event, EventStatus, Size, Window, WindowEvent, WindowHandler, WindowOpenOptions};
|
use baseview::{Event, EventStatus, Size, Window, WindowEvent, WindowHandler, WindowOpenOptions};
|
||||||
use gb_emu_lib::{
|
use gb_emu_lib::{
|
||||||
|
@ -11,7 +8,7 @@ use gb_emu_lib::{
|
||||||
use keyboard_types::{Code, KeyState};
|
use keyboard_types::{Code, KeyState};
|
||||||
use nih_plug::prelude::*;
|
use nih_plug::prelude::*;
|
||||||
|
|
||||||
use crate::{access_config, EmuComms, IS_CGB};
|
use crate::{access_config, EmuComms};
|
||||||
|
|
||||||
pub struct Emulator {
|
pub struct Emulator {
|
||||||
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
||||||
|
@ -53,15 +50,16 @@ impl Editor for Emulator {
|
||||||
// )
|
// )
|
||||||
// };
|
// };
|
||||||
|
|
||||||
let config = access_config();
|
|
||||||
|
|
||||||
#[cfg(feature = "vulkan")]
|
#[cfg(feature = "vulkan")]
|
||||||
let shader_path = if IS_CGB.get().is_some_and(|v| *v) {
|
let shader_path = {
|
||||||
config.emu_config.vulkan_config.cgb_shader_path.as_ref()
|
let config = access_config();
|
||||||
} else {
|
if crate::IS_CGB.get().is_some_and(|v| *v) {
|
||||||
config.emu_config.vulkan_config.dmg_shader_path.as_ref()
|
config.emu_config.vulkan_config.cgb_shader_path.as_ref()
|
||||||
}
|
} else {
|
||||||
.map(|p| config.config_dir.join(p));
|
config.emu_config.vulkan_config.dmg_shader_path.as_ref()
|
||||||
|
}
|
||||||
|
.map(|p| config.config_dir.join(p))
|
||||||
|
};
|
||||||
|
|
||||||
let scale_factor = access_config().vst_config.scale_factor;
|
let scale_factor = access_config().vst_config.scale_factor;
|
||||||
|
|
||||||
|
@ -128,7 +126,7 @@ impl EmulatorWindow {
|
||||||
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
||||||
manager: Arc<Mutex<Option<Arc<RendererBackendManager>>>>,
|
manager: Arc<Mutex<Option<Arc<RendererBackendManager>>>>,
|
||||||
size: Size,
|
size: Size,
|
||||||
#[cfg(feature = "vulkan")] shader_path: Option<PathBuf>,
|
#[cfg(feature = "vulkan")] shader_path: Option<std::path::PathBuf>,
|
||||||
) -> (Self, Arc<RendererBackendManager>) {
|
) -> (Self, Arc<RendererBackendManager>) {
|
||||||
let current_resolution = ResolutionData {
|
let current_resolution = ResolutionData {
|
||||||
real_width: size.width as u32,
|
real_width: size.width as u32,
|
||||||
|
@ -145,8 +143,13 @@ impl EmulatorWindow {
|
||||||
let mut guard = manager.lock().unwrap();
|
let mut guard = manager.lock().unwrap();
|
||||||
|
|
||||||
let m = guard.get_or_insert_with(|| {
|
let m = guard.get_or_insert_with(|| {
|
||||||
use raw_window_handle::HasRawDisplayHandle;
|
#[cfg(feature = "vulkan")]
|
||||||
Arc::new(RendererBackendManager::new(window.raw_display_handle()))
|
{
|
||||||
|
use raw_window_handle::HasRawDisplayHandle;
|
||||||
|
Arc::new(RendererBackendManager::new(window.raw_display_handle()))
|
||||||
|
}
|
||||||
|
#[cfg(feature = "pixels")]
|
||||||
|
Arc::new(RendererBackendManager::new())
|
||||||
});
|
});
|
||||||
|
|
||||||
let renderer = RendererBackend::new(current_resolution, window, window_options, m.clone());
|
let renderer = RendererBackend::new(current_resolution, window, window_options, m.clone());
|
||||||
|
|
Loading…
Add table
Reference in a new issue