diff --git a/gb-emu/src/renderer/vulkan/vulkan.rs b/gb-emu/src/renderer/vulkan/vulkan.rs index f78759b..b9a7bd1 100644 --- a/gb-emu/src/renderer/vulkan/vulkan.rs +++ b/gb-emu/src/renderer/vulkan/vulkan.rs @@ -19,6 +19,7 @@ const VERTICES: [Vertex; 3] = [Vertex(-1.0, -1.0), Vertex(3.0, -1.0), Vertex(-1. pub struct WindowData { inner: VulkanWindowInner, + filter_chain: FilterChain, } pub struct WindowOptions { @@ -29,31 +30,29 @@ impl WindowData { pub fn new(factor: u32, window: &Window, options: WindowOptions) -> Self { let inner = unsafe { VulkanWindowInner::new(factor, window) }; - // let filter_chain_options = FilterChainOptions { - // frames_in_flight: 0, - // force_no_mipmaps: false, - // use_render_pass: true, - // disable_cache: false, - // }; - // let physical_device = unsafe { - // inner - // .instance - // .enumerate_physical_devices() - // .unwrap() - // .first() - // .unwrap() - // }; - // let vulkan = VulkanObjects::try_from(( - // *physical_device, - // inner.instance.clone(), - // inner.device.clone(), - // )) - // .unwrap(); - // let filter_chain = unsafe { - // FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options)) - // } - // .unwrap(); - Self { inner } + let filter_chain_options = FilterChainOptions { + frames_in_flight: 0, + force_no_mipmaps: false, + use_render_pass: true, + disable_cache: false, + }; + let physical_devices = unsafe { inner.instance.enumerate_physical_devices().unwrap() }; + let physical_device = physical_devices.first().unwrap(); + let vulkan = VulkanObjects::try_from(( + *physical_device, + inner.instance.clone(), + inner.device.clone(), + )) + .unwrap(); + let filter_chain = unsafe { + FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options)) + } + .unwrap(); + + Self { + inner, + filter_chain, + } } pub fn resize(&mut self, width: u32, height: u32, factor: u32, window: &Window) { diff --git a/gb-emu/src/window.rs b/gb-emu/src/window.rs index 471d402..aae2c04 100644 --- a/gb-emu/src/window.rs +++ b/gb-emu/src/window.rs @@ -117,7 +117,9 @@ impl WindowRenderer { let real_factor = (window.scale_factor() * factor as f64) as usize; let options = WindowOptions { - shader_path: std::path::PathBuf::new(), + shader_path: std::path::PathBuf::from( + "./test-roms/shaders/slang-shaders/bilinear.slangp", + ), }; let data = Arc::new(Mutex::new(WindowData::new(