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 {
|
||||
#[allow(unused_variables)]
|
||||
fn new(
|
||||
factor: usize,
|
||||
event_loop: &EventLoop<()>,
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
use std::{
|
||||
path::PathBuf,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use baseview::{Event, EventStatus, Size, Window, WindowEvent, WindowHandler, WindowOpenOptions};
|
||||
use gb_emu_lib::{
|
||||
|
@ -11,7 +8,7 @@ use gb_emu_lib::{
|
|||
use keyboard_types::{Code, KeyState};
|
||||
use nih_plug::prelude::*;
|
||||
|
||||
use crate::{access_config, EmuComms, IS_CGB};
|
||||
use crate::{access_config, EmuComms};
|
||||
|
||||
pub struct Emulator {
|
||||
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
||||
|
@ -53,15 +50,16 @@ impl Editor for Emulator {
|
|||
// )
|
||||
// };
|
||||
|
||||
let config = access_config();
|
||||
|
||||
#[cfg(feature = "vulkan")]
|
||||
let shader_path = if IS_CGB.get().is_some_and(|v| *v) {
|
||||
let shader_path = {
|
||||
let config = access_config();
|
||||
if crate::IS_CGB.get().is_some_and(|v| *v) {
|
||||
config.emu_config.vulkan_config.cgb_shader_path.as_ref()
|
||||
} else {
|
||||
config.emu_config.vulkan_config.dmg_shader_path.as_ref()
|
||||
}
|
||||
.map(|p| config.config_dir.join(p));
|
||||
.map(|p| config.config_dir.join(p))
|
||||
};
|
||||
|
||||
let scale_factor = access_config().vst_config.scale_factor;
|
||||
|
||||
|
@ -128,7 +126,7 @@ impl EmulatorWindow {
|
|||
emu_comms: Arc<Mutex<Option<EmuComms>>>,
|
||||
manager: Arc<Mutex<Option<Arc<RendererBackendManager>>>>,
|
||||
size: Size,
|
||||
#[cfg(feature = "vulkan")] shader_path: Option<PathBuf>,
|
||||
#[cfg(feature = "vulkan")] shader_path: Option<std::path::PathBuf>,
|
||||
) -> (Self, Arc<RendererBackendManager>) {
|
||||
let current_resolution = ResolutionData {
|
||||
real_width: size.width as u32,
|
||||
|
@ -145,8 +143,13 @@ impl EmulatorWindow {
|
|||
let mut guard = manager.lock().unwrap();
|
||||
|
||||
let m = guard.get_or_insert_with(|| {
|
||||
#[cfg(feature = "vulkan")]
|
||||
{
|
||||
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());
|
||||
|
|
Loading…
Add table
Reference in a new issue