diff --git a/frontend-common/src/window/winit_manager.rs b/frontend-common/src/window/winit_manager.rs index 0cf3dae..56bb5d0 100644 --- a/frontend-common/src/window/winit_manager.rs +++ b/frontend-common/src/window/winit_manager.rs @@ -8,10 +8,11 @@ use std::{ }; use cpal::Stream; -use gb_emu_lib::{ - connect::{EmulatorMessage, JoypadState, RendererMessage, ResolutionData}, - renderer::{RendererBackend, RendererBackendManager, WindowOptions}, -}; +use gb_emu_lib::connect::{EmulatorMessage, JoypadState, RendererMessage, ResolutionData}; +#[cfg(feature = "pixels")] +use gb_emu_lib::renderer::pixels::{RendererBackend, RendererBackendManager, WindowOptions}; +#[cfg(feature = "vulkan")] +use gb_emu_lib::renderer::vulkan::{RendererBackend, RendererBackendManager, WindowOptions}; use gilrs::{Button, Gilrs}; use image::ImageBuffer; #[cfg(feature = "vulkan")] diff --git a/gb-vst/src/plugin/ui.rs b/gb-vst/src/plugin/ui.rs index 859d641..0161ff2 100644 --- a/gb-vst/src/plugin/ui.rs +++ b/gb-vst/src/plugin/ui.rs @@ -3,10 +3,13 @@ use std::sync::{Arc, Mutex}; use baseview::{ Event, EventStatus, Size, Window, WindowEvent, WindowHandle, WindowHandler, WindowOpenOptions, }; -use gb_emu_lib::{ - connect::{JoypadButtons, JoypadState, RendererMessage, ResolutionData, HEIGHT, WIDTH}, - renderer::{RendererBackend, RendererBackendManager, WindowOptions}, +use gb_emu_lib::connect::{ + JoypadButtons, JoypadState, RendererMessage, ResolutionData, HEIGHT, WIDTH, }; +#[cfg(feature = "pixels")] +use gb_emu_lib::renderer::pixels::{RendererBackend, RendererBackendManager, WindowOptions}; +#[cfg(feature = "vulkan")] +use gb_emu_lib::renderer::vulkan::{RendererBackend, RendererBackendManager, WindowOptions}; use keyboard_types::{Code, KeyState}; use nih_plug::prelude::*; diff --git a/gui/src/macos/cacao_window_manager.rs b/gui/src/macos/cacao_window_manager.rs index 46b96e7..2ae2692 100644 --- a/gui/src/macos/cacao_window_manager.rs +++ b/gui/src/macos/cacao_window_manager.rs @@ -24,7 +24,7 @@ use frontend_common::{ }; use gb_emu_lib::{ connect::{EmulatorMessage, JoypadButtons, JoypadState, RendererMessage, ResolutionData}, - renderer::{RendererBackend, RendererBackendManager, WindowOptions}, + renderer::vulkan::{RendererBackend, RendererBackendManager, WindowOptions}, }; use objc::{ class, msg_send, msg_send_id, diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 50dce23..6361e1b 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -11,10 +11,6 @@ use std::sync::mpsc::Receiver; #[cfg(all(feature = "vulkan", feature = "pixels"))] compile_error!("select only one rendering backend!"); -#[allow(unused_attributes)] -#[cfg(any(feature = "vulkan-renderer", feature = "pixels-renderer"))] -#[cfg_attr(feature = "pixels-renderer", path = "renderer/pixels.rs")] -#[cfg_attr(feature = "vulkan-renderer", path = "renderer/vulkan/vulkan.rs")] pub mod renderer; #[cfg(feature = "config")] diff --git a/lib/src/renderer/mod.rs b/lib/src/renderer/mod.rs new file mode 100644 index 0000000..7a1ff33 --- /dev/null +++ b/lib/src/renderer/mod.rs @@ -0,0 +1,4 @@ +#[cfg(feature = "pixels-renderer")] +pub mod pixels; +#[cfg(feature = "vulkan-renderer")] +pub mod vulkan; diff --git a/lib/src/renderer/vulkan/vulkan.rs b/lib/src/renderer/vulkan/mod.rs similarity index 100% rename from lib/src/renderer/vulkan/vulkan.rs rename to lib/src/renderer/vulkan/mod.rs